コード例 #1
0
 function actionDefault()
 {
     // Get the database connections
     $db1 = YDDatabase::getInstance('mysql', 'ydweblog', 'root', '', 'localhost');
     $db2 = YDDatabase::getInstance('oracle', 'creodb_directeur', 'prinergy', 'araxi');
     $db3 = YDDatabase::getInstance('postgres', 'test_db', 'postgres', 'Ster4484', 'localhost');
     $db4 = YDDatabase::getInstance('sqlite', 'db_metadata.db');
     // Get the metadata
     $db1_meta = new YDDatabaseMetaData($db1);
     $db2_meta = new YDDatabaseMetaData($db2);
     $db3_meta = new YDDatabaseMetaData($db3);
     $db4_meta = new YDDatabaseMetaData($db4);
     // Get the list of tables
     YDDebugUtil::dump($db1_meta->getTables(), 'mysql - getTables');
     YDDebugUtil::dump($db2_meta->getTables(), 'oracle - getTables');
     YDDebugUtil::dump($db3_meta->getTables(), 'postgres - getTables');
     YDDebugUtil::dump($db4_meta->getTables(), 'sqlite - getTables');
     // Get the list of fields for a table
     YDDebugUtil::dump($db1_meta->getFields('ydw_items'), 'mysql - getFields');
     YDDebugUtil::dump($db2_meta->getFields('dbcs_jacket'), 'oracle - getFields');
     YDDebugUtil::dump($db3_meta->getFields(), 'postgres - getFields');
     YDDebugUtil::dump($db4_meta->getFields('notes'), 'sqlite - getFields');
     // Get the list of indexes for a table
     YDDebugUtil::dump($db1_meta->getIndexes('ydw_items'), 'mysql - getIndexes');
     YDDebugUtil::dump($db2_meta->getIndexes('dbcs_jacket'), 'oracle - getIndexes');
     YDDebugUtil::dump($db3_meta->getIndexes(), 'postgres - getIndexes');
     YDDebugUtil::dump($db4_meta->getIndexes('notes'), 'sqlite - getIndexes');
 }
コード例 #2
0
 function YDWeblogAdminRequest($req_admin = false)
 {
     // Initialize the parent
     $this->YDWeblogRequest();
     // Check if we allow caching
     $this->caching = false;
     // Delete the cache
     if (sizeof($_POST) > 0 || YDRequest::getActionName() == 'delete') {
         @$this->clearCache();
     }
     // Change the template directory
     $this->tpl->template_dir = YD_SELF_DIR;
     // Get a link to the database metadata
     $dbmeta = new YDDatabaseMetaData($this->weblog->db);
     // Optimize the tables
     foreach ($dbmeta->getTables() as $table) {
         $this->weblog->db->executeSql('optimize table ' . $table);
     }
     // Check for admin access
     $this->req_admin = $req_admin;
 }