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


PHP CM_Db_Db::existsTable方法代码示例

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


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

示例1: 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`');
    }
}
开发者ID:cargomedia,项目名称:cm,代码行数:26,代码来源:30.php

示例2: tinyint

<?php

if (!CM_Db_Db::existsTable('`cm_tmp_location_coordinates`')) {
    CM_Db_Db::exec('CREATE TABLE IF NOT EXISTS `cm_tmp_location_coordinates` (
			`level` tinyint(4) NOT NULL,
			`id` int(10) unsigned NOT NULL,
			`coordinates` point NOT NULL,
			PRIMARY KEY (`level`,`id`),
			SPATIAL KEY `coordinates_spatial` (`coordinates`)
		) ENGINE=MyISAM DEFAULT CHARSET=utf8;');
    CM_Db_Db::exec('INSERT INTO `cm_tmp_location_coordinates` (`level`,`id`,`coordinates`)
		SELECT `level`, `id`, POINT(lat, lon) FROM `cm_tmp_location` WHERE `lat` IS NOT NULL AND `lon` IS NOT NULL');
}
开发者ID:cargomedia,项目名称:cm,代码行数:13,代码来源:10.php

示例3: 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");
}
开发者ID:cargomedia,项目名称:cm,代码行数:11,代码来源:49.php

示例4: foreach

<?php

foreach (array('cm_locationZip' => 'cm_model_location_zip', 'cm_locationCity' => 'cm_model_location_city', 'cm_locationState' => 'cm_model_location_state', 'cm_locationCountry' => 'cm_model_location_country', 'cm_locationCityIp' => 'cm_model_location_city_ip', 'cm_locationCountryIp' => 'cm_model_location_country_ip') as $tableOld => $tableNew) {
    if (CM_Db_Db::existsTable($tableOld)) {
        CM_Db_Db::exec('RENAME TABLE `' . $tableOld . '` TO `' . $tableNew . '`');
    }
}
开发者ID:cargomedia,项目名称:cm,代码行数:7,代码来源:26.php

示例5: testReplaceTable

 public function testReplaceTable()
 {
     $this->assertInstanceOf('CM_Db_Exception', $this->catchException(function () {
         CM_Db_Db::replaceTable('test', 'test_new');
     }));
     CM_Db_Db::exec('CREATE TABLE `test_new` (`id` INT(10) UNSIGNED NOT NULL)');
     CM_Db_Db::insert('test_new', ['id' => 123]);
     CM_Db_Db::replaceTable('test', 'test_new');
     $this->assertSame([['id' => '123']], CM_Db_Db::select('test', '*')->fetchAll());
     $this->assertSame(false, CM_Db_Db::existsTable('test_new'));
 }
开发者ID:cargomedia,项目名称:cm,代码行数:11,代码来源:DbTest.php

示例6:

<?php

if (CM_Db_Db::existsTable('cm_language')) {
    CM_Db_Db::exec('RENAME TABLE cm_language TO cm_model_language');
}
if (CM_Db_Db::existsTable('cm_languageKey')) {
    CM_Db_Db::exec('RENAME TABLE cm_languageKey TO cm_model_languagekey');
}
开发者ID:cargomedia,项目名称:cm,代码行数:8,代码来源:36.php

示例7: 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`");
}
开发者ID:cargomedia,项目名称:cm,代码行数:11,代码来源:62.php

示例8: int

<?php

if (!CM_Db_Db::existsTable('cm_tmp_classType')) {
    CM_Db_Db::exec("\n        CREATE TABLE `cm_tmp_classType` (\n          `type` int(10) unsigned NOT NULL,\n          `className` varchar(255) NOT NULL,\n          PRIMARY KEY (`type`)\n        ) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n    ");
}
开发者ID:cargomedia,项目名称:cm,代码行数:5,代码来源:58.php

示例9: int

<?php

