本文整理汇总了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);
}
}
}
示例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));
}
示例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);
}
示例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;
}
}
}
示例5: getTableNames
/**
* List Tables
*
* @return array
*/
public function getTableNames()
{
return $this->_connection->listTables();
}
示例6: indexAction
public function indexAction()
{
$this->view->tables = $this->_db->listTables();
}
示例7: listTables
/**
* Returns a list of the tables in the database.
*
* @return array
*/
public function listTables()
{
return $this->_adapter->listTables();
}
示例8: getTables
/**
* Retrieve table list
*
* @return array
*/
public function getTables()
{
return $this->_read->listTables();
}
示例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);
}
示例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;
}
}