本文整理汇总了PHP中CM_Db_Db::exec方法的典型用法代码示例。如果您正苦于以下问题:PHP CM_Db_Db::exec方法的具体用法?PHP CM_Db_Db::exec怎么用?PHP CM_Db_Db::exec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CM_Db_Db
的用法示例。
在下文中一共展示了CM_Db_Db::exec方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tearDown
public function tearDown()
{
CM_Db_Db::exec('DROP TABLE `test`');
$paging = new CM_PagingSource_Sql('`num`', 'test');
$paging->enableCache();
$paging->clearCache();
}
示例2: setUpBeforeClass
public static function setUpBeforeClass()
{
$switzerland = CM_Db_Db::insert('cm_model_location_country', array('abbreviation' => 'CH', 'name' => 'Switzerland'));
$germany = CM_Db_Db::insert('cm_model_location_country', array('abbreviation' => 'DE', 'name' => 'Germany'));
$baselStadt = CM_Db_Db::insert('cm_model_location_state', array('countryId' => $switzerland, 'name' => 'Basel-Stadt'));
$zuerich = CM_Db_Db::insert('cm_model_location_state', array('countryId' => $switzerland, 'name' => 'Zürich'));
$basel = CM_Db_Db::insert('cm_model_location_city', array('stateId' => $baselStadt, 'countryId' => $switzerland, 'name' => 'Basel', 'lat' => 47.569535, 'lon' => 7.574063));
$winterthur = CM_Db_Db::insert('cm_model_location_city', array('stateId' => $zuerich, 'countryId' => $switzerland, 'name' => 'Winterthur', 'lat' => 47.502315, 'lon' => 8.724947));
$baselZip = CM_Db_Db::insert('cm_model_location_zip', array('cityId' => $basel, 'name' => '4056', 'lat' => 47.569535, 'lon' => 7.574063));
CM_Db_Db::insert('cm_model_location_zip', array('cityId' => $basel, 'name' => '4057', 'lat' => 47.574155, 'lon' => 7.592993));
$location = CM_Db_Db::exec('SELECT `1`.`id` `1.id`, `1`.`name` `1.name`,
`2`.`id` `2.id`, `2`.`name` `2.name`,
`3`.`id` `3.id`, `3`.`name` `3.name`, `3`.`lat` `3.lat`, `3`.`lon` `3.lon`,
`4`.`id` `4.id`, `4`.`name` `4.name`, `4`.`lat` `4.lat`, `4`.`lon` `4.lon`
FROM `cm_model_location_zip` AS `4`
JOIN `cm_model_location_city` AS `3` ON(`4`.`cityId`=`3`.`id`)
JOIN `cm_model_location_state` AS `2` ON(`3`.`stateId`=`2`.`id`)
JOIN `cm_model_location_country` AS `1` ON(`3`.`countryId`=`1`.`id`)
LIMIT 1')->fetch();
self::$_fields[CM_Model_Location::LEVEL_COUNTRY] = array('id' => (int) $location['1.id'], 'name' => $location['1.name']);
self::$_fields[CM_Model_Location::LEVEL_STATE] = array('id' => (int) $location['2.id'], 'name' => $location['2.name']);
self::$_fields[CM_Model_Location::LEVEL_CITY] = array('id' => (int) $location['3.id'], 'name' => $location['3.name']);
self::$_fields[CM_Model_Location::LEVEL_ZIP] = array('id' => (int) $location['4.id'], 'name' => $location['4.name']);
self::$_switzerlandId = $switzerland;
self::$_baselStadtId = $baselStadt;
self::$_baselId = $basel;
self::$_baselZipId = $baselZip;
}
示例3: tearDownAfterClass
public static function tearDownAfterClass()
{
CM_Db_Db::exec("DROP TABLE `indexTest_1`");
CM_Db_Db::exec("DROP TABLE `indexTest_2`");
CM_Db_Db::exec("DROP TABLE `indexTest_3`");
parent::tearDownAfterClass();
}
示例4: _dbToFileSql
/**
* @param string $namespace
*/
private function _dbToFileSql($namespace)
{
$namespace = (string) $namespace;
$tables = CM_Db_Db::exec("SHOW TABLES LIKE ?", array(strtolower($namespace) . '_%'))->fetchAllColumn();
sort($tables);
$dump = CM_Db_Db::getDump($tables, true);
CM_File::create(CM_Util::getModulePath($namespace) . '/resources/db/structure.sql', $dump);
}
示例5: _deleteOlderThan
/**
* @param int $age
*/
protected function _deleteOlderThan($age)
{
$age = (int) $age;
$type = $this->getType();
$deleteOlderThan = time() - $age;
CM_Db_Db::exec('DELETE FROM `cm_log` WHERE `timestamp` <= ? AND `type` = ?', array($deleteOlderThan, $type));
$this->_change();
}
示例6: reload
public function reload(CM_OutputStream_Interface $output)
{
$tableNames = CM_Db_Db::exec('SHOW TABLES')->fetchAllColumn();
CM_Db_Db::exec('SET foreign_key_checks = 0;');
foreach ($tableNames as $table) {
CM_Db_Db::delete($table);
}
CM_Db_Db::exec('SET foreign_key_checks = 1;');
$this->_setInitialVersion();
}
示例7: setUp
public function setUp()
{
CM_Db_Db::exec('ALTER TABLE cm_model_location_ip AUTO_INCREMENT = 1');
CM_Db_Db::exec('ALTER TABLE cm_model_location_zip AUTO_INCREMENT = 1');
CM_Db_Db::exec('ALTER TABLE cm_model_location_city AUTO_INCREMENT = 1');
CM_Db_Db::exec('ALTER TABLE cm_model_location_state AUTO_INCREMENT = 1');
CM_Db_Db::exec('ALTER TABLE cm_model_location_country AUTO_INCREMENT = 1');
$this->_errorStream = new CM_OutputStream_Null();
$file = new CM_File('/CM_OutputStream_File-' . uniqid(), CM_Service_Manager::getInstance()->getFilesystems()->getTmp());
$file->truncate();
$this->_outputStream = new CM_OutputStream_File($file);
}
示例8: tearDownAfterClass
public static function tearDownAfterClass()
{
parent::tearDownAfterClass();
CM_Db_Db::exec('DROP TABLE `test`');
}
示例9: 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`)");
}
示例10: tearDown
public function tearDown()
{
CM_Db_Db::exec('DROP TABLE `test`');
}
示例11: tearDownAfterClass
public static function tearDownAfterClass()
{
parent::tearDownAfterClass();
CM_Db_Db::exec("DROP TABLE `cm_modelmock`");
CM_Db_Db::exec("DROP TABLE `modelThasIsAnAssetMock`");
}
示例12: decimal
<?php
if ('1.00' === CM_Db_Db::describeColumn('cm_splittestVariation_fixture', 'conversionWeight')->getDefaultValue()) {
CM_Db_Db::exec('ALTER TABLE cm_splittestVariation_fixture
MODIFY COLUMN conversionWeight decimal(10,2) NOT NULL DEFAULT 0');
CM_Db_Db::update('cm_splittestVariation_fixture', array('conversionWeight' => 0), array('conversionStamp' => null));
}
示例13: while
<?php
return;
$rows = CM_Db_Db::execRead('SELECT `id`, `thumbnailCount` FROM cm_streamChannel_media WHERE thumbnailCount > 0');
while ($row = $rows->fetch()) {
CM_Db_Db::exec('UPDATE cm_streamChannel_media SET `data`=? WHERE `id`=? ', [CM_Params::encode(['thumbnailCount' => (int) $row['thumbnailCount']], true), $row['id']]);
}
$rows = CM_Db_Db::execRead('SELECT `id`, `thumbnailCount` FROM cm_streamChannelArchive_media WHERE thumbnailCount > 0');
while ($row = $rows->fetch()) {
CM_Db_Db::exec('UPDATE cm_streamChannelArchive_media SET `data`=? WHERE `id`=? ', [CM_Params::encode(['thumbnailCount' => (int) $row['thumbnailCount']], true), $row['id']]);
}
示例14: int
<?php
if (CM_Db_Db::describeColumn('cm_stream_publish', 'allowedUntil')->getAllowNull()) {
CM_Db_Db::exec('ALTER TABLE `cm_stream_publish` CHANGE `allowedUntil` `allowedUntil` int(10) unsigned NOT NULL');
}
if (CM_Db_Db::describeColumn('cm_stream_subscribe', 'allowedUntil')->getAllowNull()) {
CM_Db_Db::exec('ALTER TABLE `cm_stream_subscribe` CHANGE `allowedUntil` `allowedUntil` int(10) unsigned NOT NULL');
}
示例15: INT
<?php
if (!CM_Db_Db::describeColumn('cm_stream_subscribe', 'allowedUntil')->getAllowNull()) {
CM_Db_Db::exec("ALTER TABLE cm_stream_subscribe CHANGE allowedUntil allowedUntil INT(10) UNSIGNED DEFAULT NULL");
}
if (!CM_Db_Db::describeColumn('cm_stream_publish', 'allowedUntil')->getAllowNull()) {
CM_Db_Db::exec("ALTER TABLE cm_stream_publish CHANGE allowedUntil allowedUntil INT(10) UNSIGNED DEFAULT NULL");
}