| 1 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
// uncomment this line if you want to run both MDB2 from a CVS checkout
|
|
|
4 |
#ini_set('include_path', '..'.PATH_SEPARATOR.ini_get('include_path'));
|
|
|
5 |
|
|
|
6 |
$testcases = array(
|
|
|
7 |
'MDB2_api_testcase',
|
|
|
8 |
'MDB2_usage_testcase',
|
|
|
9 |
'MDB2_bugs_testcase',
|
|
|
10 |
'MDB2_extended_testcase',
|
|
|
11 |
'MDB2_datatype_testcase',
|
|
|
12 |
'MDB2_manager_testcase',
|
|
|
13 |
'MDB2_reverse_testcase',
|
|
|
14 |
'MDB2_function_testcase',
|
|
|
15 |
'MDB2_native_testcase',
|
|
|
16 |
'MDB2_internals_testcase',
|
|
|
17 |
);
|
|
|
18 |
|
|
|
19 |
// use a user that has full permissions on a database named "driver_test"
|
|
|
20 |
$mysql = array(
|
|
|
21 |
'dsn' => array(
|
|
|
22 |
'phptype' => 'mysql',
|
|
|
23 |
'username' => 'username',
|
|
|
24 |
'password' => 'password',
|
|
|
25 |
'hostspec' => 'hostname',
|
|
|
26 |
),
|
|
|
27 |
'options' => array(
|
|
|
28 |
'use_transactions' => true
|
|
|
29 |
)
|
|
|
30 |
);
|
|
|
31 |
|
|
|
32 |
$pgsql = array(
|
|
|
33 |
'dsn' => array(
|
|
|
34 |
'phptype' => 'pgsql',
|
|
|
35 |
'username' => 'username',
|
|
|
36 |
'password' => 'password',
|
|
|
37 |
'hostspec' => 'hostname',
|
|
|
38 |
)
|
|
|
39 |
);
|
|
|
40 |
|
|
|
41 |
$oci8 = array(
|
|
|
42 |
'dsn' => array(
|
|
|
43 |
'phptype' => 'oci8',
|
|
|
44 |
'username' => '',
|
|
|
45 |
'password' => 'password',
|
|
|
46 |
'hostspec' => 'hostname',
|
|
|
47 |
),
|
|
|
48 |
'options' => array(
|
|
|
49 |
'DBA_username' => 'username',
|
|
|
50 |
'DBA_password' => 'password'
|
|
|
51 |
)
|
|
|
52 |
);
|
|
|
53 |
|
|
|
54 |
$sqlite = array(
|
|
|
55 |
'dsn' => array(
|
|
|
56 |
'phptype' => 'sqlite',
|
|
|
57 |
'username' => '',
|
|
|
58 |
'password' => 'password',
|
|
|
59 |
'hostspec' => 'hostname',
|
|
|
60 |
),
|
|
|
61 |
'options' => array(
|
|
|
62 |
'database_path' => '',
|
|
|
63 |
'database_extension' => '',
|
|
|
64 |
)
|
|
|
65 |
);
|
|
|
66 |
|
|
|
67 |
// must be a user with system administrator privileges
|
|
|
68 |
$mssql = array(
|
|
|
69 |
'dsn' => array(
|
|
|
70 |
'phptype' => 'mssql',
|
|
|
71 |
'username' => 'username',
|
|
|
72 |
'password' => 'password',
|
|
|
73 |
'hostspec' => 'hostname',
|
|
|
74 |
)
|
|
|
75 |
);
|
|
|
76 |
|
|
|
77 |
$fbsql = array(
|
|
|
78 |
'dsn' => array(
|
|
|
79 |
'phptype' => 'fbsql',
|
|
|
80 |
'username' => 'username',
|
|
|
81 |
'password' => 'password',
|
|
|
82 |
'hostspec' => 'hostname',
|
|
|
83 |
)
|
|
|
84 |
);
|
|
|
85 |
|
|
|
86 |
|
|
|
87 |
$ibase = array(
|
|
|
88 |
'dsn' => array(
|
|
|
89 |
'phptype' => 'ibase',
|
|
|
90 |
'username' => 'username',
|
|
|
91 |
'password' => 'password',
|
|
|
92 |
'hostspec' => 'hostname',
|
|
|
93 |
)
|
|
|
94 |
);
|
|
|
95 |
|
|
|
96 |
$dbarray = array();
|
|
|
97 |
#$dbarray[] = $mysql;
|
|
|
98 |
#$dbarray[] = $pgsql;
|
|
|
99 |
#$dbarray[] = $oci8;
|
|
|
100 |
#$dbarray[] = $sqlite;
|
|
|
101 |
#$dbarray[] = $mssql;
|
|
|
102 |
#$dbarray[] = $fbsql;
|
|
|
103 |
#$dbarray[] = $ibase;
|
|
|
104 |
|
|
|
105 |
// you may need to uncomment the line and modify the multiplier as you see fit
|
|
|
106 |
#set_time_limit(60*count($dbarray));
|
|
|
107 |
|
|
|
108 |
//if uncommented, the following will drop and recreate the test database when running the test
|
|
|
109 |
// the paths assumes that MDB2_Schema is checked out in the same parent directory as MDB2
|
|
|
110 |
/*
|
|
|
111 |
require_once('MDB2/Schema.php');
|
|
|
112 |
$schema_path = '../../MDB2_Schema/tests/';
|
|
|
113 |
|
|
|
114 |
function pe($e) {
|
|
|
115 |
die($e->getMessage().' '.$e->getUserInfo());
|
|
|
116 |
}
|
|
|
117 |
PEAR::pushErrorHandling(PEAR_ERROR_CALLBACK, 'pe');
|
|
|
118 |
foreach ($dbarray as $dbtype) {
|
|
|
119 |
// Work around oci8 problems with dropping the connected user
|
|
|
120 |
$dsn = $dbtype['dsn'];
|
|
|
121 |
if ($dbtype['dsn']['phptype'] == 'oci8') {
|
|
|
122 |
$dsn['username'] = $dbtype['options']['DBA_username'];
|
|
|
123 |
$dsn['password'] = $dbtype['options']['DBA_password'];
|
|
|
124 |
$dsn['database'] = $dbtype['options']['DBA_username'];
|
|
|
125 |
}
|
|
|
126 |
$db =& MDB2::connect($dsn, $dbtype['options']);
|
|
|
127 |
$db->loadModule('Manager');
|
|
|
128 |
if (in_array('driver_test', $db->manager->listDatabases())) {
|
|
|
129 |
$db->manager->dropDatabase('driver_test');
|
|
|
130 |
}
|
|
|
131 |
// Work around oci8 problems with dropping the connected user
|
|
|
132 |
if ($dbtype['dsn']['phptype'] == 'oci8') {
|
|
|
133 |
$db->query('CREATE USER '.$dbtype['dsn']['username'].' IDENTIFIED BY '.$dbtype['dsn']['password'].' DEFAULT TABLESPACE USERS QUOTA UNLIMITED ON USERS');
|
|
|
134 |
$db->query('GRANT CREATE SESSION, CREATE TABLE, CREATE SEQUENCE, CREATE TRIGGER to '.$dbtype['dsn']['username']);
|
|
|
135 |
}
|
|
|
136 |
$schema =& MDB2_Schema::factory($dbtype['dsn'], $dbtype['options']);
|
|
|
137 |
$schema->updateDatabase(
|
|
|
138 |
'../../MDB2_Schema/tests/driver_test.schema',
|
|
|
139 |
false,
|
|
|
140 |
array('create' => '1', 'name' => 'driver_test')
|
|
|
141 |
);
|
|
|
142 |
$schema->updateDatabase(
|
|
|
143 |
'../../MDB2_Schema/tests/lob_test.schema',
|
|
|
144 |
false,
|
|
|
145 |
array('create' => '1', 'name' => 'driver_test')
|
|
|
146 |
);
|
|
|
147 |
}
|
|
|
148 |
PEAR::popErrorHandling();
|
|
|
149 |
*/
|
|
|
150 |
|
|
|
151 |
?>
|