本文整理匯總了PHP中Illuminate\Database\ConnectionInterface::statement方法的典型用法代碼示例。如果您正苦於以下問題:PHP ConnectionInterface::statement方法的具體用法?PHP ConnectionInterface::statement怎麽用?PHP ConnectionInterface::statement使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Illuminate\Database\ConnectionInterface
的用法示例。
在下文中一共展示了ConnectionInterface::statement方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
/**
* @param ConnectionInterface $connection
* @param atring $schema
* @param string $prefix
*/
public function __construct(ConnectionInterface $connection, $schema, $prefix = '')
{
$this->connection = $connection;
$this->prefix = $prefix;
$result = $this->connection->select("SELECT * FROM sqlite_master WHERE name = '{$this->table}' AND type = 'table'");
if (0 == count($result)) {
// Create the caches table
$this->connection->statement($schema);
}
}
示例2: truncate
/**
* Truncate all records
* @return void
*/
public function truncate()
{
if ($this->fireEvent('truncating') === false) {
return false;
}
$this->connection->statement("SET foreign_key_checks=0");
$this->table()->truncate();
$this->connection->statement("SET foreign_key_checks=1");
$this->fireEvent('truncated');
}
示例3: truncate
/**
* Truncate all records
* @return void
*/
public function truncate()
{
if ($this->fireEvent('truncating') === false) {
return false;
}
// This SET statement fails with sqlite
try {
$this->connection->statement("SET foreign_key_checks=0");
} catch (Exception $e) {
// do nothing
}
$this->table()->truncate();
try {
$this->connection->statement("SET foreign_key_checks=1");
} catch (Exception $e) {
// do nothing
}
$this->fireEvent('truncated');
}