• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Zend_Db_Adapter_Pdo_Abstract类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: show

 public function show()
 {
     $vars = array("name" => $this->name);
     //get data from DB
     $this->parseURLParameters();
     $totalPages = $totalRows = 0;
     $pagingEnabled = $this->pageSize > 0;
     $countSQLInMainSelect = false;
     if ($pagingEnabled) {
         //use direct count if there's no distinct inside of SELECT statement
         //that's 10 times faster than count loaded results
         $countSQLType = $this->countSQLType;
         if (!$countSQLType) {
             if (in_array(get_class($this->db), array('Zend_Db_Adapter_Mysqli', 'Zend_Db_Adapter_Pdo_Mysql'))) {
                 $countSQLType = "SQL_CALC_FOUND_ROWS";
             } elseif (preg_match("/\\s((distinct)|(group by))\\s/i", $this->selectSQL)) {
                 $countSQLType = "subselect";
             } else {
                 $countSQLType = "simple";
             }
         }
         switch ($countSQLType) {
             case 'SQL_CALC_FOUND_ROWS':
                 $countSQL = preg_replace("/(^\\s*)SELECT/smi", '$1SELECT SQL_CALC_FOUND_ROWS ', $this->selectSQL);
                 $countSQLInMainSelect = true;
                 break;
             case 'simple':
                 //SELECT.+\\sFROM is greedy to replace cases with multi selects
                 $countSQL = "SELECT COUNT(*) FROM " . preg_replace("/^\\s*SELECT.+\\sFROM\\s/smi", "", $this->selectSQL);
                 break;
             case 'subselect':
             default:
                 $countSQL = "select count(*) from (" . $this->selectSQL . ") a";
         }
         if (!$countSQLInMainSelect) {
             $totalRows = $this->db->fetchOne($countSQL);
             $totalPages = ceil($totalRows / $this->pageSize);
         } else {
             $totalRows = $this->page * $this->pageSize + 1;
             $totalPages = $this->page + 1;
         }
     }
     $sql = $countSQLInMainSelect ? $countSQL : $this->selectSQL;
     if ($this->sortOrder && array_key_exists($this->sortOrder, $this->sortOrders)) {
         if (is_array($this->sortOrders[$this->sortOrder])) {
             $sql .= " ORDER BY " . $this->sortOrders[$this->sortOrder][$this->sortDirection == "ASC" ? 0 : 1];
         } else {
             $sql .= " ORDER BY " . $this->sortOrders[$this->sortOrder] . ($this->sortDirection == "ASC" ? "" : " DESC");
         }
     } elseif ($this->defaultSortOrder) {
         $sql .= " ORDER BY " . $this->defaultSortOrder;
     }
     if ($totalPages == 0) {
         $this->page = 1;
     } elseif ($this->page > $totalPages) {
         $this->page = $totalPages;
     }
     if ($pagingEnabled) {
         $sql .= " LIMIT " . ($this->page - 1) * $this->pageSize . ", " . $this->pageSize;
     }
     $vars["rows"] = $this->db->fetchAll($sql);
     if (!$pagingEnabled) {
         $totalRows = count($vars["rows"]);
         $totalPages = ceil($totalRows / $this->pageSize);
     } elseif ($countSQLInMainSelect) {
         $totalRows = $this->db->fetchOne("SELECT  FOUND_ROWS()");
         $totalPages = ceil($totalRows / $this->pageSize);
     }
     $vars["totalRows"] = $totalRows;
     $vars["totalPages"] = $totalPages;
     //set URI for subcomponents(navigator, sorter)
     $params = $this->request->getParams();
     //remove empty variables
     foreach ($params as $name => $value) {
         if (empty($value) && $value !== "0") {
             unset($params[$name]);
         }
     }
     $params['controller'] = $this->request->getControllerName();
     $params['action'] = $this->request->getActionName();
     if (array_key_exists($this->name . 'Page', $params)) {
         unset($params[$this->name . 'Page']);
     }
     $vars["pagerURI"] = $this->actionController->getHelper('Url')->url($params, null, true) . '/';
     //remove sorter parameters
     if (array_key_exists($this->name . 'Order', $params)) {
         unset($params[$this->name . 'Order']);
     }
     if (array_key_exists($this->name . 'Dir', $params)) {
         unset($params[$this->name . 'Dir']);
     }
     $vars["sorterURI"] = $this->actionController->getHelper('Url')->url($params, null, true) . '/';
     $vars["page"] = $this->page;
     $vars["pageSize"] = $this->pageSize;
     $vars["sortOrder"] = $this->sortOrder;
     $vars["sortDirection"] = $this->sortDirection;
     $this->view->{$this->name} = $vars;
 }
开发者ID:pansot2,项目名称:PadCMS-backend,代码行数:98,代码来源:Grid.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Zend_Db_Adapter_Pdo_Mysql类代码示例发布时间:2022-05-23
下一篇:
PHP Zend_Db_Adapter_Abstract类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap