Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/vendor/adodb/adodb-php/tests/testdatabases.inc.php
blob: 47b6b64101ed479f314b9911dbc62284c0a9dfcc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
<?php

/*
@version   v5.20.14  06-Jan-2019
@copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
@copyright (c) 2014      Damien Regad, Mark Newnham and the ADOdb community
  Released under both BSD license and Lesser GPL library license.
  Whenever there is any discrepancy between the two licenses,
  the BSD license will take precedence.
*/

 /* this file is used by the ADODB test program: test.php */
 ?>

<table><tr valign=top><td>
<form method=get>
<input type=checkbox name="testaccess" value=1 <?php echo !empty($testaccess) ? 'checked' : '' ?>> <b>Access</b><br>
<input type=checkbox name="testibase" value=1 <?php echo !empty($testibase) ? 'checked' : '' ?>> <b>Interbase</b><br>
<input type=checkbox name="testmssql" value=1 <?php echo !empty($testmssql) ? 'checked' : '' ?>> <b>MSSQL</b><br>
<input type=checkbox name="testmysql" value=1 <?php echo !empty($testmysql) ? 'checked' : '' ?>> <b>MySQL</b><br>
<input type=checkbox name="testmysqlodbc" value=1 <?php echo !empty($testmysqlodbc) ? 'checked' : '' ?>> <b>MySQL ODBC</b><br>
<input type=checkbox name="testmysqli" value=1 <?php echo !empty($testmysqli) ? 'checked' : '' ?>> <b>MySQLi</b>
<br>
<td><input type=checkbox name="testsqlite" value=1 <?php echo !empty($testsqlite) ? 'checked' : '' ?>> <b>SQLite</b><br>
<input type=checkbox name="testproxy" value=1 <?php echo !empty($testproxy) ? 'checked' : '' ?>> <b>MySQL Proxy</b><br>
<input type=checkbox name="testoracle" value=1 <?php echo !empty($testoracle) ? 'checked' : '' ?>> <b>Oracle (oci8)</b> <br>
<input type=checkbox name="testpostgres" value=1 <?php echo !empty($testpostgres) ? 'checked' : '' ?>> <b>PostgreSQL</b><br>
<input type=checkbox name="testpostgres9" value=1 <?php echo !empty($testpostgres9) ? 'checked' : '' ?>> <b>PostgreSQL 9</b><br>
<input type=checkbox name="testpgodbc" value=1 <?php echo !empty($testpgodbc) ? 'checked' : '' ?>> <b>PostgreSQL ODBC</b><br>
<td>
<input type=checkbox name="testpdopgsql" value=1 <?php echo !empty($testpdopgsql) ? 'checked' : '' ?>> <b>PgSQL PDO</b><br>
<input type=checkbox name="testpdomysql" value=1 <?php echo !empty($testpdomysql) ? 'checked' : '' ?>> <b>MySQL PDO</b><br>
<input type=checkbox name="testpdosqlite" value=1 <?php echo !empty($testpdosqlite) ? 'checked' : '' ?>> <b>SQLite PDO</b><br>
<input type=checkbox name="testpdoaccess" value=1 <?php echo !empty($testpdoaccess) ? 'checked' : '' ?>> <b>Access PDO</b><br>
<input type=checkbox name="testpdomssql" value=1 <?php echo !empty($testpdomssql) ? 'checked' : '' ?>> <b>MSSQL PDO</b><br>

<input type=checkbox name="testpdoora" value=1 <?php echo !empty($testpdoora) ? 'checked' : '' ?>> <b>OCI PDO</b><br>

<td><input type=checkbox name="testdb2" value=1 <?php echo !empty($testdb2) ? 'checked' : '' ?>> DB2<br>
<input type=checkbox name="testvfp" value=1 <?php echo !empty($testvfp) ? 'checked' : '' ?>> VFP+ODBTP<br>
<input type=checkbox name="testado" value=1 <?php echo !empty($testado) ? 'checked' : '' ?>> ADO (for mssql and access)<br>
<input type=checkbox name="nocountrecs" value=1 <?php echo !empty($nocountrecs) ? 'checked' : '' ?>> $ADODB_COUNTRECS=false<br>
<input type=checkbox name="nolog" value=1 <?php echo !empty($nolog) ? 'checked' : '' ?>> No SQL Logging<br>
<input type=checkbox name="time" value=1 <?php echo !empty($_GET['time']) ? 'checked' : '' ?>> ADOdb time test
</table>
<input type=submit>
</form>

<?php

if ($ADODB_FETCH_MODE != ADODB_FETCH_DEFAULT) print "<h3>FETCH MODE IS NOT ADODB_FETCH_DEFAULT</h3>";

if (isset($nocountrecs)) $ADODB_COUNTRECS = false;

// cannot test databases below, but we include them anyway to check
// if they parse ok...

if (sizeof($_GET) || !isset($_SERVER['HTTP_HOST'])) {
	echo "<BR>";
	ADOLoadCode2("sybase");
	ADOLoadCode2("postgres");
	ADOLoadCode2("postgres7");
	ADOLoadCode2("firebird");
	ADOLoadCode2("borland_ibase");
	ADOLoadCode2("informix");
	ADOLoadCode2('mysqli');
	if (defined('ODBC_BINMODE_RETURN')) {
		ADOLoadCode2("sqlanywhere");
		ADOLoadCode2("access");
	}
	ADOLoadCode2("mysql");
	ADOLoadCode2("oci8");
}

function ADOLoadCode2($d)
{
	ADOLoadCode($d);
	$c = ADONewConnection($d);
	echo "Loaded $d ",($c ? 'ok' : 'extension not installed'),"<br>";
}

flush();

// dregad 2014-04-15 added serial field to avoid error with lastval()
$pg_test_table = "create table ADOXYZ (id integer, firstname char(24), lastname varchar,created date, ser serial)";
$pg_hostname = 'localhost';
$pg_user = 'tester';
$pg_password = 'test';
$pg_database = 'northwind';
$pg_errmsg = "ERROR: PostgreSQL requires a database called '$pg_database' "
	. "on server '$pg_hostname', user '$pg_user', password '$pg_password'.<BR>";

if (!empty($testpostgres)) {
	//ADOLoadCode("postgres");

	$db = ADONewConnection('postgres');
	print "<h1>Connecting $db->databaseType...</h1>";
	if ($db->Connect($pg_hostname, $pg_user, $pg_password, $pg_database)) {
		testdb($db, $pg_test_table);
	} else {
		print $pg_errmsg . $db->ErrorMsg();
	}
}

if (!empty($testpostgres9)) {
	//ADOLoadCode("postgres");

	$db = ADONewConnection('postgres9');
	print "<h1>Connecting $db->databaseType...</h1>";
	if ($db->Connect($pg_hostname, $pg_user, $pg_password, $pg_database)) {
		testdb($db, $pg_test_table);
	} else {
		print $pg_errmsg . $db->ErrorMsg();
	}
}

if (!empty($testpgodbc)) {

	$db = ADONewConnection('odbc');
	$db->hasTransactions = false;
	print "<h1>Connecting $db->databaseType...</h1>";

	if ($db->PConnect('Postgresql')) {
		$db->hasTransactions = true;
		testdb($db,
		"create table ADOXYZ (id int, firstname char(24), lastname char(24), created date) type=innodb");
	} else print "ERROR: PostgreSQL requires a database called test on server, user tester, password test.<BR>".$db->ErrorMsg();
}

if (!empty($testibase)) {
	//$_GET['nolog'] = true;
	$db = ADONewConnection('firebird');
	print "<h1>Connecting $db->databaseType...</h1>";
	if ($db->PConnect("localhost:d:\\firebird\\151\\examples\\EMPLOYEE.fdb", "sysdba", "masterkey", ""))
		testdb($db,"create table ADOXYZ (id integer, firstname char(24), lastname char(24),price numeric(12,2),created date)");
	 else print "ERROR: Interbase test requires a database called employee.gdb".'<BR>'.$db->ErrorMsg();

}


