本文整理汇总了PHP中Propel\Generator\Model\Column::getPDOType方法的典型用法代码示例。如果您正苦于以下问题:PHP Column::getPDOType方法的具体用法?PHP Column::getPDOType怎么用?PHP Column::getPDOType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Propel\Generator\Model\Column
的用法示例。
在下文中一共展示了Column::getPDOType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getColumnBindingPHP
/**
* Get the PHP snippet for binding a value to a column.
* Warning: duplicates logic from OracleAdapter::bindValue().
* Any code modification here must be ported there.
*/
public function getColumnBindingPHP(Column $column, $identifier, $columnValueAccessor, $tab = " ")
{
if ($column->getPDOType() == PropelTypes::CLOB_EMU) {
return sprintf("%s\$stmt->bindParam(%s, %s, %s, strlen(%s));\n", $tab, $identifier, $columnValueAccessor, PropelTypes::getPdoTypeString($column->getType()), $columnValueAccessor);
}
return parent::getColumnBindingPHP($column, $identifier, $columnValueAccessor, $tab);
}
示例2: testGetPdoType
/**
* @dataProvider providePdoTypes
*
*/
public function testGetPdoType($mappingType, $pdoType)
{
$domain = $this->getDomainMock();
$domain->expects($this->any())->method('getType')->will($this->returnValue($mappingType));
$column = new Column();
$column->setDomain($domain);
$column->setType($mappingType);
$this->assertSame($pdoType, $column->getPDOType());
}
示例3: getColumnBindingPHP
public function getColumnBindingPHP(Column $column, $identifier, $columnValueAccessor, $tab = " ")
{
// FIXME - This is a temporary hack to get around apparent bugs w/ PDO+MYSQL
// See http://pecl.php.net/bugs/bug.php?id=9919
if ($column->getPDOType() === \PDO::PARAM_BOOL) {
return sprintf("\n%s\$stmt->bindValue(%s, (int) %s, PDO::PARAM_INT);", $tab, $identifier, $columnValueAccessor);
}
return parent::getColumnBindingPHP($column, $identifier, $columnValueAccessor, $tab);
}
示例4: getColumnBindingPHP
/**
* Get the PHP snippet for binding a value to a column.
* Warning: duplicates logic from AdapterInterface::bindValue().
* Any code modification here must be ported there.
*/
public function getColumnBindingPHP(Column $column, $identifier, $columnValueAccessor, $tab = " ")
{
$script = '';
if ($column->isTemporalType()) {
$columnValueAccessor = $columnValueAccessor . " ? " . $columnValueAccessor . "->format(\"" . $this->getTimeStampFormatter() . "\") : null";
} elseif ($column->isLobType()) {
// we always need to make sure that the stream is rewound, otherwise nothing will
// get written to database.
$script .= "\nif (is_resource({$columnValueAccessor})) {\n rewind({$columnValueAccessor});\n}";
}
$script .= sprintf("\n\$stmt->bindValue(%s, %s, %s);", $identifier, $columnValueAccessor, PropelTypes::getPdoTypeStringFromPdoType($column->getPDOType()));
return preg_replace('/^(.+)/m', $tab . '$1', $script);
}