xref: /PHP-5.6/ext/pdo_firebird/tests/testdb.inc (revision 1e385459)
1<?php /* $Id$ */
2
3$user = 'SYSDBA';
4$password = 'masterkey';
5ini_set('ibase.default_user',$user);
6ini_set('ibase.default_password',$password);
7
8/* we need just the generated name, not the file itself */
9unlink($test_base = tempnam('/tmp',"php_ibase_test"));
10
11function init_db()
12{
13	global $test_base, $user, $password;
14
15	$test_db = ibase_query(IBASE_CREATE,sprintf("CREATE DATABASE '%s' USER '%s' PASSWORD '%s'",
16		$test_base, $user, $password));
17	$tr = ibase_trans($test_db);
18	ibase_query($tr,"create table test1 (i integer, c varchar(100))");
19	ibase_commit_ret($tr);
20	ibase_query($tr,"insert into test1(i, c) values(1, 'test table not created with isql')");
21	ibase_commit($tr);
22	ibase_close($test_db);
23}
24
25function cleanup_db()
26{
27	global $test_base;
28
29	$r = ibase_connect($test_base);
30	ibase_drop_db($r);
31}
32
33register_shutdown_function('cleanup_db');
34init_db();
35