summaryrefslogtreecommitdiff
path: root/ext/sqlite/tests/blankdb.inc
blob: 43c6ff3582e721237409ad98e07570a00812db2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?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);
?>