本文整理汇总了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();
}
示例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;
}
示例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;
}
示例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));
}
示例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);
}
示例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;
}
示例7: hasColumn
private function hasColumn($field)
{
$columns = DbHelper::getTableColumns($this->table);
return array_key_exists($field, $columns);
}