本文整理汇总了PHP中PDOStatement::setAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP PDOStatement::setAttribute方法的具体用法?PHP PDOStatement::setAttribute怎么用?PHP PDOStatement::setAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PDOStatement
的用法示例。
在下文中一共展示了PDOStatement::setAttribute方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setAttribute
public function setAttribute($attribute, $value)
{
if ($this->_statement instanceof \PDOStatement) {
return $this->_statement->setAttribute($attribute, $value);
}
return false;
}
示例2: setAttribute
/**
* Set a statement attribute.
*
* @param string $key Attribute name.
* @param mixed $val Attribute value.
* @return bool
* @throws Zend_Db_Statement_Exception
*/
public function setAttribute($key, $val)
{
try {
return $this->_stmt->setAttribute($key, $val);
} catch (PDOException $e) {
require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception($e->getMessage());
}
}
示例3: setAttribute
/**
* @param int $attribute
* @param mixed $value
* @return bool
* @throws \Compeek\PDOWrapper\NotConnectedException
*/
public function setAttribute($attribute, $value)
{
$this->requireConnection();
$result = $this->pdoStatement->setAttribute($attribute, $value);
if ($result) {
$this->pdoStatementAttributes[$attribute] = $value;
}
return $result;
}
示例4: dataSeek
/**
* Moves internal resulset cursor to another position letting us to fetch a certain row
*
*<code>
* $result = $connection->query("SELECT * FROM robots ORDER BY name");
* $result->dataSeek(2); // Move to third row on result
* $row = $result->fetch(); // Fetch third row
*</code>
*
* @param int $number
* @return null|false
*/
public function dataSeek($number)
{
/* Validation */
if (is_int($number) === false) {
return;
}
$this->_rowOffset = $number;
if ($this->_pdoStatement->setAttribute(\PDO::ATTR_CURSOR, \PDO::CURSOR_SCROLL) === false) {
return false;
}
}
示例5: setFetchSize
public function setFetchSize($fetchSize)
{
$this->checkClosed();
$this->stmt->setAttribute(\PDO::ATTR_PREFETCH, \blaze\lang\Integer::asNative($fetchSize));
}
示例6: __construct
/**
* csvImporter constructor.
* @param PDOStatement $dbh
*/
public function __construct($dbh, $csvPath)
{
$dbh->setAttribute(\PDO::ATTR_EMULATE_PREPARES, true);
$this->dbh = $dbh;
$this->csvPath = $csvPath;
}
示例7: setAttribute
/**
* @param int $attribute
* @param mixed $value
* @return bool
*/
public function setAttribute($attribute, $value)
{
$archLog = array('method' => 'PDOStatement::setAttribute', 'input' => array('attribute' => $attribute, 'value' => $value), 'output' => $this->PDOStatement->setAttribute($attribute, $value), 'pointer' => $this->assignPointerString());
return self::setLogReturnOutput($archLog);
}