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


PHP Zend_Db_Adapter_Abstract::listTables方法代碼示例

本文整理匯總了PHP中Zend_Db_Adapter_Abstract::listTables方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Db_Adapter_Abstract::listTables方法的具體用法?PHP Zend_Db_Adapter_Abstract::listTables怎麽用?PHP Zend_Db_Adapter_Abstract::listTables使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_Db_Adapter_Abstract的用法示例。


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

示例1: __construct

 /**
  * @param null $options
  * @param bool $autoLoad
  */
 public function __construct($options = null, $autoLoad = true)
 {
     $this->_db = Zend_Db_Table::getDefaultAdapter();
     $this->_options = $options;
     if (isset($options['blacklist']) && !isset($options['whitelist'])) {
         if (is_array($options['blacklist'])) {
             $this->_blackList = $options['blacklist'];
         } else {
             $this->_blackList[] = (string) $options['blacklist'];
         }
     } elseif (isset($options['whitelist']) && !empty($options['whitelist'])) {
         if (is_array($options['whitelist'])) {
             $this->_whiteList = $options['whitelist'];
         } else {
             $this->_whiteList[] = (string) $options['whitelist'];
         }
     }
     if ($autoLoad) {
         $tables = $this->_db->listTables();
         foreach ($tables as $table) {
             $scheme = $this->_db->describeTable($table);
             $this->addTable($table, $scheme);
         }
     }
 }
開發者ID:shahmaulik,項目名稱:zfcore,代碼行數:29,代碼來源:Database.php

示例2: getSchemaVersion

 /**
  * Fetch the schema version of the current database
  *
  * @return string
  */
 public final function getSchemaVersion()
 {
     if (!in_array('schema_info', $this->dbAdapter->listTables())) {
         $this->createTable('schema_info', array('primary' => false), array(array('version', 'string')));
         $this->dbAdapter->insert('schema_info', array('version' => '00000000000000'));
         return '00000000000000';
     }
     return $this->dbAdapter->fetchOne($this->dbAdapter->select()->from('schema_info', 'version')->limit(1));
 }
開發者ID:humansky,項目名稱:qframe,代碼行數:14,代碼來源:Adapter.php

示例3: _isTableExists

 /**
  *
  * @param string $tableName
  * @return boolean
  */
 protected final function _isTableExists($tableName)
 {
     if (!self::$_tablesList) {
         self::$_tablesList = array_map('strtolower', $this->_db->listTables());
     }
     return in_array(strtolower($tableName), self::$_tablesList);
 }
開發者ID:Sywooch,項目名稱:forums,代碼行數:12,代碼來源:20150107.php

示例4: loadSchemaFromDb

 public static function loadSchemaFromDb(Zend_Db_Adapter_Abstract $db, Zend_Cache_Core $cache)
 {
     static $tables = array();
     if (empty($tables)) {
         if (!($tables = $cache->load('tables'))) {
             $tables = $db->listTables();
             $cache->save($tables, 'tables');
         }
     }
     foreach ($tables as $table) {
         if (!isset(self::$schema[$table])) {
             if (!($tableStructure = $cache->load('tables_' . $table))) {
                 $tableStructure = $db->describeTable($table);
                 $cache->save($tableStructure, 'tables_' . $table);
             }
             self::$schema[$table] = $tableStructure;
         }
     }
 }
開發者ID:hthetiot,項目名稱:basezf,代碼行數:19,代碼來源:Auto.php

示例5: getTableNames

 /**
  * List Tables
  * 
  * @return array
  */
 public function getTableNames()
 {
     return $this->_connection->listTables();
 }
開發者ID:mtday,項目名稱:timesheet-system,代碼行數:9,代碼來源:Generic.php

示例6: indexAction

 public function indexAction()
 {
     $this->view->tables = $this->_db->listTables();
 }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:4,代碼來源:IndexController.php

示例7: listTables

 /**
  * Returns a list of the tables in the database.
  *
  * @return array
  */
 public function listTables()
 {
     return $this->_adapter->listTables();
 }
開發者ID:cwcw,項目名稱:cms,代碼行數:9,代碼來源:Abstract.php

示例8: getTables

 /**
  * Retrieve table list
  *
  * @return array
  */
 public function getTables()
 {
     return $this->_read->listTables();
 }
開發者ID:ronseigel,項目名稱:agent-ohm,代碼行數:9,代碼來源:Mysql4_Db.php

示例9: testListTables

 /**
  * Test the Adapter's listTables() method.
  * Fetch the list of tables and verify that the test table exists in
  * the list.
  */
 public function testListTables()
 {
     $table = $this->getIdentifier(self::TABLE_NAME);
     $tables = $this->_db->listTables();
     $this->assertContains($table, $tables);
 }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:11,代碼來源:Common.php

示例10: dropTables

/**
 * Drop database tables.
 *
 * @param Zend_Db_Adapter_Abstract $db
 * @param string $dbType
 * @throws Zend_Exception
 */
function dropTables($db, $dbType)
{
    $db->beginTransaction();
    try {
        $tables = $db->listTables();
        foreach ($tables as $table) {
            if ($dbType === 'mysql') {
                $db->query('DROP TABLE IF EXISTS `' . $table . '` CASCADE;');
            } elseif ($dbType === 'pgsql') {
                $db->query('DROP TABLE IF EXISTS "' . $table . '" CASCADE;');
            } elseif ($dbType === 'sqlite' && $table != 'sqlite_sequence') {
                $db->query('DROP TABLE IF EXISTS "' . $table . '";');
            } else {
                continue;
            }
        }
        $db->commit();
    } catch (Zend_Exception $exception) {
        $db->rollBack();
        throw $exception;
    }
}
開發者ID:josephsnyder,項目名稱:Midas,代碼行數:29,代碼來源:DatabaseSetup.php


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