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


PHP Zend_Db_Table_Abstract::getDefaultMetadataCache方法代码示例

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


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

示例1: testTableSetDefaultMetadataCacheRegistry

 public function testTableSetDefaultMetadataCacheRegistry()
 {
     $cache = $this->_getCache();
     Zend_Registry::set('registered_metadata_cache', $cache);
     Zend_Db_Table_Abstract::setDefaultMetadataCache('registered_metadata_cache');
     $this->assertSame($cache, Zend_Db_Table_Abstract::getDefaultMetadataCache());
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:7,代码来源:TestCommon.php

示例2: ini_set

 * @since      File available since Release 6.0
 * @author     David Soria Parra <soria_parra@mayflower.de>
 */
// Force quotes off to run in cruisecontrol
ini_set("magic_quotes_gpc", 0);
ini_set("magic_quotes_runtime", 0);
ini_set("magic_quotes_sybase", 0);
/* use command line switches to overwrite this */
define("DEFAULT_CONFIG_FILE", "configuration.php");
define("PHPR_CONFIG_FILE", "configuration.php");
define("DEFAULT_CONFIG_SECTION", "testing-mysql");
define("PHPR_CONFIG_SECTION", "testing-mysql");
define('PHPR_ROOT_PATH', realpath(dirname(__FILE__) . '/../../'));
require_once PHPR_ROOT_PATH . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . 'Phprojekt.php';
Phprojekt::getInstance();
Zend_Db_Table_Abstract::getDefaultMetadataCache()->clean();
if (!defined('PHPUnit_MAIN_METHOD')) {
    define('PHPUnit_MAIN_METHOD', 'AllTests::main');
}
require_once 'PHPUnit/Framework.php';
require_once 'PHPUnit/TextUI/TestRunner.php';
require_once 'PHPUnit/Util/Filter.php';
require_once 'Default/AllTests.php';
require_once 'Phprojekt/AllTests.php';
require_once 'Timecard/AllTests.php';
require_once 'History/AllTests.php';
require_once 'User/AllTests.php';
require_once 'Calendar/AllTests.php';
require_once 'Note/AllTests.php';
require_once 'Role/AllTests.php';
require_once 'Todo/AllTests.php';
开发者ID:joerch,项目名称:PHProjekt,代码行数:31,代码来源:AllTests.php

示例3: getPanel

 /**
  * Gets content panel for the Debugbar
  *
  * @return string
  */
 public function getPanel()
 {
     if (!$this->_db) {
         return '';
     }
     $html = '<h4>Database queries';
     // @TODO: This is always on?
     if (Zend_Db_Table_Abstract::getDefaultMetadataCache()) {
         $html .= ' – Metadata cache ENABLED';
     } else {
         $html .= ' – Metadata cache DISABLED';
     }
     $html .= '</h4>';
     return $html . $this->getProfile();
 }
开发者ID:spekkionu,项目名称:zfdebug,代码行数:20,代码来源:Database.php

示例4: getPanel

 /**
  * Gets content panel for the Debugbar
  *
  * @return string
  */
 public function getPanel()
 {
     if (!$this->_db) {
         return '';
     }
     $html = '<h4>Database queries</h4>';
     if (Zend_Db_Table_Abstract::getDefaultMetadataCache()) {
         $html .= 'Metadata cache is ENABLED';
     } else {
         $html .= 'Metadata cache is DISABLED';
     }
     foreach ($this->_db as $name => $adapter) {
         if ($profiles = $adapter->getProfiler()->getQueryProfiles()) {
             $html .= '<h4>Adapter ' . $name . '</h4><ol>';
             foreach ($profiles as $profile) {
                 $html .= '<li><strong>[' . round($profile->getElapsedSecs() * 1000, 2) . ' ms]</strong> ' . htmlspecialchars($profile->getQuery()) . '</li>';
             }
             $html .= '</ol>';
         }
     }
     return $html;
 }
开发者ID:josmel,项目名称:adminwap,代码行数:27,代码来源:Database.php

示例5: getPanel

 /**
  * Gets content panel for the Debugbar
  *
  * @return string
  */
 public function getPanel()
 {
     if (!$this->_db) {
         return '';
     }
     $html = '<h4>Database queries</h4>';
     if (Zend_Db_Table_Abstract::getDefaultMetadataCache()) {
         $html .= 'Metadata cache is ENABLED';
     } else {
         $html .= 'Metadata cache is DISABLED';
     }
     # For adding quotes to query params
     function add_quotes(&$value, $key)
     {
         $value = "'" . $value . "'";
     }
     foreach ($this->_db as $name => $adapter) {
         if ($profiles = $adapter->getProfiler()->getQueryProfiles()) {
             $adapter->getProfiler()->setEnabled(false);
             $html .= '<h4>Adapter ' . $name . '</h4><ol>';
             foreach ($profiles as $profile) {
                 $params = $profile->getQueryParams();
                 array_walk($params, 'add_quotes');
                 $paramCount = count($params);
                 if ($paramCount) {
                     $html .= '<li>' . htmlspecialchars(preg_replace(array_fill(0, $paramCount, '/\\?/'), $params, $profile->getQuery(), 1));
                 } else {
                     $html .= '<li>' . htmlspecialchars($profile->getQuery());
                 }
                 $html .= '<p><strong>Time:</strong> ' . round($profile->getElapsedSecs() * 1000, 2) . ' ms' . $this->getLinebreak();
                 $supportedAdapter = $adapter instanceof Zend_Db_Adapter_Mysqli || $adapter instanceof Zend_Db_Adapter_Pdo_Mysql;
                 # Run explain if enabled, supported adapter and SELECT query
                 if ($this->_explain && $supportedAdapter && Zend_Db_Profiler::SELECT == $profile->getQueryType()) {
                     $explain = $adapter->fetchRow('EXPLAIN ' . $profile->getQuery());
                     $html .= '<strong>Type:</strong> ' . strtolower($explain['select_type']) . ', ' . $explain['type'] . $this->getLinebreak() . '<strong>Possible Keys:</strong> ' . $explain['possible_keys'] . $this->getLinebreak() . '<strong>Key Used:</strong> ' . $explain['key'] . $this->getLinebreak() . '<strong>Rows:</strong> ' . $explain['rows'] . $this->getLinebreak() . '<strong>Extra:</strong> ' . $explain['Extra'];
                 }
                 $html .= '</p></li>';
             }
             $html .= '</ol>';
         }
     }
     return $html;
 }
开发者ID:rockett,项目名称:parables-demo,代码行数:48,代码来源:Database.php

示例6: testTableSetDefaultMetadataCache

 /**
  * Ensures that Zend_Db_Table_Abstract::setDefaultMetadataCache() performs as expected
  *
  * @return void
  */
 public function testTableSetDefaultMetadataCache()
 {
     $cache = $this->_getCache();
     Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);
     $this->assertSame($cache, Zend_Db_Table_Abstract::getDefaultMetadataCache());
     Zend_Db_Table_Abstract::setDefaultMetadataCache();
     $this->assertNull(Zend_Db_Table_Abstract::getDefaultMetadataCache());
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:13,代码来源:TestCommon.php

示例7: getPanel

    /**
     * Gets content panel for the Debugbar
     *
     * @return string
     */
    public function getPanel()
    {
        if (!$this->_db)
            return '';

        $html = '<h4>Requêtes sur la base de données</h4>';
        if (Zend_Db_Table_Abstract::getDefaultMetadataCache ()) {
            $html .= 'Cache de Métadonnées ACTIF';
        } else {
            $html .= 'Cache de Métadonnées INACTIF';
        }

        foreach ($this->_db as $name => $adapter) {
            if ($profiles = $adapter->getProfiler()->getQueryProfiles()) {
                $html .= '<h4>Adaptateur '.$name.'</h4><ol>';
                foreach ($profiles as $profile) {
                    $html .= '<li><strong>['.round($profile->getElapsedSecs()*1000, 2).' ms]</strong> '
                             .htmlspecialchars($profile->getQuery()).'</li>';
                }
                $html .= '</ol>';
            }
        }

        return $html;
    }
开发者ID:njmsns,项目名称:ZENDSERVER,代码行数:30,代码来源:Database.php

示例8: setUp

 public function setUp()
 {
     parent::setUp();
     Phprojekt::getInstance();
     Zend_Db_Table_Abstract::getDefaultMetadataCache()->clean();
 }
开发者ID:RainyBlueSky,项目名称:PHProjekt,代码行数:6,代码来源:DatabaseTest.php

示例9: syncTable

 /**
  * Check the current Fields and make the sync in the table of the module.
  *
  * @param array  $newFields Array with all the data per new field.
  * @param string $tableName Name of the module Table.
  * @param array  $tableData Array with the table data definition per new field.
  *
  * @return boolean True on a sucessful sync.
  */
 public function syncTable($newFields, $tableName, $tableData)
 {
     $systemFields = array('id', 'owner_id', 'project_id');
     $tableManager = new Phprojekt_Table(Phprojekt::getInstance()->getDb());
     // Clean the metadata cache
     if (null !== $this->_model) {
         $info = $this->_model->info();
         $dbConfig = Phprojekt::getInstance()->getDb()->getConfig();
         // Define the cache identifier where the metadata are saved
         $cacheId = md5((isset($dbConfig['options']['port']) ? ':' . $dbConfig['options']['port'] : null) . (isset($dbConfig['options']['host']) ? ':' . $dbConfig['options']['host'] : null) . '/' . $dbConfig['dbname'] . ':' . $info['schema'] . '.' . $info['name']);
         Zend_Db_Table_Abstract::getDefaultMetadataCache()->remove($cacheId);
     }
     $oldFields = $this->getDataDefinition();
     $tableDataForCreate['id'] = array('type' => 'auto_increment', 'length' => 11);
     $tableDataForCreate['owner_id'] = array('type' => 'int', 'length' => 11);
     if (!isset($tableDataForCreate['project_id'])) {
         $tableDataForCreate['project_id'] = array('type' => 'int', 'length' => 11);
     }
     array_merge($tableDataForCreate, $tableData);
     $tableName = strtolower(self::convertTableField($tableName));
     $tableFields = $tableManager->getTableFields($tableName, $tableDataForCreate);
     // Search for Modify and Delete
     $return = true;
     foreach ($oldFields as $oldValues) {
         $found = false;
         foreach ($newFields as $newValues) {
             if ($oldValues['id'] == $newValues['id']) {
                 $newValues['tableField'] = self::convertTableField($newValues['tableField']);
                 $fieldDefinition = $tableData[$newValues['tableField']];
                 $fieldDefinition['name'] = $newValues['tableField'];
                 if (!in_array($fieldDefinition['name'], $systemFields)) {
                     if ($oldValues['tableField'] == $newValues['tableField']) {
                         if (!$tableManager->modifyField($tableName, $fieldDefinition)) {
                             $return = false;
                         }
                     } else {
                         $fieldDefinition['oldName'] = $oldValues['tableField'];
                         if (!$tableManager->changeField($tableName, $fieldDefinition)) {
                             $return = false;
                         }
                     }
                 }
                 $found = true;
                 break;
             }
         }
         if (!$found) {
             $fieldDefinition = array();
             $fieldDefinition['name'] = $oldValues['tableField'];
             if (!in_array($fieldDefinition['name'], $systemFields)) {
                 if (!$tableManager->deleteField($tableName, $fieldDefinition)) {
                     $return = false;
                 }
             }
         }
     }
     // Search for Add
     foreach ($newFields as $newValues) {
         if ($newValues['id'] == 0) {
             $newValues['tableField'] = self::convertTableField($newValues['tableField']);
             $fieldDefinition = $tableData[$newValues['tableField']];
             $fieldDefinition['name'] = $newValues['tableField'];
             if (!in_array($fieldDefinition['name'], $systemFields)) {
                 if (!$tableManager->addField($tableName, $fieldDefinition)) {
                     $return = false;
                 }
             }
         }
     }
     return $return;
 }
开发者ID:victorli,项目名称:PHProjekt,代码行数:80,代码来源:DatabaseManager.php

示例10: install

 public function install()
 {
     parent::install();
     $languageModule = new RM_Languages();
     $languages = $languageModule->fetchAll();
     require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'EmailNotifications.php';
     $model = new RM_EmailNotifications();
     foreach ($languages as $language) {
         if ($language->iso !== 'en_GB') {
             $model->addLanguage($language->iso);
         }
     }
     //Currently we just added extra columns and need to clean cache
     Zend_Db_Table_Abstract::getDefaultMetadataCache()->clean();
     //Copy en_GB default value to all other languages
     $emailNotification = $model->fetchByName('ReservationCompleteSuccessful', RM_EmailNotifications::REGULAR_USER);
     foreach ($languages as $language) {
         $iso = $language->iso;
         if ($iso !== 'en_GB') {
             $emailNotification->{$iso} = $emailNotification->en_GB;
         }
     }
     $emailNotification->save();
 }
开发者ID:laiello,项目名称:resmania,代码行数:24,代码来源:EmailNotifications.php


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