if (!CM_Db_Db::existsTable('cm_requestClientCounter')) {
    CM_Db_Db::exec('
        CREATE TABLE `cm_requestClientCounter` (
          `counter` int(10) unsigned NOT NULL,
          PRIMARY KEY (`counter`)
        ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
    ');
    CM_Db_Db::insert('cm_requestClientCounter', array('counter' => 0));
}
if (CM_Db_Db::existsTable('cm_requestClient')) {
    $highestEntry = (int) CM_Db_Db::select('cm_requestClient', 'id', null, array('id' => 'DESC'))->fetchColumn();
    CM_Db_Db::update('cm_requestClientCounter', array('counter' => $highestEntry));
    CM_Db_Db::exec('DROP TABLE IF EXISTS `cm_requestClient`;');
}
开发者ID:cargomedia,项目名称:cm,代码行数:16,代码来源:37.php

示例10: varchar

<?php

if (!CM_Db_Db::existsTable('cm_cli_command_manager_process')) {
    CM_Db_Db::exec('
        CREATE TABLE `cm_cli_command_manager_process` (
            `commandName` varchar(100) NOT NULL,
            `hostId` int(10) unsigned NOT NULL,
            `processId` int(10) unsigned DEFAULT NULL,
            `timeoutStamp` int(10) unsigned NOT NULL,
            PRIMARY KEY (`commandName`),
            KEY `hostId` (`hostId`),
            KEY `timeoutStamp` (`timeoutStamp`)
        ) ENGINE=MyISAM DEFAULT CHARSET=utf8');
}
开发者ID:cargomedia,项目名称:cm,代码行数:14,代码来源:29.php

示例11: 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`');
}
开发者ID:cargomedia,项目名称:cm,代码行数:16,代码来源:33.php

示例12: int

<?php

if (!CM_Db_Db::existsTable('cm_jobdistribution_delayedqueue')) {
    CM_Db_Db::exec('
        CREATE TABLE `cm_jobdistribution_delayedqueue` (
          `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
          `className` varchar(255) NOT NULL,
          `params` text NOT NULL,
          `executeAt` int(10) unsigned NOT NULL,
          PRIMARY KEY (`id`),
          KEY `executeAt` (`executeAt`)
        ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
    ');
}
if (CM_Db_Db::existsColumn('cm_user_online', 'offlineStamp')) {
    CM_Db_Db::exec('ALTER TABLE `cm_user_online` DROP `offlineStamp`');
}
开发者ID:cargomedia,项目名称:cm,代码行数:17,代码来源:60.php

示例13: VARCHAR

<?php

if (CM_Db_Db::existsTable('cm_streamChannel_video')) {
    CM_Db_Db::exec('RENAME TABLE cm_streamChannel_video TO cm_streamChannel_media');
}
if (CM_Db_Db::existsColumn('cm_streamChannel_media', 'width') && CM_Db_Db::existsColumn('cm_streamChannel_media', 'height')) {
    CM_Db_Db::exec('ALTER TABLE cm_streamChannel_media DROP COLUMN `width`, DROP COLUMN `height`');
}
if (!CM_Db_Db::existsColumn('cm_streamChannel_media', 'data')) {
    CM_Db_Db::exec('ALTER TABLE cm_streamChannel_media ADD COLUMN `data` VARCHAR(255) NOT NULL DEFAULT \'\' ');
}
if (CM_Db_Db::existsTable('cm_streamChannelArchive_video')) {
    CM_Db_Db::exec('RENAME TABLE cm_streamChannelArchive_video TO cm_streamChannelArchive_media');
}
if (CM_Db_Db::existsColumn('cm_streamChannelArchive_media', 'width') && CM_Db_Db::existsColumn('cm_streamChannelArchive_media', 'height')) {
    CM_Db_Db::exec('ALTER TABLE cm_streamChannelArchive_media DROP COLUMN `width`, DROP COLUMN `height`');
}
if (!CM_Db_Db::existsColumn('cm_streamChannelArchive_media', 'data')) {
    CM_Db_Db::exec('ALTER TABLE cm_streamChannelArchive_media ADD COLUMN `data` VARCHAR(255) NOT NULL DEFAULT \'\' ');
}
开发者ID:cargomedia,项目名称:cm,代码行数:20,代码来源:55.php

示例14: testExistsTable

 public function testExistsTable()
 {
     $this->assertSame(true, CM_Db_Db::existsTable('test'));
     $this->assertSame(false, CM_Db_Db::existsTable('foo'));
 }
开发者ID:NicolasSchmutz,项目名称:cm,代码行数:5,代码来源:DbTest.php

示例15: KEY

<?php

if (CM_Db_Db::existsTable('cm_smileySet')) {
    CM_Db_Db::exec('DROP TABLE `cm_smileySet`;');
}
if (!CM_Db_Db::existsIndex('cm_smiley', 'code')) {
    CM_Db_Db::exec('ALTER TABLE `cm_smiley` ADD UNIQUE KEY (`code`);');
}
if (CM_Db_Db::existsColumn('cm_smiley', 'setId')) {
    CM_Db_Db::exec('ALTER TABLE `cm_smiley` DROP `setId`');
}
if (CM_Db_Db::existsTable('cm_smiley')) {
    CM_Db_Db::exec('RENAME TABLE `cm_smiley` TO `cm_emoticon`');
}
if (!CM_Db_Db::existsColumn('cm_emoticon', 'codeAdditional')) {
    CM_Db_Db::exec('ALTER TABLE `cm_emoticon` ADD `codeAdditional` varchar(50) AFTER `code`');
}
开发者ID:cargomedia,项目名称:cm,代码行数:17,代码来源:7.php


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