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


PHP DbHelper::getTableColumns方法代码示例

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


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

示例1: test_shouldBeAbleToUninstallConfigTable

 /**
  * @expectedException \Zend_Db_Statement_Exception
  * @expectedExceptionMessage custom_dimensions
  */
 public function test_shouldBeAbleToUninstallConfigTable()
 {
     $this->config->uninstall();
     try {
         DbHelper::getTableColumns($this->tableName);
         // doesn't work anymore as table was removed
     } catch (Zend_Db_Statement_Exception $e) {
         $this->config->install();
         throw $e;
     }
     $this->config->install();
 }
开发者ID:ep123,项目名称:plugin-CustomDimensions,代码行数:16,代码来源:ConfigurationTest.php

示例2: getAllVersions

 public static function getAllVersions()
 {
     // to avoid having to load all dimensions on each request we check if there were any changes on the file system
     // can easily save > 100ms for each request
     $cachedTimes = self::getCachedDimensionFileChanges();
     $currentTimes = self::getCurrentDimensionFileChanges();
     $diff = array_diff_assoc($currentTimes, $cachedTimes);
     if (empty($diff)) {
         return array();
     }
     $versions = array();
     $visitColumns = DbHelper::getTableColumns(Common::prefixTable('log_visit'));
     $actionColumns = DbHelper::getTableColumns(Common::prefixTable('log_link_visit_action'));
     $conversionColumns = DbHelper::getTableColumns(Common::prefixTable('log_conversion'));
     foreach (self::getVisitDimensions() as $dimension) {
         $versions = self::mixinVersions($dimension, 'log_visit.', $visitColumns, $versions);
     }
     foreach (self::getActionDimensions() as $dimension) {
         $versions = self::mixinVersions($dimension, 'log_link_visit_action.', $actionColumns, $versions);
     }
     foreach (self::getConversionDimensions() as $dimension) {
         $versions = self::mixinVersions($dimension, 'log_conversion.', $conversionColumns, $versions);
     }
     return $versions;
 }
开发者ID:TensorWrenchOSS,项目名称:piwik,代码行数:25,代码来源:Updater.php

示例3: getColumnName

 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @param string $type
  * @return array
  * @throws \RuntimeException
  */
 protected function getColumnName(InputInterface $input, OutputInterface $output, $type)
 {
     $validate = function ($columnName) use($type) {
         if (empty($columnName)) {
             throw new \InvalidArgumentException('Please enter the name of the dimension column');
         }
         if (preg_match("/[^A-Za-z0-9_ ]/", $columnName)) {
             throw new \InvalidArgumentException('Only alpha numerical characters, underscores and whitespaces are allowed');
         }
         if ('visit' == $type) {
             $columns = array_keys(DbHelper::getTableColumns(Common::prefixTable('log_visit')));
         } elseif ('action' == $type) {
             $columns = array_keys(DbHelper::getTableColumns(Common::prefixTable('log_link_visit_action')));
         } elseif ('conversion' == $type) {
             $columns = array_keys(DbHelper::getTableColumns(Common::prefixTable('log_conversion')));
         } else {
             $columns = array();
         }
         foreach ($columns as $column) {
             if (strtolower($column) === strtolower($columnName)) {
                 throw new \InvalidArgumentException('This column name is already in use.');
             }
         }
         return $columnName;
     };
     $columnName = $input->getOption('columnname');
     if (empty($columnName)) {
         $dialog = $this->getHelperSet()->get('dialog');
         $columnName = $dialog->askAndValidate($output, 'Enter the name of the column under which it should be stored in the MySQL database, for instance "visit_total_time": ', $validate);
     } else {
         $validate($columnName);
     }
     return $columnName;
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:41,代码来源:GenerateDimension.php

示例4: getActuallyExistingColumns

 /**
  * @param string $tableName
  * @return array  An array of actually existing column names in the given table. eg array('idvist', 'server_time', ...)
  */
 private static function getActuallyExistingColumns($tableName)
 {
     $tableName = Common::prefixTable($tableName);
     return array_keys(DbHelper::getTableColumns($tableName));
 }
开发者ID:piwik,项目名称:piwik,代码行数:9,代码来源:2.14.2.php

示例5: test_uninstall_shouldInstallColumn_LogVisit_LastIdlinkVa

 public function test_uninstall_shouldInstallColumn_LogVisit_LastIdlinkVa()
 {
     $this->logVisit->uninstall();
     $columnn = DbHelper::getTableColumns(Common::prefixTable('log_visit'));
     $this->assertArrayNotHasKey('last_idlink_va', $columnn);
 }
开发者ID:ep123,项目名称:plugin-CustomDimensions,代码行数:6,代码来源:LogTableTest.php

示例6: getAllVersions

 public function getAllVersions(PiwikUpdater $updater)
 {
     // to avoid having to load all dimensions on each request we check if there were any changes on the file system
     // can easily save > 100ms for each request
     $cachedTimes = self::getCachedDimensionFileChanges();
     $currentTimes = self::getCurrentDimensionFileChanges();
     $diff = array_diff_assoc($currentTimes, $cachedTimes);
     if (empty($diff)) {
         return array();
     }
     $versions = array();
     $visitColumns = DbHelper::getTableColumns(Common::prefixTable('log_visit'));
     $actionColumns = DbHelper::getTableColumns(Common::prefixTable('log_link_visit_action'));
     $conversionColumns = DbHelper::getTableColumns(Common::prefixTable('log_conversion'));
     foreach ($this->visitDimensions as $dimension) {
         $versions = $this->mixinVersions($updater, $dimension, VisitDimension::INSTALLER_PREFIX, $visitColumns, $versions);
     }
     foreach ($this->actionDimensions as $dimension) {
         $versions = $this->mixinVersions($updater, $dimension, ActionDimension::INSTALLER_PREFIX, $actionColumns, $versions);
     }
     foreach ($this->conversionDimensions as $dimension) {
         $versions = $this->mixinVersions($updater, $dimension, ConversionDimension::INSTALLER_PREFIX, $conversionColumns, $versions);
     }
     return $versions;
 }
开发者ID:CaptainSharf,项目名称:SSAD_Project,代码行数:25,代码来源:Updater.php

示例7: hasColumn

 private function hasColumn($field)
 {
     $columns = DbHelper::getTableColumns($this->table);
     return array_key_exists($field, $columns);
 }
开发者ID:ep123,项目名称:plugin-CustomDimensions,代码行数:5,代码来源:LogTable.php


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