mirror of
https://github.com/moodle/moodle.git
synced 2025-08-10 11:26:41 +02:00
Upgraded to ADOdb 4.5.1. Contains a lot of small fixes and speed-ups.
This commit is contained in:
parent
f5f346a594
commit
fab7e07e19
90 changed files with 1555 additions and 832 deletions
|
@ -8,7 +8,7 @@
|
|||
<body>
|
||||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
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.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/*
|
||||
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
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.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
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.
|
||||
|
@ -18,11 +18,11 @@ include("$path/../adodb.inc.php");
|
|||
echo "<h3>PHP ".PHP_VERSION."</h3>\n";
|
||||
try {
|
||||
|
||||
$dbt = 'mysqli';
|
||||
$dbt = 'oci8po';
|
||||
|
||||
switch($dbt) {
|
||||
case 'oci8':
|
||||
$db = NewADOConnection("oci8");
|
||||
case 'oci8po':
|
||||
$db = NewADOConnection("oci8po");
|
||||
$db->Connect('','scott','natsoft');
|
||||
break;
|
||||
default:
|
||||
|
@ -32,23 +32,26 @@ case 'mysql':
|
|||
break;
|
||||
|
||||
case 'mysqli':
|
||||
$db = NewADOConnection("mysqli");
|
||||
$db->Connect('localhost','root','','test');
|
||||
$db = NewADOConnection("mysqli://root:@localhost/test");
|
||||
//$db->Connect('localhost','root','','test');
|
||||
break;
|
||||
}
|
||||
|
||||
$db->debug=1;
|
||||
|
||||
$cnt = $db->GetOne("select count(*) from adoxyz");
|
||||
$rs = $db->Execute("select * from adoxyz order by id");
|
||||
$cnt = $db->GetOne("select count(*) from adoxyz where ?<id and id<?",array(10,20));
|
||||
$stmt = $db->Prepare("select * from adoxyz where ?<id and id<?");
|
||||
if (!$stmt) echo $db->ErrorMsg(),"\n";
|
||||
$rs = $db->Execute($stmt,array(10,20));
|
||||
|
||||
$i = 0;
|
||||
foreach($rs as $v) {
|
||||
$i += 1;
|
||||
echo "$i: "; adodb_pr($v); adodb_pr($rs->fields);
|
||||
echo "rec $i: "; adodb_pr($v); adodb_pr($rs->fields);
|
||||
flush();
|
||||
}
|
||||
|
||||
|
||||
if ($i != $cnt) die("actual cnt is $i, cnt should be $cnt\n");
|
||||
|
||||
|
||||
|
@ -60,4 +63,6 @@ $rs = $db->Execute("select bad from badder");
|
|||
$e = adodb_backtrace($e->gettrace());
|
||||
}
|
||||
|
||||
$rs = $db->Execute("select distinct id, firstname,lastname from adoxyz order by id");
|
||||
echo "Result=\n",$rs;
|
||||
?>
|
|
@ -18,10 +18,10 @@ $schema = new adoSchema( $db );
|
|||
// uncomment the following line:
|
||||
#$schema->upgradeSchema();
|
||||
|
||||
print "<b>SQL to build xmlschema.xml</b>:\n<pre>";
|
||||
// Build the SQL array
|
||||
$sql = $schema->ParseSchema( "xmlschema.xml" );
|
||||
|
||||
print "Here's the SQL to do the build:\n<pre>";
|
||||
print_r( $sql );
|
||||
print "</pre>\n";
|
||||
|
||||
|
@ -38,10 +38,12 @@ $db2->Connect('localhost','sa','natsoft','northwind') || die("Fail 2");
|
|||
|
||||
$db2->Execute("drop table simple_table");
|
||||
|
||||
|
||||
print "<b>SQL to build xmlschema-mssql.xml</b>:\n<pre>";
|
||||
|
||||
$schema = new adoSchema( $db2 );
|
||||
$sql = $schema->ParseSchema( "xmlschema-mssql.xml" );
|
||||
|
||||
print "Here's the SQL to do the build:\n<pre>";
|
||||
print_r( $sql );
|
||||
print "</pre>\n";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
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.
|
||||
|
@ -138,7 +138,7 @@ FROM `nuke_stories` `t1`, `nuke_authors` `t2`, `nuke_stories_cat` `t3`, `nuke_to
|
|||
print "<br><i>ts4</i> =".($db->UnixTimeStamp("19700101000101")+8*3600);
|
||||
print "<br><i>ts5</i> =".$db->DBTimeStamp($db->UnixTimeStamp("20040110092123"));
|
||||
print "<br><i>ts6</i> =".$db->UserTimeStamp("20040110092123");
|
||||
print "<br><i>ts6</i> =".$db->DBTimeStamp("20040110092123");
|
||||
print "<br><i>ts7</i> =".$db->DBTimeStamp("20040110092123");
|
||||
flush();
|
||||
// mssql too slow in failing bad connection
|
||||
if (false && $db->databaseType != 'mssql') {
|
||||
|
@ -151,7 +151,7 @@ FROM `nuke_stories` `t1`, `nuke_authors` `t2`, `nuke_stories_cat` `t3`, `nuke_to
|
|||
}
|
||||
error_reporting($e);
|
||||
flush();
|
||||
|
||||
|
||||
//$ADODB_COUNTRECS=false;
|
||||
$rs=$db->Execute('select * from adoxyz order by id');
|
||||
|
||||
|
@ -410,6 +410,43 @@ GO
|
|||
$saved = $db->debug;
|
||||
$db->debug=true;
|
||||
|
||||
|
||||
/*
|
||||
CREATE TABLE PHOTOS
|
||||
(
|
||||
ID NUMBER(16),
|
||||
PHOTO BLOB,
|
||||
DESCRIPTION VARCHAR2(4000 BYTE),
|
||||
DESCCLOB CLOB
|
||||
);
|
||||
|
||||
INSERT INTO PHOTOS (ID) VALUES(1);
|
||||
*/
|
||||
$s = '';
|
||||
for ($i = 0; $i <= 500; $i++) {
|
||||
$s .= '1234567890';
|
||||
}
|
||||
|
||||
|
||||
print "<h4>Testing Blob: size=".strlen($s)."</h4>";
|
||||
$ok = $db->Updateblob('photos','photo',$s,'id=1');
|
||||
if (!$ok) Err("Blob failed 1");
|
||||
else {
|
||||
$s2= $db->GetOne("select photo from photos where id=1");
|
||||
if ($s !== $s2) Err("updateblob does not match");
|
||||
}
|
||||
|
||||
print "<h4>Testing Clob: size=".strlen($s)."</h4>";
|
||||
$ok = $db->UpdateClob('photos','descclob',$s,'id=1');
|
||||
if (!$ok) Err("Clob failed 1");
|
||||
else {
|
||||
$s2= $db->GetOne("select descclob from photos where id=1");
|
||||
if ($s !== $s2) Err("updateclob does not match");
|
||||
}
|
||||
|
||||
|
||||
$s = '';
|
||||
$s2 = '';
|
||||
print "<h4>Testing Foreign Keys</h4>";
|
||||
$arr = $db->MetaForeignKeys('emp');
|
||||
print_r($arr);
|
||||
|
@ -417,30 +454,50 @@ GO
|
|||
print "<h4>Testing Cursor Variables</h4>";
|
||||
/*
|
||||
-- TEST PACKAGE
|
||||
CREATE OR REPLACE PACKAGE adodb AS
|
||||
TYPE TabType IS REF CURSOR RETURN tab%ROWTYPE;
|
||||
PROCEDURE open_tab (tabcursor IN OUT TabType,tablenames in varchar);
|
||||
PROCEDURE data_out(input IN varchar, output OUT varchar);
|
||||
END adodb;
|
||||
|
||||
CREATE OR REPLACE PACKAGE Adodb AS
|
||||
TYPE TabType IS REF CURSOR RETURN TAB%ROWTYPE;
|
||||
PROCEDURE open_tab (tabcursor IN OUT TabType,tablenames IN VARCHAR);
|
||||
PROCEDURE open_tab2 (tabcursor IN OUT TabType,tablenames IN OUT VARCHAR) ;
|
||||
PROCEDURE data_out(input IN VARCHAR, output OUT VARCHAR);
|
||||
|
||||
PROCEDURE myproc (p1 IN NUMBER, p2 OUT NUMBER);
|
||||
END Adodb;
|
||||
/
|
||||
|
||||
CREATE OR REPLACE PACKAGE BODY adodb AS
|
||||
PROCEDURE open_tab (tabcursor IN OUT TabType,tablenames in varchar) IS
|
||||
|
||||
CREATE OR REPLACE PACKAGE BODY Adodb AS
|
||||
PROCEDURE open_tab (tabcursor IN OUT TabType,tablenames IN VARCHAR) IS
|
||||
BEGIN
|
||||
OPEN tabcursor FOR SELECT * FROM tab where tname like tablenames;
|
||||
OPEN tabcursor FOR SELECT * FROM TAB WHERE tname LIKE tablenames;
|
||||
END open_tab;
|
||||
|
||||
PROCEDURE open_tab2 (tabcursor IN OUT TabType,tablenames IN OUT VARCHAR) IS
|
||||
BEGIN
|
||||
OPEN tabcursor FOR SELECT * FROM TAB WHERE tname LIKE tablenames;
|
||||
tablenames := 'TEST';
|
||||
END open_tab2;
|
||||
|
||||
PROCEDURE data_out(input IN varchar, output OUT varchar) IS
|
||||
PROCEDURE data_out(input IN VARCHAR, output OUT VARCHAR) IS
|
||||
BEGIN
|
||||
output := 'Cinta Hati '||input;
|
||||
END;
|
||||
END adodb;
|
||||
|
||||
PROCEDURE myproc (p1 IN NUMBER, p2 OUT NUMBER) AS
|
||||
BEGIN
|
||||
p2 := p1;
|
||||
END;
|
||||
END Adodb;
|
||||
/
|
||||
|
||||
|
||||
*/
|
||||
$rs = $db->ExecuteCursor("BEGIN adodb.open_tab(:RS,'A%'); END;");
|
||||
$rs = $db->ExecuteCursor("BEGIN adodb.open_tab(:zz,'A%'); END;",'zz');
|
||||
|
||||
if ($rs && !$rs->EOF) {
|
||||
print "Test 1 RowCount: ".$rs->RecordCount()."<p>";
|
||||
$v = $db->GetOne("SELECT count(*) FROM tab where tname like 'A%'");
|
||||
if ($v == $rs->RecordCount()) print "Test 1 RowCount: OK<p>";
|
||||
else Err("Test 1 RowCount ".$rs->RecordCount().", actual = $v");
|
||||
} else {
|
||||
print "<b>Error in using Cursor Variables 1</b><p>";
|
||||
}
|
||||
|
@ -488,6 +545,7 @@ END adodb;
|
|||
$db->CompleteTrans();
|
||||
$rs = $db->Execute('select * from ADOXYZ order by id');
|
||||
if ($rs->RecordCount() != 3) Err("Bad bulk insert");
|
||||
|
||||
rs2html($rs);
|
||||
|
||||
$db->Execute('delete from ADOXYZ');
|
||||
|
@ -749,8 +807,20 @@ END adodb;
|
|||
$db->debug = true;
|
||||
print "<p>SelectLimit Distinct Test 1: Should see Caroline, John and Mary</p>";
|
||||
$rs = &$db->SelectLimit('select distinct * from ADOXYZ order by id',3);
|
||||
|
||||
echo "<p>Date Update Test</p>";
|
||||
$zdate = date('Y-m-d',time()+3600*24);
|
||||
$zdate = $db->DBDate($zdate);
|
||||
$db->Execute("update ADOXYZ set created=$zdate where id=1");
|
||||
$row = $db->GetRow("select created,firstname from ADOXYZ where id=1");
|
||||
print_r($row); echo "<br>";
|
||||
|
||||
//$zdate = date('Y-m-d',time()+3600*24);
|
||||
//$db->Execute("update ADOXYZ set created=? where id=2",$zdate);
|
||||
//$zdate = $db->GetOne("select created from ADOXYZ where id=2");
|
||||
//echo "tomorrow=",$zdate,"<br>";
|
||||
$db->debug=false;
|
||||
|
||||
|
||||
if ($rs && !$rs->EOF) {
|
||||
if (trim($rs->fields[1]) != 'Caroline') Err("Error 1");
|
||||
$rs->MoveNext();
|
||||
|
@ -854,10 +924,10 @@ END adodb;
|
|||
$save = $ADODB_FETCH_MODE;
|
||||
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
|
||||
if ($db->dataProvider == 'postgres') {
|
||||
$sql = "select ".$db->Concat('cast(firstname as varchar)',$db->qstr(' '),'lastname')." as fullname,id from ADOXYZ";
|
||||
$sql = "select ".$db->Concat('cast(firstname as varchar)',$db->qstr(' '),'lastname')." as fullname,id,".$db->sysTimeStamp." as d from ADOXYZ";
|
||||
$rs = &$db->Execute($sql);
|
||||
} else {
|
||||
$sql = "select distinct ".$db->Concat('firstname',$db->qstr(' '),'lastname')." as fullname,id from ADOXYZ";
|
||||
$sql = "select distinct ".$db->Concat('firstname',$db->qstr(' '),'lastname')." as fullname,id,".$db->sysTimeStamp." as d from ADOXYZ";
|
||||
$rs = &$db->Execute($sql);
|
||||
}
|
||||
if ($rs) {
|
||||
|
@ -904,12 +974,12 @@ END adodb;
|
|||
//$arr = $db->GetArray("select lastname,firstname from ADOXYZ");
|
||||
//print_r($arr);
|
||||
print "<hr>";
|
||||
$rs =& $db->Execute("select distinct lastname,firstname from ADOXYZ");
|
||||
$rs =& $db->Execute("select distinct lastname,firstname,created from ADOXYZ");
|
||||
|
||||
if ($rs) {
|
||||
$arr = $rs->GetAssoc();
|
||||
//print_r($arr);
|
||||
if (empty($arr['See']) || trim($arr['See']) != 'Wai Hun') print $arr['See']." <b>ERROR</b><br>";
|
||||
if (empty($arr['See']) || trim(reset($arr['See'])) != 'Wai Hun') print $arr['See']." <b>ERROR</b><br>";
|
||||
else print " OK 1";
|
||||
}
|
||||
|
||||
|
@ -1433,7 +1503,7 @@ if (isset($_SERVER['argv'][1])) {
|
|||
$HTTP_GET_VARS[$_SERVER['argv'][1]] = 1;
|
||||
}
|
||||
|
||||
if ( @$HTTP_SERVER_VARS['COMPUTERNAME'] == 'TIGRESS') {
|
||||
if (@$HTTP_SERVER_VARS['COMPUTERNAME'] == 'TIGRESS') {
|
||||
CheckWS('mysqlt');
|
||||
CheckWS('postgres');
|
||||
CheckWS('oci8po');
|
||||
|
@ -1478,7 +1548,7 @@ if (strpos(PHP_VERSION,'5') === 0) {
|
|||
|
||||
This script tests the following databases: Interbase, Oracle, Visual FoxPro, Microsoft Access (ODBC and ADO), MySQL, MSSQL (ODBC, native, ADO).
|
||||
There is also support for Sybase, PostgreSQL.</p>
|
||||
For the latest version of ADODB, visit <a href=http://php.weblogs.com/ADODB>php.weblogs.com</a>.</p>
|
||||
For the latest version of ADODB, visit <a href=http://adodb.sourceforge.net/>adodb.sourceforge.net</a>.</p>
|
||||
|
||||
Test <a href=test4.php>GetInsertSQL/GetUpdateSQL</a>
|
||||
<a href=testsessions.php>Sessions</a>
|
||||
|
@ -1489,8 +1559,9 @@ include('./testdatabases.inc.php');
|
|||
|
||||
echo "<br>vers=",ADOConnection::Version();
|
||||
|
||||
|
||||
include_once('../adodb-time.inc.php');
|
||||
adodb_date_test();
|
||||
if (!isset($_GET['nd'])) adodb_date_test();
|
||||
?>
|
||||
<p><i>ADODB Database Library (c) 2000-2004 John Lim. All rights reserved. Released under BSD and LGPL.</i></p>
|
||||
</body>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<body>
|
||||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
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.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
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.
|
||||
|
|
|
@ -63,7 +63,7 @@ if ($insertSQL != $insertSQL2) echo "<p><b>Walt's new stuff failed</b>: $insertS
|
|||
|
||||
$sql = "
|
||||
SELECT *
|
||||
FROM ADOXYZ WHERE lastname=".$conn->qstr($record['lastname']);
|
||||
FROM ADOXYZ WHERE lastname=".$conn->qstr($record['lastname']). " ORDER BY 1";
|
||||
// Select a record to update
|
||||
|
||||
$rs = $conn->Execute($sql); // Execute the query and get the existing record to update
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
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.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<body>
|
||||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
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.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
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.
|
||||
|
@ -57,7 +57,7 @@ if (!empty($testpostgres)) {
|
|||
|
||||
$db = &ADONewConnection('postgres');
|
||||
print "<h1>Connecting $db->databaseType...</h1>";
|
||||
if (@$db->Connect("localhost","tester","test","test")) {
|
||||
if ($db->Connect("localhost","tester","test","test")) {
|
||||
testdb($db,"create table ADOXYZ (id integer, firstname char(24), lastname varchar,created date)");
|
||||
}else
|
||||
print "ERROR: PostgreSQL requires a database called test on server, user tester, password test.<BR>".$db->ErrorMsg();
|
||||
|
@ -80,7 +80,7 @@ if (!empty($testibase)) {
|
|||
//$_GET['nolog'] = true;
|
||||
$db = &ADONewConnection('firebird');
|
||||
print "<h1>Connecting $db->databaseType...</h1>";
|
||||
if (@$db->PConnect("localhost:d:\\firebird\\10\\examples\\employee.gdb", "sysdba", "masterkey", ""))
|
||||
if ($db->PConnect("localhost:d:\\firebird\\10\\examples\\employee.gdb", "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();
|
||||
|
||||
|
@ -91,7 +91,7 @@ if (!empty($testsqlite)) {
|
|||
$db = &ADONewConnection('sqlite');
|
||||
print "<h1>Connecting $db->databaseType...</h1>";
|
||||
|
||||
if (@$db->PConnect("d:\\inetpub\\adodb\\sqlite.db", "", "", ""))
|
||||
if ($db->PConnect("d:\\inetpub\\adodb\\sqlite.db", "", "", ""))
|
||||
testdb($db,"create table ADOXYZ (id int, firstname char(24), lastname char(24),created datetime)");
|
||||
else print "ERROR: SQLite";
|
||||
|
||||
|
@ -101,10 +101,12 @@ if (!empty($testsqlite)) {
|
|||
if (!empty($testaccess)) {
|
||||
$db = &ADONewConnection('access');
|
||||
print "<h1>Connecting $db->databaseType...</h1>";
|
||||
|
||||
$access = 'd:\inetpub\wwwroot\php\NWIND.MDB';
|
||||
$dsn = "nwind";
|
||||
$driver = "Driver={Microsoft Access Driver (*.mdb)};Dbq=d:\inetpub\adodb\northwind.mdb;Uid=Admin;Pwd=;";
|
||||
if (@$db->PConnect($dsn, "", "", ""))
|
||||
$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";
|
||||
|
||||
|
@ -120,7 +122,7 @@ if (!empty($testaccess) && !empty($testado)) { // ADO ACCESS
|
|||
. 'DATA SOURCE=' . $access . ';';
|
||||
//. 'USER ID=;PASSWORD=;';
|
||||
|
||||
if (@$db->PConnect($myDSN, "", "", "")) {
|
||||
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();
|
||||
|
@ -141,11 +143,14 @@ if (!empty($testvfp)) { // ODBC
|
|||
// REQUIRES MySQL server at localhost with database 'test'
|
||||
if (!empty($testmysql)) { // MYSQL
|
||||
|
||||
$db = &ADONewConnection('mysql');
|
||||
print "<h1>Connecting $db->databaseType...</h1>";
|
||||
|
||||
if (PHP_VERSION >= 5 || $HTTP_SERVER_VARS['HTTP_HOST'] == 'localhost') $server = 'localhost';
|
||||
else $server = "mangrove";
|
||||
if ($db->PConnect($server, "root", "", "northwind")) {
|
||||
$user = 'root'; $password = ''; $database = 'northwind';
|
||||
$db = &ADONewConnection("mysql://$user:$password@$server/$database?persist");
|
||||
print "<h1>Connecting $db->databaseType...</h1>";
|
||||
|
||||
if (true || $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)");
|
||||
|
@ -195,12 +200,11 @@ if (!empty($testproxy)){
|
|||
|
||||
ADOLoadCode('oci805');
|
||||
ADOLoadCode("oci8po");
|
||||
if (!empty($testoracle)) {
|
||||
|
||||
$db = ADONewConnection('oci8po');
|
||||
if (!empty($testoracle)) {
|
||||
$dsn = "oci8po://scott:natsoft@panther?persist";
|
||||
$db = ADONewConnection($dsn);
|
||||
print "<h1>Connecting $db->databaseType...</h1>";
|
||||
if ($db->Connect('', "scott", "natsoft",''))
|
||||
//if ($db->PConnect("", "scott", "tiger", "juris.ecosystem.natsoft.com.my"))
|
||||
if (true || $db->Connect('', "scott", "natsoft",''))
|
||||
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();
|
||||
|
||||
|
@ -234,10 +238,9 @@ if (!empty($testmssql)) { // MS SQL Server via ODBC
|
|||
|
||||
print "<h1>Connecting $db->databaseType...</h1>";
|
||||
|
||||
$dsn = "mssql-northwind";
|
||||
$dsn = "Driver={SQL Server};Server=localhost;Database=northwind;";
|
||||
$dsn = "PROVIDER=MSDASQL;Driver={SQL Server};Server=localhost;Database=northwind;";
|
||||
|
||||
if (@$db->PConnect($dsn, "adodb", "natsoft", "")) {
|
||||
if ($db->PConnect($dsn, "adodb", "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";
|
||||
|
@ -256,7 +259,7 @@ if (!empty($testmssql) && !empty($testado) ) { // ADO ACCESS MSSQL -- thru ODBC
|
|||
. "SERVER=tigress;DATABASE=NorthWind;UID=adodb;PWD=natsoft;Trusted_Connection=No" ;
|
||||
|
||||
|
||||
if (@$db->PConnect($myDSN, "", "", ""))
|
||||
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";
|
||||
|
||||
|
@ -270,11 +273,8 @@ if (!empty($testmssql)) { // MS SQL Server -- the extension is buggy -- probably
|
|||
print "<h1>Connecting $db->databaseType...</h1>";
|
||||
|
||||
$ok = $db->PConnect('tigress','adodb','natsoft','northwind');
|
||||
//$rs = $db->Execute("exec sp_ddate");
|
||||
//print_r($rs->fields);
|
||||
//die();
|
||||
|
||||
if ($ok or @$db->PConnect("mangrove", "sa", "natsoft", "ai")) {
|
||||
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)");
|
||||
|
@ -288,7 +288,6 @@ if (!empty($testmssql) && !empty($testado)) { // ADO ACCESS MSSQL with OLEDB pro
|
|||
print "<h1>Connecting DSN-less OLEDB Provider $db->databaseType...</h1>";
|
||||
//$db->debug=1;
|
||||
$myDSN="SERVER=tigress;DATABASE=northwind;Trusted_Connection=yes";
|
||||
//$myDSN='SERVER=(local)\NetSDK;DATABASE=northwind;';
|
||||
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'";
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<body>
|
||||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
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.
|
||||
|
@ -14,7 +14,7 @@ error_reporting(63);
|
|||
include("../adodb.inc.php");
|
||||
include("../tohtml.inc.php");
|
||||
|
||||
if (1) {
|
||||
if (0) {
|
||||
$db = ADONewConnection('oci8po');
|
||||
|
||||
$db->PConnect('','scott','natsoft');
|
||||
|
@ -44,7 +44,7 @@ if (1) {
|
|||
}
|
||||
if (1) {
|
||||
$db = ADONewConnection('oci8');
|
||||
$db->PConnect('','scott','tiger');
|
||||
$db->PConnect('','scott','natsoft');
|
||||
$db->debug = true;
|
||||
$db->Execute("delete from emp where ename='John'");
|
||||
print $db->Affected_Rows().'<BR>';
|
||||
|
@ -53,6 +53,20 @@ if (1) {
|
|||
// prepare not quite ready for prime time
|
||||
//$rs = $db->Execute($stmt,array('empno'=>3775,'ename'=>'John'));
|
||||
if (!$rs) die("Empty RS");
|
||||
|
||||
$db->setfetchmode(ADODB_FETCH_NUM);
|
||||
|
||||
$vv = 'A%';
|
||||
$stmt = $db->PrepareSP("BEGIN adodb.open_tab2(:rs,:tt); END;",true);
|
||||
$db->OutParameter($stmt, $cur, 'rs', -1, OCI_B_CURSOR);
|
||||
$db->OutParameter($stmt, $vv, 'tt');
|
||||
$rs = $db->Execute($stmt);
|
||||
while (!$rs->EOF) {
|
||||
adodb_pr($rs->fields);
|
||||
$rs->MoveNext();
|
||||
}
|
||||
echo " val = $vv";
|
||||
|
||||
}
|
||||
|
||||
if (0) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
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.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
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.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
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.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
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.
|
||||
|
@ -19,12 +19,19 @@ function NotifyExpire($ref,$key)
|
|||
|
||||
|
||||
#### CONNECTION
|
||||
if (1) {
|
||||
$ADODB_SESSION_DRIVER='oci8';
|
||||
$ADODB_SESSION_CONNECT='';
|
||||
$ADODB_SESSION_USER ='scott';
|
||||
$ADODB_SESSION_PWD ='natsoft';
|
||||
$ADODB_SESSION_DB ='';
|
||||
|
||||
} else {
|
||||
$ADODB_SESSION_DRIVER='mysql';
|
||||
$ADODB_SESSION_CONNECT='localhost';
|
||||
$ADODB_SESSION_USER ='root';
|
||||
$ADODB_SESSION_PWD ='';
|
||||
$ADODB_SESSION_DB ='xphplens_2';
|
||||
}
|
||||
|
||||
### TURN DEBUGGING ON
|
||||
$ADODB_SESS_DEBUG = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue