本文整理匯總了PHP中Sqlite::execute方法的典型用法代碼示例。如果您正苦於以下問題:PHP Sqlite::execute方法的具體用法?PHP Sqlite::execute怎麽用?PHP Sqlite::execute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Sqlite
的用法示例。
在下文中一共展示了Sqlite::execute方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testCacheKeyName
/**
* Tests that cached table descriptions are saved under the sanitized key name
*
* @return void
*/
public function testCacheKeyName()
{
Configure::write('Cache.disable', false);
$dbName = 'db' . rand() . '$(*%&).db';
$this->assertFalse(file_exists(TMP . $dbName));
$db = new Sqlite(array_merge($this->Dbo->config, array('database' => TMP . $dbName)));
$this->assertTrue(file_exists(TMP . $dbName));
$db->execute("CREATE TABLE test_list (id VARCHAR(255));");
$db->cacheSources = true;
$this->assertEquals(array('test_list'), $db->listSources());
$db->cacheSources = false;
$fileName = '_' . preg_replace('/[^A-Za-z0-9_\\-+]/', '_', TMP . $dbName) . '_list';
$result = Cache::read($fileName, '_cake_model_');
$this->assertEquals(array('test_list'), $result);
Cache::delete($fileName, '_cake_model_');
Configure::write('Cache.disable', true);
}
示例2: testCacheKeyName
/**
* Tests that cached table descriptions are saved under the sanitized key name
*
* @return void
*/
public function testCacheKeyName()
{
Configure::write('Cache.disable', false);
$dbName = 'db' . rand() . '$(*%&).db';
$this->assertFalse(file_exists(TMP . $dbName));
try {
$db = new Sqlite(array_merge($this->Dbo->config, array('database' => TMP . $dbName)));
} catch (MissingConnectionException $e) {
// This might be caused by NTFS file systems, where '*' is a forbidden character. Repeat without this character.
$dbName = str_replace('*', '', $dbName);
$db = new Sqlite(array_merge($this->Dbo->config, array('database' => TMP . $dbName)));
}
$this->assertTrue(file_exists(TMP . $dbName));
$db->execute("CREATE TABLE test_list (id VARCHAR(255));");
$db->cacheSources = true;
$this->assertEquals(array('test_list'), $db->listSources());
$db->cacheSources = false;
$fileName = '_' . preg_replace('/[^A-Za-z0-9_\\-+]/', '_', TMP . $dbName) . '_list';
$result = Cache::read($fileName, '_cake_model_');
$this->assertEquals(array('test_list'), $result);
Cache::delete($fileName, '_cake_model_');
Configure::write('Cache.disable', true);
}