if (!empty($testsqlite)) {
	$path =urlencode('d:\inetpub\adodb\sqlite.db');
	$dsn = "sqlite://$path/";
	$db = ADONewConnection($dsn);
	//echo $dsn;

	//$db = ADONewConnection('sqlite');


	if ($db && $db->PConnect("d:\\inetpub\\adodb\\sqlite.db", "", "", "")) {
		print "<h1>Connecting $db->databaseType...</h1>";
		testdb($db,"create table ADOXYZ (id int, firstname char(24), lastname char(24),created datetime)");
	} else
		print "ERROR: SQLite";

}

if (!empty($testpdopgsql)) {
	$connstr = "pgsql:dbname=test";
	$u = 'tester';$p='test';
	$db = ADONewConnection('pdo');
	print "<h1>Connecting $db->databaseType...</h1>";
	$db->Connect($connstr,$u,$p) || die("CONNECT FAILED");
	testdb($db,
		"create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)");
}

if (!empty($testpdomysql)) {
	$connstr = "mysql:dbname=northwind";
	$u = 'root';$p='';
	$db = ADONewConnection('pdo');
	print "<h1>Connecting $db->databaseType...</h1>";
	$db->Connect($connstr,$u,$p) || die("CONNECT FAILED");

	testdb($db,
		"create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)");
}

if (!empty($testpdomssql)) {
	$connstr = "mssql:dbname=northwind";
	$u = 'sa';$p='natsoft';
	$db = ADONewConnection('pdo');
	print "<h1>Connecting $db->databaseType...</h1>";
	$db->Connect($connstr,$u,$p) || die("CONNECT FAILED");

	testdb($db,
		"create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)");
}

if (!empty($testpdosqlite)) {
	$connstr = "sqlite:d:/inetpub/adodb/sqlite-pdo.db3";
	$u = '';$p='';
	$db = ADONewConnection('pdo');
	$db->hasTransactions = false;
	print "<h1>Connecting $db->databaseType...</h1>";
	$db->Connect($connstr,$u,$p) || die("CONNECT FAILED");
	testdb($db,
		"create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)");
}

if (!empty($testpdoaccess)) {
	$connstr = 'odbc:nwind';
	$u = '';$p='';
	$db = ADONewConnection('pdo');
	$db->hasTransactions = false;
	print "<h1>Connecting $db->databaseType...</h1>";
	$db->Connect($connstr,$u,$p) || die("CONNECT FAILED");
	testdb($db,
		"create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)");
}

if (!empty($testpdoora)) {
	$connstr = 'oci:';
	$u = 'scott';$p='natsoft';
	$db = ADONewConnection('pdo');
	#$db->hasTransactions = false;
	print "<h1>Connecting $db->databaseType...</h1>";
	$db->Connect($connstr,$u,$p) || die("CONNECT FAILED");
	testdb($db,
		"create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)");
}

// REQUIRES ODBC DSN CALLED nwind
if (!empty($testaccess)) {
	$db = ADONewConnection('access');
	print "<h1>Connecting $db->databaseType...</h1>";
	$access = 'd:\inetpub\wwwroot\php\NWIND.MDB';
	$dsn = "nwind";
	$dsn = "Driver={Microsoft Access Driver (*.mdb)};Dbq=$access;Uid=Admin;Pwd=;";

	//$dsn =  'Provider=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=' . $access . ';';
	if ($db->PConnect($dsn, "", "", ""))
		testdb($db,"create table ADOXYZ (id int, firstname char(24), lastname char(24),created datetime)");
	else print "ERROR: Access test requires a Windows ODBC DSN=nwind, Access driver";

}

