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


PHP Zend_Db_Adapter_Pdo_Abstract類代碼示例

本文整理匯總了PHP中Zend_Db_Adapter_Pdo_Abstract的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Db_Adapter_Pdo_Abstract類的具體用法?PHP Zend_Db_Adapter_Pdo_Abstract怎麽用?PHP Zend_Db_Adapter_Pdo_Abstract使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Zend_Db_Adapter_Pdo_Abstract類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testInsert

 function testInsert()
 {
     $row = array('title' => 'News Item 3', 'subTitle' => 'Sub title 3', 'body' => 'This is body 1', 'date_created' => '2006-05-03 13:13:13');
     $rows_affected = $this->_db->insert(self::TableName, $row);
     $last_insert_id = $this->_db->lastInsertId();
     $this->assertEquals('3', (string) $last_insert_id);
     // correct id has been set
 }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:8,代碼來源:Common.php

示例2: _connect

 /**
  * @return void
  */
 protected function _connect()
 {
     if ($this->_connection) {
         return;
     }
     parent::_connect();
     $this->_connection->exec('SET QUOTED_IDENTIFIER ON');
 }
開發者ID:BackupTheBerlios,項目名稱:ajnet,代碼行數:11,代碼來源:Mssql.php

示例3: _exec

 /**
  * 執行SQL語句
  * 
  * @param string|Zend_Db_Select $sql
  * @param boolean $commit
  * @return integer
  */
 protected function _exec($sql, $commit = true)
 {
     $affected = $this->_db->exec($sql);
     if ($commit) {
         $this->_db->exec('COMMIT');
     }
     return $affected;
 }
開發者ID:starflash,項目名稱:ZtChart-ZF1-Example,代碼行數:15,代碼來源:Abstract.php

示例4: __construct

 /**
  * Constructor.
  *
  * $config is an array of key/value pairs containing configuration
  * options.  Note that the SQLite options are different than most of
  * the other PDO adapters in that no username or password are needed.
  * Also, an extra config key "sqlite2" specifies compatibility mode.
  *
  * dbname    => (string) The name of the database to user (required,
  *                       use :memory: for memory-based database)
  *
  * sqlite2   => (boolean) PDO_SQLITE defaults to SQLite 3.  For compatibility
  *                        with an older SQLite 2 database, set this to TRUE.
  *
  * @param array $config An array of configuration keys.
  */
 public function __construct($config)
 {
     if (isset($config['sqlite2']) && $config['sqlite2']) {
         $this->_pdoType = 'sqlite2';
     }
     // SQLite uses no username/password.  Stub to satisfy parent::_connect()
     $this->_config['username'] = null;
     $this->_config['password'] = null;
     return parent::__construct($config);
 }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:26,代碼來源:Sqlite.php

示例5: _connect

 /**
  * Creates a PDO object and connects to the database.
  *
  * @return void
  * @throws Zend_Db_Adapter_Exception
  */
 protected function _connect()
 {
     if ($this->_connection) {
         return;
     }
     parent::_connect();
     if (!empty($this->_config['charset'])) {
         $sql = "SET NAMES '" . $this->_config['charset'] . "'";
         $this->_connection->exec($sql);
     }
 }
開發者ID:H38uS,項目名稱:Impulsion,代碼行數:17,代碼來源:Pgsql.php

示例6: delete

 public function delete()
 {
     try {
         $this->db->delete($this->tableName, $this->primaryKeyName . " = " . $this->db->quote($this->primaryKeyValue));
         $this->primaryKeyValue = null;
     } catch (Zend_Db_Exception $e) {
         $this->errors[] = $this->localizer->translate("Database Error: %1\$s", $e->getMessage());
         return false;
     }
     return "delete";
 }
開發者ID:pansot2,項目名稱:PadCMS-backend,代碼行數:11,代碼來源:Database.php

示例7: _connect

 /**
  * Creates a PDO object and connects to the database.
  *
  * @return void
  * @throws Zend_Db_Adapter_Exception
  */
 protected function _connect()
 {
     if ($this->_connection) {
         return;
     }
     if (!empty($this->_config['charset'])) {
         $initCommand = "SET NAMES '" . $this->_config['charset'] . "'";
         $this->_config['driver_options'][PDO::MYSQL_ATTR_INIT_COMMAND] = $initCommand;
     }
     parent::_connect();
 }
開發者ID:H38uS,項目名稱:Impulsion,代碼行數:17,代碼來源:Mysql.php

示例8: _connect

 /**
  * Creates a PDO object and connects to the database.
  *
  * @return void
  * @throws Zend_Db_Adapter_Exception
  */
 protected function _connect()
 {
     if ($this->_connection) {
         return;
     }
     if (!empty($this->_config['charset']) && version_compare(PHP_VERSION, '5.3.6', '<')) {
         $initCommand = "SET NAMES '" . $this->_config['charset'] . "'";
         $this->_config['driver_options'][1002] = $initCommand;
         // 1002 = PDO::MYSQL_ATTR_INIT_COMMAND
     }
     parent::_connect();
 }
