本文整理汇总了PHP中CM_Db_Db::existsColumn方法的典型用法代码示例。如果您正苦于以下问题:PHP CM_Db_Db::existsColumn方法的具体用法?PHP CM_Db_Db::existsColumn怎么用?PHP CM_Db_Db::existsColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CM_Db_Db
的用法示例。
在下文中一共展示了CM_Db_Db::existsColumn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testExistsColumn
public function testExistsColumn()
{
$this->assertSame(true, CM_Db_Db::existsColumn('test', 'foo'));
$this->assertSame(false, CM_Db_Db::existsColumn('test', 'test'));
}
示例2: int
<?php
if (CM_Db_Db::existsColumn('cm_stream_publish', 'userId')) {
CM_Db_Db::exec('ALTER TABLE `cm_stream_publish` MODIFY `userId` int(10) unsigned DEFAULT NULL');
}
示例3: char
<?php
if (!CM_Db_Db::existsColumn('cm_locationState', 'abbreviation')) {
CM_Db_Db::exec('ALTER TABLE `cm_locationState` ADD `abbreviation` char(2) AFTER `name`');
}
CM_Model_Location::createUSStatesAbbreviation();
示例4: int
<?php
if (CM_Db_Db::existsTable('cm_model_location_city_ip') && !CM_Db_Db::existsTable('cm_model_location_ip')) {
CM_Db_Db::exec('RENAME TABLE `cm_model_location_city_ip` TO `cm_model_location_ip`');
}
if (CM_Db_Db::existsTable('cm_model_location_ip')) {
if (CM_Db_Db::existsIndex('cm_model_location_ip', 'cityId')) {
CM_Db_Db::exec('DROP INDEX `cityId` ON `cm_model_location_ip`');
}
if (CM_Db_Db::existsColumn('cm_model_location_ip', 'cityId') && !CM_Db_Db::existsColumn('cm_model_location_ip', 'id')) {
CM_Db_Db::exec('ALTER TABLE `cm_model_location_ip` CHANGE COLUMN `cityId` `id` int(10) unsigned NOT NULL ');
}
if (!CM_Db_Db::existsColumn('cm_model_location_ip', 'level')) {
CM_Db_Db::exec('ALTER TABLE `cm_model_location_ip` ADD COLUMN `level` int(10) unsigned NOT NULL AFTER `id`');
}
if (CM_Db_Db::existsColumn('cm_model_location_ip', 'level')) {
CM_Db_Db::update('cm_model_location_ip', array('level' => CM_Model_Location::LEVEL_CITY), array('level' => 0));
}
if (CM_Db_Db::existsTable('cm_model_location_country_ip')) {
$result = CM_Db_Db::select('cm_model_location_country_ip', array('countryId', 'ipStart', 'ipEnd'));
foreach ($result->fetchAll() as $row) {
CM_Db_Db::insert('cm_model_location_ip', array('id' => $row['countryId'], 'level' => CM_Model_Location::LEVEL_COUNTRY, 'ipStart' => $row['ipStart'], 'ipEnd' => $row['ipEnd']));
}
CM_Db_Db::exec('DROP TABLE `cm_model_location_country_ip`');
}
}
示例5: int
<?php
if (CM_Db_Db::existsIndex('cm_svm', 'trainingChanges')) {
CM_Db_Db::exec('DROP INDEX `trainingChanges` on `cm_svm`');
}
if (CM_Db_Db::existsColumn('cm_svm', 'trainingChanges')) {
CM_Db_Db::exec('
ALTER TABLE `cm_svm`
DROP COLUMN `trainingChanges`,
ADD COLUMN `updateStamp` int(10) unsigned NOT NULL');
CM_Db_Db::update('cm_svm', array('updateStamp' => time()));
}
示例6: VARCHAR
<?php
if (!CM_Db_Db::existsColumn('cm_streamChannelArchive_media', 'key')) {
CM_Db_Db::exec("ALTER TABLE cm_streamChannelArchive_media ADD `key` VARCHAR(64) DEFAULT NULL, ADD INDEX (`key`)");
}
示例7:
<?php
if (!CM_Db_Db::existsColumn('cm_mail', 'customHeaders')) {
CM_Db_Db::exec('
ALTER TABLE `cm_mail` ADD COLUMN `customHeaders` text AFTER `bcc`;');
}
示例8: int
<?php
if (!CM_Db_Db::existsColumn('cm_ipBlocked', 'expirationStamp')) {
CM_Db_Db::exec("ALTER TABLE `cm_ipBlocked`\n ADD `expirationStamp` int(10) unsigned NOT NULL,\n ADD KEY `expirationStamp` (`expirationStamp`);");
}
$config = CM_Config::get();
CM_Db_Db::exec("UPDATE `cm_ipBlocked` SET `expirationStamp` = `createStamp` + " . $config->CM_Paging_Ip_Blocked->maxAge . " WHERE `expirationStamp` = 0");
示例9: array
<?php
if (!CM_Db_Db::existsColumn('cm_languageKey', 'variables')) {
CM_Db_Db::exec("ALTER TABLE `cm_languageKey` ADD `variables` text CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL AFTER name");
}
if (CM_Db_Db::existsTable('cm_languageKey_variable')) {
$results = CM_Db_Db::select('cm_languageKey_variable', '*')->fetchAll();
$variableList = array();
foreach ($results as $result) {
$variableList[$result['languageKeyId']][] = $result['name'];
}
foreach ($variableList as $languageKeyId => $variables) {
CM_Db_Db::update('cm_languageKey', array('variables' => json_encode($variables)), array('id' => $languageKeyId));
}
CM_Db_Db::exec('DROP TABLE `cm_languageKey_variable`');
}
示例10: varchar
<?php
if (CM_Db_Db::existsColumn('cm_cli_command_manager_process', 'hostId')) {
CM_Db_Db::exec('
ALTER TABLE `cm_cli_command_manager_process`
DROP KEY `hostId`,
DROP COLUMN `hostId`,
ADD COLUMN `machineId` varchar(100) NOT NULL AFTER `commandName`,
ADD KEY `machineId` (`machineId`)
');
CM_Db_Db::delete('cm_cli_command_manager_process');
}
示例11: int
<?php
if (!CM_Db_Db::existsTable('cm_model_currency')) {
CM_Db_Db::exec("CREATE TABLE `cm_model_currency` (\n `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n `code` varchar(3) NOT NULL DEFAULT '',\n `abbreviation` varchar(3) NOT NULL DEFAULT '',\n PRIMARY KEY (`id`),\n UNIQUE KEY `code` (`code`),\n UNIQUE KEY `string` (`abbreviation`)\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8;");
}
if (!CM_Db_Db::existsTable('cm_model_currency_country')) {
CM_Db_Db::exec("CREATE TABLE `cm_model_currency_country` (\n `currencyId` int(10) NOT NULL,\n `countryId` int(10) NOT NULL,\n UNIQUE KEY `countryId` (`countryId`)\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8;");
}
if (!CM_Db_Db::existsColumn('cm_user', 'currencyId')) {
CM_Db_Db::exec("ALTER TABLE `cm_user` ADD `currencyId` INT(10) UNSIGNED DEFAULT NULL");
}
示例12:
<?php
if (!CM_Db_Db::existsColumn('cm_streamChannel', 'adapterType')) {
CM_Db_Db::exec('ALTER TABLE `cm_streamChannel` ADD `adapterType` INT NOT NULL');
CM_Db_Db::exec('ALTER TABLE `cm_streamChannel` ADD INDEX `type` (`type`)');
CM_Db_Db::exec('ALTER TABLE `cm_streamChannel` ADD UNIQUE `key-adapterType` (`key`, `adapterType`)');
}
示例13: varchar
<?php
if (!CM_Db_Db::existsColumn('cm_tmp_location', 'nameFull')) {
CM_Db_Db::exec('ALTER TABLE `cm_tmp_location` ADD COLUMN `nameFull` varchar(480) DEFAULT NULL AFTER `name`;');
$searchCli = new CM_Elasticsearch_Index_Cli(null, new CM_OutputStream_Stream_Output());
$searchCli->create('location');
}
示例14: INT
<?php
if (!CM_Db_Db::existsTable('cm_streamchannel_thumbnail')) {
CM_Db_Db::exec("CREATE TABLE `cm_streamchannel_thumbnail` (\n `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,\n `channelId` INT(10) UNSIGNED NOT NULL,\n `createStamp` INT(10) UNSIGNED NOT NULL,\n PRIMARY KEY (`id`),\n KEY `channelId-createStamp` (`channelId`, `createStamp`)\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8;");
}
if (CM_Db_Db::existsColumn('cm_streamChannel_media', 'thumbnailCount')) {
CM_Db_Db::exec("ALTER TABLE cm_streamChannel_media DROP thumbnailCount, DROP `data`");
}
if (CM_Db_Db::existsColumn('cm_streamChannelArchive_media', 'thumbnailCount')) {
CM_Db_Db::exec("ALTER TABLE cm_streamChannelArchive_media DROP thumbnailCount, DROP `data`");
}
示例15: int
<?php
if (!CM_Db_Db::existsColumn('cm_splittest', 'optimized')) {
CM_Db_Db::exec('
ALTER TABLE `cm_splittest` ADD COLUMN `optimized` int(1) unsigned NOT NULL AFTER `name`');
}
if (!CM_Db_Db::existsIndex('cm_splittestVariation_fixture', 'splittestVariationCreateStamp')) {
CM_Db_Db::exec('
ALTER TABLE `cm_splittestVariation_fixture`
ADD INDEX `splittestVariationCreateStamp` (`splittestId`,`variationId`,`createStamp`),
ADD INDEX `splittestVariationConversionStamp` (`splittestId`,`variationId`,`conversionStamp`),
DROP INDEX `splittestId`,
DROP INDEX `createStamp`,
DROP INDEX `conversionStamp`');
}