本文整理匯總了PHP中Propel\Runtime\Connection\ConnectionInterface::exec方法的典型用法代碼示例。如果您正苦於以下問題:PHP ConnectionInterface::exec方法的具體用法?PHP ConnectionInterface::exec怎麽用?PHP ConnectionInterface::exec使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Propel\Runtime\Connection\ConnectionInterface
的用法示例。
在下文中一共展示了ConnectionInterface::exec方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: initConnection
/**
* This method is called after a connection was created to run necessary
* post-initialization queries or code.
* Removes the charset query and adds the date queries
*
* @see parent::initConnection()
*
* @param \PDO $con
* @param array $settings
*/
public function initConnection(ConnectionInterface $con, array $settings)
{
$con->exec("ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD'");
$con->exec("ALTER SESSION SET NLS_TIMESTAMP_FORMAT='YYYY-MM-DD HH24:MI:SS'");
if (isset($settings['queries']) && is_array($settings['queries'])) {
foreach ($settings['queries'] as $queries) {
foreach ((array) $queries as $query) {
$con->exec($query);
}
}
}
}
示例2: exec
/**
* Execute an SQL statement and return the number of affected rows.
* Overrides PDO::exec() to log queries when required
*
* @param string $sql
* @return integer
*/
public function exec($sql)
{
$return = $this->connection->exec($sql);
if ($this->useDebug) {
$this->log($sql);
$this->setLastExecutedQuery($sql);
$this->incrementQueryCount();
}
return $return;
}
示例3: setCharset
/**
* Sets the character encoding using SQL standard SET NAMES statement.
*
* This method is invoked from the default initConnection() method and must
* be overridden for an RDMBS which does _not_ support this SQL standard.
*
* @see initConnection()
*
* @param ConnectionInterface $con
* @param string $charset The $string charset encoding.
*/
public function setCharset(ConnectionInterface $con, $charset)
{
$con->exec(sprintf("SET NAMES '%s'", $charset));
}
示例4: tearDown
protected function tearDown()
{
parent::tearDown();
$this->con->exec("SET FOREIGN_KEY_CHECKS = 1;");
$this->con->rollback();
}
示例5: setCharset
/**
* Sets the character encoding using SQL standard SET NAMES statement.
*
* This method is invoked from the default initConnection() method and must
* be overridden for an RDMBS which does _not_ support this SQL standard.
*
* @see initConnection()
*
* @param Propel\Runtime\Connection\ConnectionInterface $con
* @param string $charset The $string charset encoding.
*/
public function setCharset(ConnectionInterface $con, $charset)
{
$con->exec("SET NAMES '" . $charset . "'");
}
示例6: unlockTable
/**
* Unlocks the specified table.
*
* @param ConnectionInterface $con The Propel connection to use.
* @param string $table The name of the table to unlock.
*
* @throws \PDOException No Statement could be created or executed.
*/
public function unlockTable($con, $table)
{
$con->exec('UNLOCK TABLES');
}
示例7: bulkDelete
/**
* @param \Spryker\Zed\Collector\Business\Exporter\Writer\Storage\TouchUpdaterSet $touchUpdaterSet
* @param int $idLocale
* @param \Propel\Runtime\Connection\ConnectionInterface|null $connection
*
* @return void
*/
public function bulkDelete(TouchUpdaterSet $touchUpdaterSet, $idLocale, ConnectionInterface $connection = null)
{
$idsToDelete = [];
foreach ($touchUpdaterSet->getData() as $key => $touchData) {
$idTouch = $touchData[CollectorConfig::COLLECTOR_TOUCH_ID];
if ($idTouch !== null) {
$idsToDelete[$idTouch] = $idTouch;
}
}
if (!empty($idsToDelete) && $connection !== null) {
$sql = $this->bulkTouchDeleteQuery->addQuery($this->touchKeyTableName, static::FK_TOUCH, $idsToDelete)->getRawSqlString();
$this->bulkTouchDeleteQuery->flushQueries();
$connection->exec($sql);
}
}
示例8: unlockTable
/**
* Unlocks the specified table.
*
* @param ConnectionInterface $con The Propel connection to use.
* @param string $table The name of the table to unlock.
*
* @throws \PDOException No Statement could be created or executed.
*/
public function unlockTable($con, $table)
{
$statement = $con->exec("UNLOCK TABLES");
}