我很难通过Doctrine的DBAL文档进行导航。我想知道我可以在$ type值中放入什么字符串值:
bindValue($pointername, $variable, $type);
我在讨论类型的文档中没有找到任何内容。
我正在使用MySQL,所以我想知道我可以在bindValue
函数中添加的类型等同于varchar
,tinyint
,{{1 }},text
,datetime
,mediumtext
等
答案 0 :(得分:2)
根据http://www.doctrine-project.org/api/dbal/2.0/doctrine/dbal/statement.html#bindValue(),$type
参数可以是PDO类型(请参阅http://au.php.net/manual/en/pdo.constants.php)或dbal映射类型(请参阅http://www.doctrine-project.org/api/dbal/2.0/doctrine/dbal/types/type.html)。
因此,您可以根据事物的外观使用PDO::PARAM_INT
或Doctrine\DBAL\Types\Type::Integer
。