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


PHP MDB2::prepare方法代码示例

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


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

示例1: _PrepareAndExecute

 public function _PrepareAndExecute(ISqlCommand &$sqlCommand, $prepareType)
 {
     $cmd = new Mdb2CommandAdapter($sqlCommand);
     $stmt =& $this->_db->prepare($cmd->GetQuery(), true, $prepareType);
     if (MDB2::isError($stmt)) {
         throw new Exception('Error preparing MDB2 command. Query=%s. Error=%s', $sqlCommand->__toString(), $stmt->getMessage());
     }
     $result =& $stmt->execute($cmd->GetValues());
     if (MDB2::isError($result)) {
         throw new Exception('Error executing MDB2 command. Query=%s. Error=%s', $sqlCommand->__toString(), $stmt->getMessage());
     }
     return new Mdb2Reader($result);
 }
开发者ID:Trideon,项目名称:gigolo,代码行数:13,代码来源:Mdb2Connection.php

示例2: setUpStatements

 /**
  * Set up a cache of prepared statements.
  * @return MDB2_Statement_Common
  */
 protected function setUpStatements()
 {
     $this->db_statements = array();
     $this->db_statements['retrieve_type_val'] = $this->db->prepare("SELECT type,value FROM config_alt WHERE path_hash = ? LIMIT 1", array('text'), array('integer', 'text'));
     $this->db_statements['retrieve_children'] = $this->db->prepare("SELECT name as children  FROM config_alt WHERE parent = ? ", array('text'), array('text'));
     $this->db_statements['retrieve_type_val_children'] = $this->db->prepare("SELECT n.type AS type,n.value AS value, GROUP_CONCAT(c.name SEPARATOR '/') as children FROM config_alt n  LEFT JOIN config_alt c ON " . "c.parent = IF(n.parent = '/', CONCAT('/',n.name), CONCAT(n.parent,'/',n.name)) WHERE n.path_hash = ? GROUP BY type, value LIMIT 1", array('text'), array('integer', 'text', 'text'));
     $this->db_statements['store'] = $this->db->prepare("REPLACE INTO config_alt  (  path_hash, parent , name , type, value) VALUES ( ?,?, ?, ?, ? )", array('text', 'text', 'text', 'integer', 'text'));
     $this->db_statements['destroy'] = $this->db->prepare("DELETE  FROM config_alt WHERE path_hash = ? LIMIT 1", array('text'), MDB2_PREPARE_RESULT);
     foreach ($this->db_statements as $type => $db_stmt) {
         if (PEAR::isError($db_stmt)) {
             unset($this->db_statements[$type]);
         }
     }
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:18,代码来源:I2CE_MagicDataStorageDBAlt.php

示例3: updateMonth

 /**
  * Update month data
  * 
  * @param array $data
  * 
  * @return boolean
  */
 private function updateMonth($data)
 {
     $stmt = $this->_db->prepare("UPDATE `article_months` SET `Months_count` = ? WHERE `Months_year` = ? AND `Months_Number` = ?", array('integer', 'integer', 'integer'), MDB2_PREPARE_MANIP);
     return $affectedRows = $stmt->execute($data);
 }
开发者ID:salamonrafal,项目名称:PHPFramework,代码行数:12,代码来源:com.salamon.content.php


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