php-src/ext/sqlite/tests/blankdb.inc

18 lines
372 B
PHP
Raw Normal View History

<?php #vim:ft=php
$dbname = tempnam(dirname(__FILE__), "phpsql");
function cleanup() {
2004-01-08 16:55:37 +00:00
$retry = 10;
2003-12-05 13:42:04 +00:00
if (is_resource($GLOBALS['db'])) {
@sqlite_close($GLOBALS['db']);
}
2004-01-08 16:55:37 +00:00
do {
usleep(500000);
if (@unlink($GLOBALS['dbname']))
break;
} while (file_exists($GLOBALS['dbname']) && --$retry);
}
register_shutdown_function("cleanup");
$db = sqlite_open($dbname);
?>