php-src/ext/sqlite/tests/blankdb.inc
2004-01-08 16:55:37 +00:00

18 lines
372 B
PHP

<?php #vim:ft=php
$dbname = tempnam(dirname(__FILE__), "phpsql");
function cleanup() {
$retry = 10;
if (is_resource($GLOBALS['db'])) {
@sqlite_close($GLOBALS['db']);
}
do {
usleep(500000);
if (@unlink($GLOBALS['dbname']))
break;
} while (file_exists($GLOBALS['dbname']) && --$retry);
}
register_shutdown_function("cleanup");
$db = sqlite_open($dbname);
?>