開發者ID:janpolsen,項目名稱:zend-db,代碼行數:18,代碼來源:Mysql.php

示例9: _connect

 /**
  * Creates a PDO object and connects to the database.
  *
  * @return void
  * @throws Zend_Db_Adapter_Exception
  */
 protected function _connect()
 {
     if ($this->_connection) {
         return;
     }
     parent::_connect();
     /**
              * Mantis #0009452 - This feature was disable for making possible to enable transaction pooling
             if (!empty($this->_config['charset'])) {
                 $sql = "SET NAMES '" . $this->_config['charset'] . "'";
                 $this->_connection->exec($sql);
             }
             **/
 }
開發者ID:bitExpert,項目名稱:Tine-2.0-Open-Source-Groupware-and-CRM,代碼行數:20,代碼來源:Pgsql.php

示例10: insert

 /**
  * Inserts a table row with specified data.
  * Special handling for PDO_IBM
  * remove empty slots
  *
  * @param mixed $table The table to insert data into.
  * @param array $bind Column-value pairs.
  * @return int The number of affected rows.
  */
 public function insert($table, array $bind)
 {
     $this->_connect();
     $newbind = array();
     if (is_array($bind)) {
         foreach ($bind as $name => $value) {
             if ($value !== null) {
                 $newbind[$name] = $value;
             }
         }
     }
     return parent::insert($table, $newbind);
 }
開發者ID:mehulsbhatt,項目名稱:hashmark,代碼行數:22,代碼來源:Ibm.php

示例11: _connect

 /**
  * Special configuration for SQLite behavior: make sure that result sets
  * contain keys like 'column' instead of 'table.column'.
  *
  * @throws Zend_Db_Adapter_Exception
  */
 protected function _connect()
 {
     /**
      * if we already have a PDO object, no need to re-connect.
      */
     if ($this->_connection) {
         return;
     }
     parent::_connect();
     $retval = $this->_connection->exec('PRAGMA full_column_names=0');
     if ($retval === false) {
         $error = $this->_connection->errorInfo();
         /** @see Zend_Db_Adapter_Exception */
         require_once 'Zend/Db/Adapter/Exception.php';
         throw new Zend_Db_Adapter_Exception($error[2]);
     }
     $retval = $this->_connection->exec('PRAGMA short_column_names=1');
     if ($retval === false) {
         $error = $this->_connection->errorInfo();
         /** @see Zend_Db_Adapter_Exception */
         require_once 'Zend/Db/Adapter/Exception.php';
         throw new Zend_Db_Adapter_Exception($error[2]);
     }
 }
開發者ID:Sywooch,項目名稱:forums,代碼行數:30,代碼來源:Sqlite.php

示例12: listTables

 /**
  * Return a list of all existing database tables
  *
  * @return  array
  */
 public function listTables()
 {
     $this->assertConnectedToDb();
     return $this->zendConn->listTables();
 }
開發者ID:xert,項目名稱:icingaweb2,代碼行數:10,代碼來源:DbTool.php

示例13: insert

 /**
  *  Inserts a table row with specified data.
  *	Special handling for PDO_IBM
  * remove empty slots
  *
  * @param mixed $table The table to insert data into.
  * @param array $bind Column-value pairs.
  * @return int The number of affected rows.
  */
 public function insert($table, array $bind)
 {
     $newbind = array();
     if (is_array($bind)) {
         foreach ($bind as $name => $value) {
             if (!is_null($value)) {
                 $newbind[$name] = $value;
             }
         }
     }
     return parent::insert($table, $newbind);
 }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:21,代碼來源:Ibm.php

示例14: _quote

 /**
  * Quote a raw string.
  *
  * @param string $value     Raw string
  * @return string           Quoted string
  */
 protected function _quote($value)
 {
     if (!is_int($value) && !is_float($value)) {
         // Fix for null-byte injection
         $value = addcslashes($value, "");
     }
     return parent::_quote($value);
 }
開發者ID:0svald,項目名稱:icingaweb2,代碼行數:14,代碼來源:Sqlite.php

示例15: _rollBack

 public function _rollBack()
 {
     parent::_rollBack();
     /**
      * Auto-Commit must be tunerd on again after ending a transation.
      * This is the default behavior.
      */
     $this->getConnection()->setAttribute(PDO::ATTR_AUTOCOMMIT, 1);
 }
開發者ID:alexmontoanelli,項目名稱:zend-db-adapter-pdo-firebird,代碼行數:9,代碼來源:Firebird.php


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