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


PHP Zend_Db_Table_Abstract::getAdapter方法代码示例

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


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

示例1: getDbAdapter

 /**
  * Get configured database adapter
  * 
  * @return Zend_Db_Adapter_Abstract
  */
 public function getDbAdapter()
 {
     if (null === $this->_dbAdapter) {
         if ($this->_dbTable instanceof Zend_Db_Table_Abstract) {
             $this->_dbAdapter = $this->_dbTable->getAdapter();
         } else {
             throw new Engine_ServiceLocator_Exception('Database adapter not configured');
         }
     }
     return $this->_dbAdapter;
 }
开发者ID:febryantosulistyo,项目名称:ClassicSocial,代码行数:16,代码来源:DbTable.php

示例2: isValid

 public function isValid($value)
 {
     $db = $this->_model->getAdapter();
     $where = $db->quoteInto($this->_field . ' = ?', $value);
     if (null !== $this->_where) {
         $where .= " AND {$this->_where}";
     }
     $rows = $this->_model->fetchAll($where);
     if (count($rows)) {
         $this->_messages[] = Axis::translate('core')->__("Record %s already exist", $value);
         return $this->_not;
     }
     $this->_messages[] = Axis::translate('core')->__("Record %s doesn't found", $value);
     return !$this->_not;
 }
开发者ID:baisoo,项目名称:axiscommerce,代码行数:15,代码来源:Exists.php

示例3: analyzeTable

 /**
  * Start analyzer
  *
  * @param Zend_Db_Table_Abstract $table
  *
  * @return array
  */
 public function analyzeTable(Zend_Db_Table_Abstract $table)
 {
     $info = $table->info();
     $info['uniques'] = array();
     unset($info['sequence'], $info['schema'], $info['rowClass'], $info['rowsetClass'], $info['dependentTables'], $info['referenceMap']);
     $adapter = $table->getAdapter();
     foreach ($info['metadata'] as $property => $details) {
         // match php types
         $info['phptypes'][$property] = $this->convertMysqlTypeToPhp($details['DATA_TYPE']);
         // find uniques
         $tmp = $adapter->fetchRow('DESCRIBE `' . $info['name'] . '` `' . $property . '`;');
         if (!empty($tmp['Key']) && $tmp['Key'] != 'MUL') {
             $info['uniques'][$property] = $property;
         }
     }
     // get f-keys
     $result = $adapter->fetchAll('SHOW CREATE TABLE `' . $info['name'] . '`');
     $query = $result[0]['Create Table'];
     $lines = explode("\n", $query);
     $tblinfo = array();
     $keys = array();
     foreach ($lines as $line) {
         preg_match('/^\\s*CONSTRAINT `(\\w+)` FOREIGN KEY \\(`(\\w+)`\\) REFERENCES `(\\w+)` \\(`(\\w+)`\\)/', $line, $tblinfo);
         if (sizeof($tblinfo) > 0) {
             $keys[] = $tmp = array('key' => $tblinfo[1], 'column' => $tblinfo[2], 'fk_table' => $tblinfo[3], 'fk_column' => $tblinfo[4]);
             $this->getDependencyChecker()->isChild($info['name'], $tmp['column'], $tmp['key'], $tmp['fk_table'], $tmp['fk_column']);
         }
     }
     $info['foreign_keys'] = $keys;
     return $info;
 }
开发者ID:redpmorg,项目名称:Zend-Model-Generator,代码行数:38,代码来源:Analyser.php

示例4: setTable

 /**
  * Sets the primary table name and retrieves the table schema.
  *
  * @param Zend_Db_Table_Abstract $adapter
  * @return Zend_Db_Select This Zend_Db_Select object.
  */
 public function setTable(Zend_Db_Table_Abstract $table)
 {
     $this->_adapter = $table->getAdapter();
     $this->_info = $table->info();
     $this->_table = $table;
     return $this;
 }
开发者ID:NerdGZ,项目名称:icingaweb2,代码行数:13,代码来源:Select.php

示例5: unlockTable

 /**
  * unlockTable   
  * @author Thomas Schedler <tsh@massiveart.com>
  * @version 1.0 
  */
 public function unlockTable()
 {
     try {
         $this->objTable->getAdapter()->query('UNLOCK TABLES;');
     } catch (Exception $exc) {
         $this->core->logger->err($exc);
     }
 }
开发者ID:BGCX261,项目名称:zoolu-svn-to-git,代码行数:13,代码来源:nested.set.class.php

示例6: deleteEntry

 /**
  * Delete Entry
  *
  * @param Postr_Model_Entry $entry
  * @return Postr_Model_EntryMapper          Provides a fluent interface
  */
 public function deleteEntry(Postr_Model_Entry $entry)
 {
     $dbAdapter = $this->_entryTable->getAdapter();
     $dbAdapter->beginTransaction();
     $entryRow = $this->_entryTable->find($entry->getId())->current();
     $entryRow->delete();
     $dbAdapter->commit();
     return $this;
 }
