本文整理汇总了PHP中PDOStatement::bindColumn方法的典型用法代码示例。如果您正苦于以下问题:PHP PDOStatement::bindColumn方法的具体用法?PHP PDOStatement::bindColumn怎么用?PHP PDOStatement::bindColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PDOStatement
的用法示例。
在下文中一共展示了PDOStatement::bindColumn方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bindColumn
/**
* Bind a value of the column or field table
* @access public
* @param string $column
* @param mixed $param
* @param string $type
* @return void
*/
public function bindColumn($column, &$param, $type = null)
{
if ($type === null) {
$this->_statement->bindColumn($column, $param);
} else {
$this->_statement->bindColumn($column, $param, $type);
}
}
示例2: testBindColumn
/**
* @covers Fabfuel\Prophiler\Decorator\PDO\PDOStatement::bindColumn
* @uses Fabfuel\Prophiler\Decorator\PDO\PDOStatement
*/
public function testBindColumn()
{
$column = 'foo';
$param = 'bar';
$type = \PDO::PARAM_STR;
$maxlen = 15;
$driverdata = 'lorem ipsum';
$this->pdoStatement->expects($this->once())->method('bindColumn')->with($column, $param, $type, $maxlen, $driverdata)->willReturn(true);
$this->assertTrue($this->decorator->bindColumn($column, $param, $type, $maxlen, $driverdata));
}
示例3: bindColumn
/**
* Bind a column of the statement result set to a PHP variable.
*
* @param string $column Name the column in the result set, either by
* position or by name.
* @param mixed $param Reference to the PHP variable containing the value.
* @param mixed $type OPTIONAL
* @return bool
* @throws Zend_Db_Statement_Exception
*/
public function bindColumn($column, &$param, $type = null)
{
try {
if (is_null($type)) {
return $this->_stmt->bindColumn($column, $param);
} else {
return $this->_stmt->bindColumn($column, $param, $type);
}
} catch (PDOException $e) {
require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception($e->getMessage());
}
}
示例4: bindColumns
protected function bindColumns()
{
if (!$this->columnsBound) {
$this->columnsBound = true;
$this->actRow = array();
$this->actRowIndex = array();
$count = $this->pdoStmt->columnCount();
for ($i = 0; $i < $count; $i++) {
$meta = $this->pdoStmt->getColumnMeta($i);
if (array_key_exists('native_type', $meta) && $meta['native_type'] == 'BLOB') {
$this->pdoStmt->bindColumn($i + 1, $this->actRow[$meta['name']], \PDO::PARAM_LOB);
} else {
$this->pdoStmt->bindColumn($i + 1, $this->actRow[$meta['name']]);
}
$this->actRowIndex[$i] =& $this->actRow[$meta['name']];
}
}
}
示例5: bindColumn
/**
* Bind a column of the statement result set to a PHP variable.
* Note: This method exists because pass-by-reference won't work with
* call_user_func_array();
*
* @param string $column Name the column in the result set, either by position
* or by name. Note: if by name must match case.
* @param mixed $variable Reference to the PHP variable containing the value.
* @param mixed $type OPTIONAL: PDO::PARAM_* Type hint.
* @return bool TRUE on success, FALSE on failure
*/
public function bindColumn($column, &$variable, $type = null)
{
try {
if (is_null($type)) {
return $this->_stmt->bindColumn($column, $variable);
} else {
return $this->_stmt->bindColumn($column, $variable, $type);
}
} catch (PDOException $e) {
throw new DBALite_Exception("Error binding column '{$column}' to PHP variable", $e);
}
}
示例6: bindColumn
public function bindColumn($column, &$param, $type = null, $maxlen = null, $driverdata = null)
{
switch ($type) {
case PDO::PARAM_JSON:
case PDO::PARAM_DATETIME:
case PDO::PARAM_DATE:
case PDO::PARAM_ARRAY:
$this->setColumnType($column, $type);
$this->_columnsVars[$column] =& $param;
break;
default:
return $this->_statement->bindColumn($column, $param, $type, $maxlen, $driverdata);
}
return true;
}
示例7: bind
public function bind(PDOStatement $stmt, YokazeDb_Vo $vo)
{
$columnCount = $stmt->columnCount();
$columnTypes = array();
$columnNames = array();
$VoNames = array();
for ($i = 0; $i < $columnCount; $i++){
$meta = $stmt->getColumnMeta($i);
if (!$meta)
break;
//if (isset($meta['pdo_type']))
$columnTypes[$i] = $meta['pdo_type'];
$columnNames[$i] = $meta['name'];
$name = implode('', array_map('ucfirst', explode('_', $meta['name'])));
$name[0] = strtolower($name[0]);
$voNames[$i] = $name;
}
for($i = 0; $i < $columnCount; $i++){
$name = $voNames[$i];
$vo->$name = null;
$stmt->bindColumn($columnNames[$i], $vo->$name, $columnTypes[$i]);
}
}
示例8: bindColumn
/**
* {@inheritdoc}
*/
public function bindColumn($column, &$param, $type = null, $maxlen = null, $driverdata = null)
{
return $this->statement->bindColumn($column, $param, $type, $maxlen, $driverdata);
}
示例9: bindMenuValues
/**
* @param \PDOStatement $stmt
* @param $AppID
* @param $ComponentID
* @param $URL
* @param $MenuID
*/
public function bindMenuValues($stmt, $AppID, $ComponentID, $URL, &$MenuID)
{
$stmt->bindValue(':AppID', $AppID, PDO::PARAM_STR);
$stmt->bindValue(':ComponentID', $ComponentID, PDO::PARAM_STR);
$stmt->bindValue(':URL', "%{$URL}", PDO::PARAM_STR);
$stmt->bindColumn('MenuID', $MenuID, PDO::PARAM_INT);
}
示例10: bind
private function bind(\PDOStatement $statement, $values)
{
$count = 1;
foreach ($values as $value) {
$statement->bindColumn($count, $value, \PDO::PARAM_STR, strlen($value));
}
return $statement;
}
示例11: bindColumn
/**
* @param $column
* @param $param
* @param null $type
* @param null $maxlen
* @param null $driverdata
* @return bool
*/
public function bindColumn($column, &$param, $type = null, $maxlen = null, $driverdata = null)
{
$archLog = array('method' => 'PDOStatement::bindColumn', 'input' => array('column' => $column, 'param' => $param, 'type' => $type, 'maxlen' => $maxlen, 'driverdata' => $driverdata), 'output' => $this->PDOStatement->bindColumn($column, $param, $type, $maxlen, $driverdata), 'pointer' => $this->assignPointerString());
return self::setLogReturnOutput($archLog);
}
示例12: bindColumn
/**
* @inheritdoc
*/
public function bindColumn($column, &$param, $type = null, $maxlen = null, $driverdata = null)
{
$this->params[$column] = $param;
return parent::bindColumn($column, $param, $type, $maxlen, $driverdata);
}