if (!empty($testaccess) && !empty($testado)) { // ADO ACCESS

	$db = ADONewConnection("ado_access");
	print "<h1>Connecting $db->databaseType...</h1>";

	$access = 'd:\inetpub\wwwroot\php\NWIND.MDB';
	$myDSN =  'PROVIDER=Microsoft.Jet.OLEDB.4.0;'
		. 'DATA SOURCE=' . $access . ';';
		//. 'USER ID=;PASSWORD=;';
	$_GET['nolog'] = 1;
	if ($db->PConnect($myDSN, "", "", "")) {
		print "ADO version=".$db->_connectionID->version."<br>";
		testdb($db,"create table ADOXYZ (id int, firstname char(24), lastname char(24),created datetime)");
	} else print "ERROR: Access test requires a Access database $access".'<BR>'.$db->ErrorMsg();

}

if (!empty($testvfp)) { // ODBC
	$db = ADONewConnection('vfp');
	print "<h1>Connecting $db->databaseType...</h1>";flush();

	if ( $db->PConnect("vfp-adoxyz")) {
		testdb($db,"create table d:\\inetpub\\adodb\\ADOXYZ (id int, firstname char(24), lastname char(24),created date)");
	 } else print "ERROR: Visual FoxPro test requires a Windows ODBC DSN=vfp-adoxyz, VFP driver";

	echo "<hr />";
	$db = ADONewConnection('odbtp');

	if ( $db->PConnect('localhost','DRIVER={Microsoft Visual FoxPro Driver};SOURCETYPE=DBF;SOURCEDB=d:\inetpub\adodb;EXCLUSIVE=NO;')) {
	print "<h1>Connecting $db->databaseType...</h1>";flush();
	testdb($db,"create table d:\\inetpub\\adodb\\ADOXYZ (id int, firstname char(24), lastname char(24),created date)");
	 } else print "ERROR: Visual FoxPro odbtp requires a Windows ODBC DSN=vfp-adoxyz, VFP driver";

}


// REQUIRES MySQL server at localhost with database 'test'
if (!empty($testmysql)) { // MYSQL


	if (PHP_VERSION >= 5 || $_SERVER['HTTP_HOST'] == 'localhost') $server = 'localhost';
	else $server = "mangrove";
	$user = 'root'; $password = ''; $database = 'northwind';
	$db = ADONewConnection("mysqlt://$user:$password@$server/$database?persist");
	print "<h1>Connecting $db->databaseType...</h1>";

	if (true || $db->PConnect($server, "root", "", "northwind")) {
		//$db->Execute("DROP TABLE ADOXYZ") || die('fail drop');
		//$db->debug=1;$db->Execute('drop table ADOXYZ');
		testdb($db,
		"create table ADOXYZ (id int, firstname char(24), lastname char(24), created date) Type=InnoDB");
	} else print "ERROR: MySQL test requires a MySQL server on localhost, userid='admin', password='', database='test'".'<BR>'.$db->ErrorMsg();
}

// REQUIRES MySQL server at localhost with database 'test'
if (!empty($testmysqli)) { // MYSQL

	$db = ADONewConnection('mysqli');
	print "<h1>Connecting $db->databaseType...</h1>";
	if (PHP_VERSION >= 5 || $_SERVER['HTTP_HOST'] == 'localhost') $server = 'localhost';
	else $server = "mangrove";
	if ($db->PConnect($server, "root", "", "northwind")) {
		//$db->debug=1;$db->Execute('drop table ADOXYZ');
		testdb($db,
		"create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)");
	} else print "ERROR: MySQL test requires a MySQL server on localhost, userid='admin', password='', database='test'".'<BR>'.$db->ErrorMsg();
}


// REQUIRES MySQL server at localhost with database 'test'
if (!empty($testmysqlodbc)) { // MYSQL

	$db = ADONewConnection('odbc');
	$db->hasTransactions = false;
	print "<h1>Connecting $db->databaseType...</h1>";
	if ($_SERVER['HTTP_HOST'] == 'localhost') $server = 'localhost';
	else $server = "mangrove";
	if ($db->PConnect('mysql', "root", ""))
		testdb($db,
		"create table ADOXYZ (id int, firstname char(24), lastname char(24), created date) type=innodb");
	else print "ERROR: MySQL test requires a MySQL server on localhost, userid='admin', password='', database='test'".'<BR>'.$db->ErrorMsg();
}

if (!empty($testproxy)){
	$db = ADONewConnection('proxy');
	print "<h1>Connecting $db->databaseType...</h1>";
	if ($_SERVER['HTTP_HOST'] == 'localhost') $server = 'localhost';

	if ($db->PConnect('http://localhost/php/phplens/adodb/server.php'))
		testdb($db,
		"create table ADOXYZ (id int, firstname char(24), lastname char(24), created date) type=innodb");
	else print "ERROR: MySQL test requires a MySQL server on localhost, userid='admin', password='', database='test'".'<BR>'.$db->ErrorMsg();

}

ADOLoadCode('oci805');
ADOLoadCode("oci8po");

if (!empty($testoracle)) {
	$dsn = "oci8";//://scott:natsoft@kk2?persist";
	$db = ADONewConnection($dsn );//'oci8');

	//$db->debug=1;
	print "<h1>Connecting $db->databaseType...</h1>";
	if ($db->Connect('mobydick', "scott", "natsoft",'SID=mobydick'))
		testdb($db,"create table ADOXYZ (id int, firstname varchar(24), lastname varchar(24),created date)");
	else
		print "ERROR: Oracle test requires an Oracle server setup with scott/natsoft".'<BR>'.$db->ErrorMsg();

}
ADOLoadCode("oracle"); // no longer supported
if (false && !empty($testoracle)) {

	$db = ADONewConnection();
	print "<h1>Connecting $db->databaseType...</h1>";
	if ($db->PConnect("", "scott", "tiger", "natsoft.domain"))
		testdb($db,"create table ADOXYZ (id int, firstname varchar(24), lastname varchar(24),created date)");
	else print "ERROR: Oracle test requires an Oracle server setup with scott/tiger".'<BR>'.$db->ErrorMsg();

}

ADOLoadCode("odbc_db2"); // no longer supported
if (!empty($testdb2)) {
	if (PHP_VERSION>=5.1) {
		$db = ADONewConnection("db2");
		print "<h1>Connecting $db->databaseType...</h1>";

		#$db->curMode = SQL_CUR_USE_ODBC;
		#$dsn = "driver={IBM db2 odbc DRIVER};Database=test;hostname=localhost;port=50000;protocol=TCPIP; uid=natsoft; pwd=guest";
		if ($db->Connect('localhost','natsoft','guest','test')) {
			testdb($db,"create table ADOXYZ (id int, firstname varchar(24), lastname varchar(24),created date)");
		} else print "ERROR: DB2 test requires an server setup with odbc data source db2_sample".'<BR>'.$db->ErrorMsg();
	} else {
		$db = ADONewConnection("odbc_db2");
		print "<h1>Connecting $db->databaseType...</h1>";

		$dsn = "db2test";
		#$db->curMode = SQL_CUR_USE_ODBC;
		#$dsn = "driver={IBM db2 odbc DRIVER};Database=test;hostname=localhost;port=50000;protocol=TCPIP; uid=natsoft; pwd=guest";
		if ($db->Connect($dsn)) {
			testdb($db,"create table ADOXYZ (id int, firstname varchar(24), lastname varchar(24),created date)");
		} else print "ERROR: DB2 test requires an server setup with odbc data source db2_sample".'<BR>'.$db->ErrorMsg();
	}
echo "<hr />";
flush();
	$dsn = "driver={IBM db2 odbc DRIVER};Database=sample;hostname=localhost;port=50000;protocol=TCPIP; uid=root; pwd=natsoft";

	$db = ADONewConnection('odbtp');
	if ($db->Connect('127.0.0.1',$dsn)) {

		$db->debug=1;
		 $arr = $db->GetArray( "||SQLProcedures" ); adodb_pr($arr);
	     $arr = $db->GetArray( "||SQLProcedureColumns|||GET_ROUTINE_SAR" );adodb_pr($arr);

		testdb($db,"create table ADOXYZ (id int, firstname varchar(24), lastname varchar(24),created date)");
	} else echo ("ERROR Connection");
	echo $db->ErrorMsg();
}


$server = 'localhost';



ADOLoadCode("mssqlpo");
if (false && !empty($testmssql)) { // MS SQL Server -- the extension is buggy -- probably better to use ODBC
	$db = ADONewConnection("mssqlpo");
	//$db->debug=1;
	print "<h1>Connecting $db->databaseType...</h1>";

	$ok = $db->Connect('','sa','natsoft','northwind');
	echo $db->ErrorMsg();
	if ($ok /*or $db->PConnect("mangrove", "sa", "natsoft", "ai")*/) {
		AutoDetect_MSSQL_Date_Order($db);
	//	$db->Execute('drop table adoxyz');
		testdb($db,"create table ADOXYZ (id int, firstname char(24) null, lastname char(24) null,created datetime null)");
	} else print "ERROR: MSSQL test 2 requires a MS SQL 7 on a server='$server', userid='adodb', password='natsoft', database='ai'".'<BR>'.$db->ErrorMsg();

}


ADOLoadCode('odbc_mssql');
if (!empty($testmssql)) { // MS SQL Server via ODBC
	$db = ADONewConnection();

	print "<h1>Connecting $db->databaseType...</h1>";

	$dsn = "PROVIDER=MSDASQL;Driver={SQL Server};Server=$server;Database=northwind;";
	$dsn = 'condor';
	if ($db->PConnect($dsn, "sa", "natsoft", ""))  {
		testdb($db,"create table ADOXYZ (id int, firstname char(24) null, lastname char(24) null,created datetime null)");
	}
	else print "ERROR: MSSQL test 1 requires a MS SQL 7 server setup with DSN setup";

}

ADOLoadCode("ado_mssql");
if (!empty($testmssql) && !empty($testado) ) { // ADO ACCESS MSSQL -- thru ODBC -- DSN-less

	$db = ADONewConnection("ado_mssql");
	//$db->debug=1;
	print "<h1>Connecting DSN-less $db->databaseType...</h1>";

	$myDSN="PROVIDER=MSDASQL;DRIVER={SQL Server};"
		. "SERVER=$server;DATABASE=NorthWind;UID=adodb;PWD=natsoft;Trusted_Connection=No";


	if ($db->PConnect($myDSN, "", "", ""))
		testdb($db,"create table ADOXYZ (id int, firstname char(24) null, lastname char(24) null,created datetime null)");
	else print "ERROR: MSSQL test 2 requires MS SQL 7";

}

if (!empty($testmssql) && !empty($testado)) { // ADO ACCESS MSSQL with OLEDB provider

	$db = ADONewConnection("ado_mssql");
	print "<h1>Connecting DSN-less OLEDB Provider $db->databaseType...</h1>";
	//$db->debug=1;
	$myDSN="SERVER=localhost;DATABASE=northwind;Trusted_Connection=yes";
	if ($db->PConnect($myDSN, "adodb", "natsoft", 'SQLOLEDB')) {
		testdb($db,"create table ADOXYZ (id int, firstname char(24), lastname char(24),created datetime)");
	} else print "ERROR: MSSQL test 2 requires a MS SQL 7 on a server='mangrove', userid='sa', password='', database='ai'";

}


if (extension_loaded('odbtp') && !empty($testmssql)) { // MS SQL Server via ODBC
	$db = ADONewConnection('odbtp');

	$dsn = "PROVIDER=MSDASQL;Driver={SQL Server};Server=$server;Database=northwind;uid=adodb;pwd=natsoft";

	if ($db->PConnect('localhost',$dsn, "", ""))  {
		print "<h1>Connecting $db->databaseType...</h1>";
		testdb($db,"create table ADOXYZ (id int, firstname char(24) null, lastname char(24) null,created datetime null)");
	}
	else print "ERROR: MSSQL test 1 requires a MS SQL 7 server setup with DSN setup";

}


print "<h3>Tests Completed</h3>";