开发者ID:bradley-holt,项目名称:postr,代码行数:15,代码来源:EntryMapper.php

示例7: _getWhereStatement

 /**
  * _getWhereStatement
  *
  * @param  mixed $id
  * @return mixed (string/array)
  */
 private function _getWhereStatement($id)
 {
     if (is_numeric($id)) {
         $where = $this->obj->getAdapter()->quoteInto($this->primaryKey[0] . ' = ?', $id);
     } else {
         $id = unserialize($id);
         foreach ($id as $key => $value) {
             $where[] = $this->obj->getAdapter()->quoteInto($key . ' = ?', $value);
         }
     }
     return $where;
 }
开发者ID:lagged,项目名称:zf_crud,代码行数:18,代码来源:Controller.php

示例8: setTable

 /**
  * Set the table object, to re-establish a live connection
  * to the database for a Rowset that has been de-serialized.
  *
  * @param Zend_Db_Table_Abstract $table
  * @return boolean
  * @throws Zend_Db_Table_Row_Exception
  */
 public function setTable(Zend_Db_Table_Abstract $table)
 {
     $this->_table = $table;
     if ($this->_table->getAdapter() == null) {
         $this->_connected = false;
         return false;
     }
     $this->_connected = false;
     // @todo This works only if we have iterated through
     // the result set once to instantiate the rows.
     foreach ($this->_rows as $row) {
         $connected = $row->setTable($table);
         if ($connected == true) {
             $this->_connected = true;
         }
     }
     return $this->_connected;
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:26,代码来源:Abstract.php

示例9: getSelect

 /**
  * Get basic select (select {$fields} from {$table}) and add filters, order and limit info from request
  * @param Zend_Db_Table_Abstract $table
  * @param string|array $fields array of fields or "*" Use as {@see Zend_Db_Select::from()} second params
  * @return Zend_Db_Select
  */
 public function getSelect(Zend_Db_Table_Abstract $table, $fields = "*")
 {
     //create basic selects
     $select = $table->getAdapter()->select()->from($table->info(Zend_Db_Table_Abstract::NAME), $fields);
     $cols = $table->info(Zend_Db_Table::COLS);
     //add filters support
     foreach ((array) $this->getRequest()->getParam('filter') as $value) {
         $field = $value['field'];
         if (in_array($field, $cols)) {
             $filter = System_Controller_Action_Helper_GridFilter_Abstract::factory($value['data']);
             $filter->setField($field);
             $filter->filter($select);
         }
     }
     //add sort
     $sortCol = $this->getRequest()->getParam('sort');
     if (in_array($sortCol, $cols)) {
         $select->order($sortCol . ' ' . $this->_getDirState('dir'));
     }
     //set limit
     $select->limit((int) $this->getRequest()->getParam('limit', 25), (int) $this->getRequest()->getParam('start'));
     return $select;
 }
开发者ID:kandy,项目名称:system,代码行数:29,代码来源:GridFilter.php

示例10: getTableFromString

 public static function getTableFromString($tableName, Zend_Db_Table_Abstract $referenceTable = null)
 {
     if ($referenceTable instanceof Zend_Db_Table_Abstract) {
         $tableDefinition = $referenceTable->getDefinition();
         if ($tableDefinition !== null && $tableDefinition->hasTableConfig($tableName)) {
             return new Zend_Db_Table($tableName, $tableDefinition);
         }
     }
     // assume the tableName is the class name
     if (!class_exists($tableName)) {
         try {
             require_once 'Zend/Loader.php';
             Zend_Loader::loadClass($tableName);
         } catch (Zend_Exception $e) {
             require_once 'Zend/Db/Table/Row/Exception.php';
             throw new Zend_Db_Table_Row_Exception($e->getMessage(), $e->getCode(), $e);
         }
     }
     $options = array();
     if ($referenceTable instanceof Zend_Db_Table_Abstract) {
         $options['db'] = $referenceTable->getAdapter();
     }
     if (isset($tableDefinition) && $tableDefinition !== null) {
         $options[Zend_Db_Table_Abstract::DEFINITION] = $tableDefinition;
     }
     return new $tableName($options);
 }
开发者ID:georgepaul,项目名称:socialstrap,代码行数:27,代码来源:Abstract.php

示例11: getAdapter

 /**
  * The database adapter used by the model.
  *
  * @return \Zend_Db_Adapter_Abstract
  */
 public function getAdapter()
 {
     return $this->_table->getAdapter();
 }
开发者ID:GemsTracker,项目名称:MUtil,代码行数:9,代码来源:TableModel.php


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