4

I cannot seem to find a way to bind a bytea to a prepared statement using PHP5's PDO and PostgreSQL. Heres how i imagine this working...

$this->stmtPDO = $this->hPDO->prepare (
    'INSERT INTO board.feedback ("created", "title", "payloaddata")
     VALUES (NOW(), :title, :payload) RETURNING psk;', 
    array(PDO::ATTR_CURSOR, PDO::CURSOR_SCROLL)
);
$this->stmtPDO->bindParam(":payload", $payload);
$this->stmtPDO->bindParam(":title", $title);
$this->stmtPDO->execute();

Has anyone found an easy solution for this?

j0k
  • 22,600
  • 28
  • 79
  • 90
grmartin
  • 1,399
  • 2
  • 12
  • 23
  • Have you tried to set the type of the parameter to `PDO::PARAM_LOB` e.g. `$this->stmtPDO->bindParam(":payload", $payload, PDO::PARAM_LOB);`? – Milen A. Radev Mar 15 '11 at 14:28

1 Answers1

4

Have you tried to set the type of the parameter to PDO::PARAM_LOB? E.g.

$this->stmtPDO->bindParam(":payload", $payload, PDO::PARAM_LOB);?
Milen A. Radev
  • 60,241
  • 22
  • 105
  • 110