在PHP5中将BYTEA绑定到PGSQL PDO准备好的语句 [英] Bind BYTEA to PGSQL PDO Prepared Statement in PHP5
本文介绍了在PHP5中将BYTEA绑定到PGSQL PDO准备好的语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我似乎找不到使用PHP5的PDO和PostgreSQL将bytea绑定到准备好的语句的方法.这就是我想象的这种工作方式...
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?
推荐答案
您是否尝试将参数的类型设置为PDO::PARAM_LOB
?
例如
Have you tried to set the type of the parameter to PDO::PARAM_LOB
?
E.g.
$this->stmtPDO->bindParam(":payload", $payload, PDO::PARAM_LOB);?
这篇关于在PHP5中将BYTEA绑定到PGSQL PDO准备好的语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文