当前位置: 首页>>代码示例>>PHP>>正文


PHP Connection::executeUpdate方法代码示例

本文整理汇总了PHP中Connection::executeUpdate方法的典型用法代码示例。如果您正苦于以下问题:PHP Connection::executeUpdate方法的具体用法?PHP Connection::executeUpdate怎么用?PHP Connection::executeUpdate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Connection的用法示例。


在下文中一共展示了Connection::executeUpdate方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: executeUpdate

 /**
  * @see Connection::executeUpdate()
  */
 public function executeUpdate($sql)
 {
     $this->log("executeUpdate(): {$sql}");
     $this->lastExecutedQuery = $sql;
     $this->numQueriesExecuted++;
     return $this->childConnection->executeUpdate($sql);
 }
开发者ID:rodrigoprestesmachado,项目名称:whiteboard,代码行数:10,代码来源:DebugConnection.php

示例2: executeUpdate

 /**
  * Executes the SQL INSERT, UPDATE, or DELETE statement in this PreparedStatement object.
  * 
  * @param string $sql This method may optionally be called with the SQL statement.
  * @return int Number of affected rows (or 0 for drivers that return nothing).
  * @throws SQLException if a database access error occurs.
  */
 public function executeUpdate($sql)
 {
     if ($this->resultSet) {
         $this->resultSet->close();
     }
     $this->resultSet = null;
     $this->updateCount = $this->conn->executeUpdate($sql);
     return $this->updateCount;
 }
开发者ID:Daniel-Marynicz,项目名称:symfony1-legacy,代码行数:16,代码来源:StatementCommon.php

示例3: tearDown

 public function tearDown()
 {
     ActiveRecordModel::rollback();
     foreach ($this->getUsedSchemas() as $table) {
         ActiveRecord::removeClassFromPool($table);
         $this->db->executeUpdate("ALTER TABLE {$table} AUTO_INCREMENT=" . $this->autoincrements[$table]);
     }
     self::getApplication()->setRequest(clone $this->originalRequest);
 }
开发者ID:saiber,项目名称:livecart,代码行数:9,代码来源:UnitTest.php

示例4: executeUpdate

 /**
  * @see Connection::executeUpdate()
  */
 public function executeUpdate($sql)
 {
     $this->lastExecutedQuery = $sql;
     $this->numQueriesExecuted++;
     $startTime = microtime(true);
     $res = $this->childConnection->executeUpdate($sql);
     $endTime = microtime(true);
     $time = $endTime - $startTime;
     $this->log("executeUpdate|{$time}|{$sql}");
     return $res;
 }
开发者ID:rrsc,项目名称:processmaker,代码行数:14,代码来源:DebugConnection.php

示例5: executeUpdate

 /**
  * Executes the SQL INSERT, UPDATE, or DELETE statement in this PreparedStatement object.
  * 
  * @param array $params Parameters that will be set using PreparedStatement::set() before query is executed.
  * @return int Number of affected rows (or 0 for drivers that return nothing).
  * @throws SQLException if a database access error occurs.
  */
 public function executeUpdate($params = null)
 {
     foreach ((array) $params as $i => $param) {
         $this->set($i + 1, $param);
         unset($i, $param);
     }
     unset($params);
     if ($this->resultSet) {
         $this->resultSet->close();
     }
     $this->resultSet = null;
     // reset
     $sql = $this->replaceParams();
     $this->updateCount = $this->conn->executeUpdate($sql);
     return $this->updateCount;
 }
开发者ID:Daniel-Marynicz,项目名称:symfony1-legacy,代码行数:23,代码来源:PreparedStatementCommon.php

示例6: executeUpdate

 /**
  * Executes the SQL INSERT, UPDATE, or DELETE statement in this PreparedStatement object.
  * 
  * @param array $params Parameters that will be set using PreparedStatement::set() before query is executed.
  * @return int Number of affected rows (or 0 for drivers that return nothing).
  * @throws SQLException if a database access error occurs.
  */
 public function executeUpdate($params = null)
 {
     if ($params) {
         for ($i = 0, $cnt = count($params); $i < $cnt; $i++) {
             $this->set($i + 1, $params[$i]);
         }
     }
     if ($this->resultSet) {
         $this->resultSet->close();
     }
     $this->resultSet = null;
     // reset
     $sql = $this->replaceParams();
     $this->updateCount = $this->conn->executeUpdate($sql);
     return $this->updateCount;
 }
开发者ID:BackupTheBerlios,项目名称:medick-svn,代码行数:23,代码来源:PreparedStatementCommon.php

示例7: executeUpdate

 /**
  * @see Connection::executeUpdate()
  **/
 public function executeUpdate($sql)
 {
     $this->lastExecutedQuery = $sql;
     $this->numQueriesExecuted++;
     $boolLog = sfConfig::get('sf_debug') && sfConfig::get('sf_logging_enabled') || nyProfiler::getInstance()->isStarted();
     $elapsedTime = 0;
     if ($boolLog) {
         $sqlTimer = sfTimerManager::getTimer('Database');
         $timer = new sfTimer();
     }
     // endif
     $intResult = $this->childConnection->executeUpdate($sql);
     if ($boolLog) {
         $sqlTimer->addTime();
         $elapsedTime = $timer->getElapsedTime();
     }
     // endif
     $this->log(sprintf("{sfCreole} executeUpdate(): [%.2f ms] %s", $elapsedTime * 1000, $sql), true);
     return $intResult;
 }
开发者ID:Daniel-Marynicz,项目名称:symfony1-legacy,代码行数:23,代码来源:sfDebugConnection.php

示例8: testRollback

 public function testRollback()
 {
     $exch = DriverTestManager::getExchange('RecordCount');
     $count_sql = $exch->getSql();
     $rs = $this->conn->executeQuery($count_sql, ResultSet::FETCHMODE_NUM);
     $rs->next();
     $total = $rs->getInt(1);
     // $this->assertEquals((int) $exch->getResult(), $total);
     $this->conn->setAutoCommit(false);
     // not sure exactly how to test this yet ...
     $exch = DriverTestManager::getExchange('ConnectionTest.setAutoCommit.DELTRAN1');
     $deleted1 = $this->conn->executeUpdate($exch->getSql());
     $exch = DriverTestManager::getExchange('ConnectionTest.setAutoCommit.DELTRAN2');
     $deleted2 = $this->conn->executeUpdate($exch->getSql());
     $this->conn->rollback();
     // compare the actual total w/ what we expect
     $rs = $this->conn->executeQuery($count_sql, ResultSet::FETCHMODE_NUM);
     $rs->next();
     $new_actual_total = $rs->getInt(1);
     $this->assertEquals($total, $new_actual_total, 0, "Failed to find correct (same) num of records in table after rollback().");
     $this->conn->setAutoCommit(true);
 }
开发者ID:BackupTheBerlios,项目名称:php5cms-svn,代码行数:22,代码来源:ConnectionTest.php


注:本文中的Connection::executeUpdate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。