當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ConnectionInterface::exec方法代碼示例

本文整理匯總了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);
             }
         }
     }
 }
開發者ID:bondarovich,項目名稱:Propel2,代碼行數:22,代碼來源:OracleAdapter.php

示例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;
 }
開發者ID:kalaspuffar,項目名稱:php-orm-benchmark,代碼行數:17,代碼來源:ConnectionWrapper.php

示例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));
 }
開發者ID:bondarovich,項目名稱:Propel2,代碼行數:15,代碼來源:PdoAdapter.php

示例4: tearDown

 protected function tearDown()
 {
     parent::tearDown();
     $this->con->exec("SET FOREIGN_KEY_CHECKS = 1;");
     $this->con->rollback();
 }
開發者ID:Alban-io,項目名稱:TheliaStudio,代碼行數:6,代碼來源:RuleGeneratorTest.php

示例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 . "'");
 }
開發者ID:rouffj,項目名稱:Propel2,代碼行數:15,代碼來源:PdoAdapter.php

示例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');
 }
開發者ID:dracony,項目名稱:forked-php-orm-benchmark,代碼行數:12,代碼來源:MysqlAdapter.php

示例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);
     }
 }
開發者ID:spryker,項目名稱:Collector,代碼行數:22,代碼來源:AbstractTouchUpdater.php

示例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");
 }
開發者ID:rouffj,項目名稱:Propel2,代碼行數:12,代碼來源:MysqlAdapter.php


注:本文中的Propel\Runtime\Connection\ConnectionInterface::exec方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。