Project

General

Profile

Feature #19807 » 10116.diff

Administrator Admin, 2009-01-13 10:43

View differences:

typo3/sysext/adodb/adodb/tests/test2.php (working copy)
<?php
// This checks for my own IP at home. You can just remove the if-statement.
if (1==0 || ($_SERVER['REMOTE_ADDR']!='127.0.0.1')) {
die('In the source distribution of TYPO3, this script is disabled by a die() function call.<br/><b>Fix:</b> Open this file and remove/out-comment the line that outputs this message!');
}
// BASIC ADO test
......
$access = 'd:\inetpub\wwwroot\php\NWIND.MDB';
$myDSN = 'PROVIDER=Microsoft.Jet.OLEDB.4.0;'
. 'DATA SOURCE=' . $access . ';';
echo "<p>PHP ",PHP_VERSION,"</p>";
$db->Connect($myDSN) || die('fail');
print_r($db->ServerInfo());
try {
$rs = $db->Execute("select $db->sysTimeStamp,* from adoxyz where id>02xx");
print_r($rs->fields);
typo3/sysext/adodb/adodb/tests/test-datadict.php (working copy)
<?php
// This checks for my own IP at home. You can just remove the if-statement.
if (1==0 || ($_SERVER['REMOTE_ADDR']!='127.0.0.1')) {
die('In the source distribution of TYPO3, this script is disabled by a die() function call.<br/><b>Fix:</b> Open this file and remove/out-comment the line that outputs this message!');
}
/*
V4.81 3 May 2006 (c) 2000-2007 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.
Set tabs to 4 for best viewing.
V4.81 3 May 2006 (c) 2000-2007 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.
Set tabs to 4 for best viewing.
*/
......
if (!$dict) continue;
$dict->debug = 1;
$opts = array('REPLACE','mysql' => 'ENGINE=INNODB', 'oci8' => 'TABLESPACE USERS');
/* $flds = array(
array('id', 'I',
array('id', 'I',
'AUTO','KEY'),
array('name' => 'firstname', 'type' => 'varchar','size' => 30,
'DEFAULT'=>'Joan'),
array('lastname','varchar',28,
'DEFAULT'=>'Chen','key'),
array('averylonglongfieldname','X',1024,
'NOTNULL','default' => 'test'),
array('price','N','7.2',
'NOTNULL','default' => '0.00'),
array('MYDATE', 'D',
array('MYDATE', 'D',
'DEFDATE'),
array('TS','T',
'DEFTIMESTAMP')
);*/
$flds = "
ID I AUTO KEY,
FIRSTNAME VARCHAR(30) DEFAULT 'Joan' INDEX idx_name,
......
$sqla = $dict->CreateDatabase('KUTU',array('postgres'=>"LOCATION='/u01/postdata'"));
$dict->SetSchema('KUTU');
$sqli = ($dict->CreateTableSQL('testtable',$flds, $opts));
$sqla = array_merge($sqla,$sqli);
$sqli = $dict->CreateIndexSQL('idx','testtable','price,firstname,lastname',array('BITMAP','FULLTEXT','CLUSTERED','HASH'));
$sqla = array_merge($sqla,$sqli);
$sqli = $dict->CreateIndexSQL('idx2','testtable','price,lastname');//,array('BITMAP','FULLTEXT','CLUSTERED'));
$sqla = array_merge($sqla,$sqli);
$addflds = array(array('height', 'F'),array('weight','F'));
$sqli = $dict->AddColumnSQL('testtable',$addflds);
$sqla = array_merge($sqla,$sqli);
$addflds = array(array('height', 'F','NOTNULL'),array('weight','F','NOTNULL'));
$sqli = $dict->AlterColumnSQL('testtable',$addflds);
$sqla = array_merge($sqla,$sqli);
printsqla($dbType,$sqla);
if (file_exists('d:\inetpub\wwwroot\php\phplens\adodb\adodb.inc.php'))
if ($dbType == 'mysqlt') {
$db->Connect('localhost', "root", "", "test");
......
$sqla2 = $dict->ChangeTableSQL('adoxyz',$flds);
if ($sqla2) printsqla($dbType,$sqla2);
}
if ($dbType == 'odbc_mssql') {
$dsn = $dsn = "PROVIDER=MSDASQL;Driver={SQL Server};Server=localhost;Database=northwind;";
if (@$db->Connect($dsn, "sa", "natsoft", "test"));
......
$sqla2 = $dict->ChangeTableSQL('adoxyz',$flds);
if ($sqla2) printsqla($dbType,$sqla2);
}
adodb_pr($dict->databaseType);
printsqla($dbType, $dict->DropColumnSQL('table',array('my col','`col2_with_Quotes`','A_col3','col3(10)')));
printsqla($dbType, $dict->ChangeTableSQL('adoxyz','LASTNAME varchar(32)'));
}
function printsqla($dbType,$sqla)
......
averylonglongfieldname LONGTEXT NOT NULL,
price NUMERIC(7,2) NOT NULL DEFAULT 0.00,
MYDATE DATE DEFAULT CURDATE(),
PRIMARY KEY (id, lastname)
PRIMARY KEY (id, lastname)
)TYPE=ISAM;
CREATE FULLTEXT INDEX idx ON KUTU.testtable (firstname,lastname);
CREATE INDEX idx2 ON KUTU.testtable (price,lastname);
......
averylonglongfieldname CLOB NOT NULL,
price NUMBER(7,2) DEFAULT 0.00 NOT NULL,
MYDATE DATE DEFAULT TRUNC(SYSDATE),
PRIMARY KEY (id, lastname)
PRIMARY KEY (id, lastname)
)TABLESPACE USERS;
/
DROP SEQUENCE KUTU.SEQ_testtable;
/
CREATE SEQUENCE KUTU.SEQ_testtable;
/
CREATE OR REPLACE TRIGGER KUTU.TRIG_SEQ_testtable BEFORE insert ON KUTU.testtable
CREATE OR REPLACE TRIGGER KUTU.TRIG_SEQ_testtable BEFORE insert ON KUTU.testtable
FOR EACH ROW
BEGIN
select KUTU.SEQ_testtable.nextval into :new.id from dual;
select KUTU.SEQ_testtable.nextval into :new.id from dual;
END;
/
CREATE BITMAP INDEX idx ON KUTU.testtable (firstname,lastname);
......
CREATE INDEX idx2 ON KUTU.testtable (price,lastname);
/
ALTER TABLE testtable ADD (
height NUMBER,
weight NUMBER);
height NUMBER,
weight NUMBER);
/
ALTER TABLE testtable MODIFY(
height NUMBER NOT NULL,
weight NUMBER NOT NULL);
height NUMBER NOT NULL,
weight NUMBER NOT NULL);
/
......
averylonglongfieldname TEXT NOT NULL,
price NUMERIC(7,2) DEFAULT 0.00 NOT NULL,
MYDATE DATE DEFAULT CURRENT_DATE,
PRIMARY KEY (id, lastname)
PRIMARY KEY (id, lastname)
);
CREATE INDEX idx ON KUTU.testtable USING HASH (firstname,lastname);
CREATE INDEX idx2 ON KUTU.testtable (price,lastname);
......
averylonglongfieldname TEXT NOT NULL,
price NUMERIC(7,2) DEFAULT 0.00 NOT NULL,
MYDATE DATETIME DEFAULT GetDate(),
PRIMARY KEY (id, lastname)
PRIMARY KEY (id, lastname)
);
CREATE CLUSTERED INDEX idx ON KUTU.testtable (firstname,lastname);
CREATE INDEX idx2 ON KUTU.testtable (price,lastname);
ALTER TABLE KUTU.testtable ADD
height REAL,
weight REAL;
height REAL,
weight REAL;
ALTER TABLE KUTU.testtable ALTER COLUMN height REAL NOT NULL;
ALTER TABLE KUTU.testtable ALTER COLUMN weight REAL NOT NULL;
typo3/sysext/adodb/adodb/tests/testcache.php (working copy)
<html>
<body>
<?php
/*
// This checks for my own IP at home. You can just remove the if-statement.
if (1==0 || ($_SERVER['REMOTE_ADDR']!='127.0.0.1')) {
die('In the source distribution of TYPO3, this script is disabled by a die() function call.<br/><b>Fix:</b> Open this file and remove/out-comment the line that outputs this message!');
}
/*
V4.80 8 Mar 2006 (c) 2000-2007 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.
Set tabs to 4 for best viewing.
Latest version is available at http://adodb.sourceforge.net
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.
Set tabs to 4 for best viewing.
Latest version is available at http://adodb.sourceforge.net
*/
$ADODB_CACHE_DIR = dirname(tempnam('/tmp',''));
typo3/sysext/adodb/adodb/tests/testpear.php (working copy)
<?php
/*
// This checks for my own IP at home. You can just remove the if-statement.
if (1==0 || ($_SERVER['REMOTE_ADDR']!='127.0.0.1')) {
die('In the source distribution of TYPO3, this script is disabled by a die() function call.<br/><b>Fix:</b> Open this file and remove/out-comment the line that outputs this message!');
}
/*
V4.80 8 Mar 2006 (c) 2000-2007 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.
Set tabs to 4 for best viewing.
Latest version is available at http://adodb.sourceforge.net
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.
Set tabs to 4 for best viewing.
Latest version is available at http://adodb.sourceforge.net
*/
error_reporting(E_ALL);
typo3/sysext/adodb/adodb/tests/test.php (working copy)
<?php
/*
// This checks for my own IP at home. You can just remove the if-statement.
if (1==0 || ($_SERVER['REMOTE_ADDR']!='127.0.0.1')) {
die('In the source distribution of TYPO3, this script is disabled by a die() function call.<br/><b>Fix:</b> Open this file and remove/out-comment the line that outputs this message!');
}
/*
V4.80 8 Mar 2006 (c) 2000-2007 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.
Set tabs to 4 for best viewing.
Latest version is available at http://adodb.sourceforge.net
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.
Set tabs to 4 for best viewing.
Latest version is available at http://adodb.sourceforge.net
*/
......
global $CACHED; $CACHED++;
}
// the table creation code is specific to the database, so we allow the user
// the table creation code is specific to the database, so we allow the user
// to define their own table creation stuff
function testdb(&$db,$createtab="create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)")
......
GLOBAL $ADODB_vers,$ADODB_CACHE_DIR,$ADODB_FETCH_MODE,$ADODB_COUNTRECS;
//adodb_pr($db);
?> <form method=GET>
</p>
<table width=100% ><tr><td bgcolor=beige>&nbsp;</td></tr></table>
</p>
<?php
<?php
$create =false;
/*$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
$rs = $db->Execute('select lastname,firstname,lastname,id from ADOXYZ');
$arr = $rs->GetAssoc();
echo "<pre>";print_r($arr);
die();*/
if (!$db) die("testdb: database not inited");
GLOBAL $EXECS, $CACHED;
$EXECS = 0;
$CACHED = 0;
//$db->Execute("drop table adodb_logsql");
if ((rand()%3) == 0) @$db->Execute("delete from adodb_logsql");
$db->debug=1;
$db->fnExecute = 'CountExecs';
$db->fnCacheExecute = 'CountCachedExecs';
if (empty($_GET['nolog'])) {
echo "<h3>SQL Logging enabled</h3>";
$db->LogSQL();/*
$sql =
"SELECT t1.sid, t1.sid, t1.title, t1.hometext, t1.notes, t1.aid, t1.informant,
t2.url, t2.email, t1.catid, t3.title, t1.topic, t4.topicname, t4.topicimage,
t4.topictext, t1.score, t1.ratings, t1.counter, t1.comments, t1.acomm
FROM `nuke_stories` `t1`, `nuke_authors` `t2`, `nuke_stories_cat` `t3`, `nuke_topics` `t4`
WHERE ((t2.aid=t1.aid) AND (t3.catid=t1.catid) AND (t4.topicid=t1.topic)
AND ((t1.alanguage='german') OR (t1.alanguage='')) AND (t1.ihome='0'))
"SELECT t1.sid, t1.sid, t1.title, t1.hometext, t1.notes, t1.aid, t1.informant,
t2.url, t2.email, t1.catid, t3.title, t1.topic, t4.topicname, t4.topicimage,
t4.topictext, t1.score, t1.ratings, t1.counter, t1.comments, t1.acomm
FROM `nuke_stories` `t1`, `nuke_authors` `t2`, `nuke_stories_cat` `t3`, `nuke_topics` `t4`
WHERE ((t2.aid=t1.aid) AND (t3.catid=t1.catid) AND (t4.topicid=t1.topic)
AND ((t1.alanguage='german') OR (t1.alanguage='')) AND (t1.ihome='0'))
ORDER BY t1.time DESC";
$db->SelectLimit($sql);
echo $db->ErrorMsg();*/
......
$ADODB_CACHE_DIR = dirname(TempNam('/tmp','testadodb'));
$db->debug = false;
//print $db->UnixTimeStamp('2003-7-22 23:00:00');
$phpv = phpversion();
if (defined('ADODB_EXTENSION')) $ext = ' &nbsp; Extension '.ADODB_EXTENSION.' installed';
else $ext = '';
print "<h3>ADODB Version: $ADODB_vers Host: <i>$db->host</i> &nbsp; Database: <i>$db->database</i> &nbsp; PHP: $phpv $ext</h3>";
flush();
if (function_exists('date_default_timezone_set')) date_default_timezone_set('Asia/Kuala_Lumpur');
$arr = $db->ServerInfo();
print_r($arr);
echo E_ALL,' ',E_STRICT, "<br>";
......
echo error_reporting(),'<p>';
flush();
#$db->debug=1;
$tt = $db->Time();
$tt = $db->Time();
if ($tt == 0) echo '<br><b>$db->Time failed</b>';
else echo "<br>db->Time: ".date('d-m-Y H:i:s',$tt);
echo '<br>';
echo "Date=",$db->UserDate('2002-04-07'),'<br>';
print "<i>date1</i> (1969-02-20) = ".$db->DBDate('1969-2-20');
print "<br><i>date1</i> (1999-02-20) = ".$db->DBDate('1999-2-20');
......
print "<br><i>ts2</i> (1999-02-20) = ".$db->DBTimeStamp('1999-2-20');
print "<br><i>ts3</i> (1970-1-2 +/- timezone) = ".$db->DBTimeStamp(24*3600);
print "<br> Fractional TS (1999-2-20 13:40:50.91): ".$db->DBTimeStamp($db->UnixTimeStamp('1999-2-20 13:40:50.91+1'));
$dd = $db->UnixDate('1999-02-20');
$dd = $db->UnixDate('1999-02-20');
print "<br>unixdate</i> 1999-02-20 = ".date('Y-m-d',$dd)."<p>";
print "<br><i>ts4</i> =".($db->UnixTimeStamp("19700101000101")+8*3600);
print "<br><i>ts5</i> =".$db->DBTimeStamp($db->UnixTimeStamp("20040110092123"));
......
$rs=$db->Execute('select * from ADOXYZ order by id');
if($rs === false) $create = true;
else $rs->Close();
//if ($db->databaseType !='vfp') $db->Execute("drop table ADOXYZ");
if ($create) {
if (false && $db->databaseType == 'ibase') {
print "<b>Please create the following table for testing:</b></p>$createtab</p>";
......
echo "<p>Testing Metatypes</p>";
$t = $db->MetaType('varchar');
if ($t != 'C') Err("Bad Metatype for varchar");
$rs = $db->Execute("delete from ADOXYZ"); // some ODBC drivers will fail the drop so we delete
if ($rs) {
if(! $rs->EOF) print "<b>Error: </b>RecordSet returned by Execute('delete...') should show EOF</p>";
......
}
if ($rs) $rs->Close();
flush();
//$db->debug=true;
//$db->debug=true;
print "<p>Testing Commit: ";
$time = $db->DBDate(time());
if (!$db->BeginTrans()) {
......
} else print "<b>Commit failed</b></p>";
}
if ($db->transCnt != 0) Err("Invalid transCnt = $db->transCnt (should be 0)");
/* ROLLBACK */
/* ROLLBACK */
if (!$db->BeginTrans()) print "<p><b>Error in BeginTrans</b>()</p>";
print "<p>Testing Rollback: ";
$db->Execute("insert into ADOXYZ (id,firstname,lastname,created) values (100,'Should Not','Exist (Rollback)',$time)");
......
if ($rs) $rs->Close();
} else
print "<b>Commit failed</b></p>";
$rs = $db->Execute('delete from ADOXYZ where id>50');
if ($rs) $rs->Close();
if ($db->transCnt != 0) Err("Invalid transCnt = $db->transCnt (should be 0)");
}
if (1) {
print "<p>Testing MetaDatabases()</p>";
print_r( $db->MetaDatabases());
......
$a = $db->MetaTables();
if ($a===false) print "<b>MetaTables not supported</b></p>";
else {
print "Array of tables and views: ";
print "Array of tables and views: ";
foreach($a as $v) print " ($v) ";
print '</p>';
}
$a = $db->MetaTables('VIEW');
if ($a===false) print "<b>MetaTables not supported (views)</b></p>";
else {
print "Array of views: ";
print "Array of views: ";
foreach($a as $v) print " ($v) ";
print '</p>';
}
$a = $db->MetaTables(false,false,'aDo%');
if ($a===false) print "<b>MetaTables not supported (mask)</b></p>";
else {
print "Array of ado%: ";
print "Array of ado%: ";
foreach($a as $v) print " ($v) ";
print '</p>';
}
$a = $db->MetaTables('TABLE');
if ($a===false) print "<b>MetaTables not supported</b></p>";
else {
print "Array of tables: ";
print "Array of tables: ";
foreach($a as $v) print " ($v) ";
print '</p>';
}
$db->debug=0;
$rez = $db->MetaColumns("NOSUCHTABLEHERE");
if ($rez !== false) {
......
foreach($a as $v) {print_r($v); echo "<br>";}
echo "</font>";
}
print "<p>Testing MetaIndexes</p>";
$a = $db->MetaIndexes(('ADOXYZ'),true);
if ($a===false) print "<b>MetaIndexes not supported</b></p>";
else {
......
}
$rs = $db->Execute('delete from ADOXYZ');
if ($rs) $rs->Close();
$db->debug = false;
switch ($db->databaseType) {
case 'vfp':
if (0) {
// memo test
$rs = $db->Execute("select data from memo");
......
print_r($arr);
if (!$arr) Err("No MetaForeignKeys");
break;
case 'odbc_mssql':
case 'mssqlpo':
print "<p>Testing Foreign Keys</p>";
......
print_r($arr);
if (!$arr) Err("Bad MetaForeignKeys");
if ($db->databaseType == 'odbc_mssql') break;
case 'mssql':
case 'mssql':
/*
ASSUME Northwind available...
CREATE PROCEDURE SalesByCategory
@CategoryName nvarchar(15), @OrdYear nvarchar(4) = '1998'
AS
IF @OrdYear != '1996' AND @OrdYear != '1997' AND @OrdYear != '1998'
IF @OrdYear != '1996' AND @OrdYear != '1997' AND @OrdYear != '1998'
BEGIN
SELECT @OrdYear = '1998'
END
......
SELECT ProductName,
TotalPurchase=ROUND(SUM(CONVERT(decimal(14,2), OD.Quantity * (1-OD.Discount) * OD.UnitPrice)), 0)
FROM [Order Details] OD, Orders O, Products P, Categories C
WHERE OD.OrderID = O.OrderID
AND OD.ProductID = P.ProductID
WHERE OD.OrderID = O.OrderID
AND OD.ProductID = P.ProductID
AND P.CategoryID = C.CategoryID
AND C.CategoryName = @CategoryName
AND SUBSTRING(CONVERT(nvarchar(22), O.OrderDate, 111), 1, 4) = @OrdYear
......
$cat = 'Dairy Products';
$yr = '1998';
$stmt = $db->PrepareSP('SalesByCategory');
$db->InParameter($stmt,$cat,'CategoryName');
$db->InParameter($stmt,$yr,'OrdYear');
$rs = $db->Execute($stmt);
rs2html($rs);
$cat = 'Grains/Cereals';
$yr = 1998;
$stmt = $db->PrepareSP('SalesByCategory');
$db->InParameter($stmt,$cat,'CategoryName');
$db->InParameter($stmt,$yr,'OrdYear');
$rs = $db->Execute($stmt);
rs2html($rs);
$ADODB_FETCH_MODE = $assoc;
/*
Test out params - works in PHP 4.2.3 and 4.3.3 and 4.3.8 but not 4.3.0:
CREATE PROCEDURE at_date_interval
@days INTEGER,
@start VARCHAR(20) OUT,
@end VARCHAR(20) OUT
AS
BEGIN
set @start = CONVERT(VARCHAR(20), getdate(), 101)
set @end =CONVERT(VARCHAR(20), dateadd(day, @days, getdate()), 101 )
CREATE PROCEDURE at_date_interval
@days INTEGER,
@start VARCHAR(20) OUT,
@end VARCHAR(20) OUT
AS
BEGIN
set @start = CONVERT(VARCHAR(20), getdate(), 101)
set @end =CONVERT(VARCHAR(20), dateadd(day, @days, getdate()), 101 )
END
GO
*/
......
$days = 10;
$begin_date = '';
$end_date = '';
$db->InParameter($stmt,$days,'days', 4, SQLINT4);
$db->OutParameter($stmt,$begin_date,'start', 20, SQLVARCHAR );
$db->OutParameter($stmt,$end_date,'end', 20, SQLVARCHAR );
$db->InParameter($stmt,$days,'days', 4, SQLINT4);
$db->OutParameter($stmt,$begin_date,'start', 20, SQLVARCHAR );
$db->OutParameter($stmt,$end_date,'end', 20, SQLVARCHAR );
$db->Execute($stmt);
if (empty($begin_date) or empty($end_date) or $begin_date == $end_date) {
Err("MSSQL SP Test for OUT Failed");
print "begin=$begin_date end=$end_date<p>";
} else print "(Today +10days) = (begin=$begin_date end=$end_date)<p>";
$db->debug = $saved;
break;
case 'oci8':
case 'oci8':
case 'oci8po':
if (0) {
$t = getmicrotime();
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
......
echo "<p>t = ",getmicrotime() - $t,"</p>";
die();
}
# cleanup
$db->Execute("delete from photos where id=99 or id=1");
$db->Execute("insert into photos (id) values(1)");
$db->Execute("update photos set photo=null,descclob=null where id=1");
$saved = $db->debug;
$db->debug=true;
/*
CREATE TABLE PHOTOS
(
ID NUMBER(16),
PHOTO BLOB,
DESCRIPTION VARCHAR2(4000 BYTE),
DESCCLOB CLOB
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';
}
$sql = "INSERT INTO photos ( ID, photo) ".
"VALUES ( :id, empty_blob() )".
" RETURNING photo INTO :xx";
$blob_data = $s;
$id = 99;
$stmt = $db->PrepareSP($sql);
$stmt = $db->PrepareSP($sql);
$db->InParameter($stmt, $id, 'id');
$blob = $db->InParameter($stmt, $s, 'xx',-1, OCI_B_BLOB);
$db->StartTrans();
$result = $db->Execute($stmt);
$db->CompleteTrans();
$s2= $db->GetOne("select photo from photos where id=99");
echo "<br>---$s2";
if ($s !== $s2) Err("insert blob does not match");
......
$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");
......
$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>";
......
if (!$arr) Err("Bad MetaForeignKeys");
/*
-- TEST PACKAGE
-- "Set scan off" turns off substitution variables.
Set scan off;
-- "Set scan off" turns off substitution variables.
Set scan off;
CREATE OR REPLACE PACKAGE Adodb AS
TYPE TabType IS REF CURSOR RETURN TAB%ROWTYPE;
......
BEGIN
output := 'Cinta Hati '||input;
END;
PROCEDURE data_in(input IN VARCHAR) IS
ignore varchar(1000);
BEGIN
......
print "<h4>Testing Cursor Variables</h4>";
$rs = $db->ExecuteCursor("BEGIN adodb.open_tab(:zz,'A%'); END;",'zz');
if ($rs && !$rs->EOF) {
$v = $db->GetOne("SELECT count(*) FROM tab where tname like 'A%'");
if ($v == $rs->RecordCount()) print "Test 1 RowCount: OK<p>";
......
print "<b>Error in using Cursor Variables 1</b><p>";
}
$rs->Close();
print "<h4>Testing Stored Procedures for oci8</h4>";
$stmt = $db->PrepareSP("BEGIN adodb.data_out(:a1, :a2); END;");
$a1 = 'Malaysia';
//$a2 = ''; # a2 doesn't even need to be defined!
......
} else {
print "<b>Error in using Stored Procedure IN/Out Variables</b><p>";
}
$tname = 'A%';
$stmt = $db->PrepareSP('select * from tab where tname like :tablename');
$db->Parameter($stmt,$tname,'tablename');
$rs = $db->Execute($stmt);
rs2html($rs);
$stmt = $db->PrepareSP("begin adodb.data_in(:a1); end;");
$db->InParameter($stmt,$a1,'a1');
$db->Execute($stmt);
$db->debug = $saved;
break;
default:
break;
}
......
$db->CompleteTrans();
$rs = $db->Execute('select * from ADOXYZ order by id');
if (!$rs || $rs->RecordCount() != 3) Err("Bad bulk insert");
rs2html($rs);
$db->Execute('delete from ADOXYZ');
print "<p>Inserting 50 rows</p>";
for ($i = 0; $i < 5; $i++) {
for ($i = 0; $i < 5; $i++) {
$time = $db->DBDate(time());
if (empty($_GET['hide'])) $db->debug = true;
......
case 'mssqlpo':
case 'mssql':
$sqlt = "CREATE TABLE mytable (
row1 INT IDENTITY(1,1) NOT NULL,
row2 varchar(16),
PRIMARY KEY (row1))";
//$db->debug=1;
if (!$db->Execute("delete from mytable"))
row1 INT IDENTITY(1,1) NOT NULL,
row2 varchar(16),
PRIMARY KEY (row1))";
//$db->debug=1;
if (!$db->Execute("delete from mytable"))
$db->Execute($sqlt);
$ok = $db->Execute("insert into mytable (row2) values ('test')");
$ins_id=$db->Insert_ID();
echo "Insert ID=";var_dump($ins_id);
if ($ins_id == 0) Err("Bad Insert_ID()");
$ins_id2 = $db->GetOne("select row1 from mytable");
if ($ins_id != $ins_id2) Err("Bad Insert_ID() 2");
$arr = array(0=>'Caroline',1=>'Miranda');
$sql = "insert into ADOXYZ (id,firstname,lastname,created) values ($i*10+0,?,?,$time)";
break;
......
case 'mysqlt':
case 'mysql':
$sqlt = "CREATE TABLE `mytable` (
`row1` int(11) NOT NULL auto_increment,
`row2` varchar(16) NOT NULL default '',
PRIMARY KEY (`row1`),
KEY `myindex` (`row1`,`row2`)
`row1` int(11) NOT NULL auto_increment,
`row2` varchar(16) NOT NULL default '',
PRIMARY KEY (`row1`),
KEY `myindex` (`row1`,`row2`)
) ";
if (!$db->Execute("delete from mytable"))
if (!$db->Execute("delete from mytable"))
$db->Execute($sqlt);
$ok = $db->Execute("insert into mytable (row2) values ('test')");
$ins_id=$db->Insert_ID();
echo "Insert ID=";var_dump($ins_id);
if ($ins_id == 0) Err("Bad Insert_ID()");
$ins_id2 = $db->GetOne("select row1 from mytable");
if ($ins_id != $ins_id2) Err("Bad Insert_ID() 2");
default:
$arr = array(0=>'Caroline',1=>'Miranda');
$sql = "insert into ADOXYZ (id,firstname,lastname,created) values ($i*10+0,?,?,$time)";
break;
case 'oci8':
case 'oci805':
$arr = array('first'=>'Caroline','last'=>'Miranda');
$amt = rand() % 100;
$sql = "insert into ADOXYZ (id,firstname,lastname,created) values ($i*10+0,:first,:last,$time)";
$sql = "insert into ADOXYZ (id,firstname,lastname,created) values ($i*10+0,:first,:last,$time)";
break;
}
if ($i & 1) {
$sql = $db->Prepare($sql);
}
$rs = $db->Execute($sql,$arr);
if ($rs === false) Err( 'Error inserting with parameters');
else $rs->Close();
$db->debug = false;
......
$db->debug=1;
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
$cnt = $db->GetOne("select count(*) from ADOXYZ");
$rs = $db->Execute('update ADOXYZ set id=id+1');
$rs = $db->Execute('update ADOXYZ set id=id+1');
if (!is_object($rs)) {
print_r($rs);
err("Update should return object");
}
}
if (!$rs) err("Update generated error");
$nrows = $db->Affected_Rows();
$nrows = $db->Affected_Rows();
if ($nrows === false) print "<p><b>Affected_Rows() not supported</b></p>";
else if ($nrows != $cnt) print "<p><b>Affected_Rows() Error: $nrows returned (should be 50) </b></p>";
else print "<p>Affected_Rows() passed</p>";
}
if ($db->dataProvider == 'oci8') $array = array('zid'=>1,'zdate'=>date('Y-m-d',time()));
else $array=array(1,date('Y-m-d',time()));
#$array = array(1,date('Y-m-d',time()));
$id = $db->GetOne("select id from ADOXYZ
$id = $db->GetOne("select id from ADOXYZ
where id=".$db->Param('zid')." and created>=".$db->Param('ZDATE')."",
$array);
if ($id != 1) Err("Bad bind; id=$id");
else echo "<br>Bind date/integer 1 passed";
$array =array(1,$db->BindDate(time()));
$id = $db->GetOne("select id from ADOXYZ
$id = $db->GetOne("select id from ADOXYZ
where id=".$db->Param('0')." and created>=".$db->Param('1')."",
$array);
if ($id != 1) Err("Bad bind; id=$id");
else echo "<br>Bind date/integer 2 passed";
$db->debug = false;
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
$rs = $db->Execute("select * from ADOXYZ where firstname = 'not known'");
if (!$rs || !$rs->EOF) print "<p><b>Error on empty recordset</b></p>";
else if ($rs->RecordCount() != 0) {
print "<p><b>Error on RecordCount. Should be 0. Was ".$rs->RecordCount()."</b></p>";
print "<p><b>Error on RecordCount. Should be 0. Was ".$rs->RecordCount()."</b></p>";
print_r($rs->fields);
}
if ($db->databaseType !== 'odbc') {
......
else print "<p><b>Error in Execute of SELECT with random</b></p>";
}
$val = $db->GetOne("select count(*) from ADOXYZ");
if ($val == 50) print "<p>GetOne returns ok</p>";
else print "<p><b>Fail: GetOne returns $val</b></p>";
if ($val == 50) print "<p>GetOne returns ok</p>";
else print "<p><b>Fail: GetOne returns $val</b></p>";
echo "<b>GetRow Test</b>";
echo "<b>GetRow Test</b>";
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
$val1 = $db->GetRow("select count(*) from ADOXYZ");
$val2 = $db->GetRow("select count(*) from ADOXYZ");
if ($val1[0] == 50 and sizeof($val1) == 1 and $val2[0] == 50 and sizeof($val2) == 1) print "<p>GetRow returns ok</p>";
else {
print_r($val);
print "<p><b>Fail: GetRow returns {$val2[0]}</b></p>";
if ($val1[0] == 50 and sizeof($val1) == 1 and $val2[0] == 50 and sizeof($val2) == 1) print "<p>GetRow returns ok</p>";
else {
print_r($val);
print "<p><b>Fail: GetRow returns {$val2[0]}</b></p>";
}
print "<p>FetchObject/FetchNextObject Test</p>";
$rs = $db->Execute('select * from ADOXYZ');
if ($rs) {
if (empty($rs->connection)) print "<b>Connection object missing from recordset</b></br>";
while ($o = $rs->FetchNextObject()) { // calls FetchObject internally
if (!is_string($o->FIRSTNAME) || !is_string($o->LASTNAME)) {
print_r($o);
......
}
}
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
$savefetch = $ADODB_FETCH_MODE;
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
print "<p>CacheSelectLimit Test...</p>";
$db->debug=1;
$rs = $db->CacheSelectLimit('select id, firstname from ADOXYZ order by id',2);
if ($rs && !$rs->EOF) {
if (isset($rs->fields[0])) {
Err("ASSOC has numeric fields");
......
}
if ($rs->fields['id'] != 1) {Err("Error"); print_r($rs->fields);};
if (trim($rs->fields['firstname']) != 'Caroline') {print Err("Error 2"); print_r($rs->fields);};
$rs->MoveNext();
if ($rs->fields['id'] != 2) {Err("Error 3"); print_r($rs->fields);};
$rs->MoveNext();
......
print_r($rs);
}
}
print "<p>FETCH_MODE = ASSOC: Should get 1, Caroline</p>";
$rs = $db->SelectLimit('select id,firstname from ADOXYZ order by id',2);
if ($rs && !$rs->EOF) {
......
print_r($rs->fields);
}
}
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
print "<p>FETCH_MODE = NUM: Should get 1, Caroline</p>";
$rs = $db->SelectLimit('select id,firstname from ADOXYZ order by id',1);
......
}
$ADODB_FETCH_MODE = $savefetch;
$db->debug = false;
print "<p>GetRowAssoc Upper: Should get 1, Caroline</p>";
$rs = $db->SelectLimit('select id,firstname from ADOXYZ order by id',1);
......
if (trim($arr['firstname']) != 'Caroline') {Err("Error 2"); print_r($arr);};
}
print "<p>GetCol Test</p>";
$col = $db->GetCol('select distinct firstname from ADOXYZ order by 1');
if (!is_array($col)) Err("Col size is wrong");
if (trim($col[0]) != 'Alan' or trim($col[9]) != 'Yat Sun') Err("Col elements wrong");
$db->debug = true;
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>";
print "<p>SelectLimit Distinct Test 1: Should see Caroline, John and Mary</p>";
$rs = $db->SelectLimit('select distinct * from ADOXYZ order by id',3);
if ($rs && !$rs->EOF) {
if (trim($rs->fields[1]) != 'Caroline') Err("Error 1 (exp Caroline), ".$rs->fields[1]);
$rs->MoveNext();
if (trim($rs->fields[1]) != 'John') Err("Error 2 (exp John), ".$rs->fields[1]);
$rs->MoveNext();
if (trim($rs->fields[1]) != 'Mary') Err("Error 3 (exp Mary),".$rs->fields[1]);
......
if (! $rs->EOF) Err("Error EOF");
//rs2html($rs);
} else Err("Failed SelectLimit Test 1");
print "<p>SelectLimit Test 2: Should see Mary, George and Mr. Alan</p>";
$rs = $db->SelectLimit('select * from ADOXYZ order by id',3,2);
if ($rs && !$rs->EOF) {
......
if (! $rs->EOF) Err("Error EOF");
// rs2html($rs);
}
else Err("Failed SelectLimit Test 2 ". ($rs ? 'EOF':'no RS'));
else Err("Failed SelectLimit Test 2 ". ($rs ? 'EOF':'no RS'));
print "<p>SelectLimit Test 3: Should see Wai Hun and Steven</p>";
$db->debug=1;
global $A; $A=1;
......
}
//rs2html($rs);
}
else Err("Failed SelectLimit Test 3");
else Err("Failed SelectLimit Test 3");
$db->debug = false;
$rs = $db->Execute("select * from ADOXYZ order by id");
print "<p>Testing Move()</p>";
print "<p>Testing Move()</p>";
if (!$rs)Err( "Failed Move SELECT");
else {
if (!$rs->Move(2)) {
......
print "<p><b>$db->databaseType: MoveFirst failed -- probably cannot scroll backwards</b></p>";
}
else print "MoveFirst() OK<BR>";
// Move(3) tests error handling -- MoveFirst should not move cursor
$rs->Move(3);
if (trim($rs->Fields("firstname")) != 'George') {
print '<p>'.$rs->Fields("id")."<b>$db->databaseType: Move(3) failed</b></p>";
} else print "Move(3) OK<BR>";
$rs->Move(7);
if (trim($rs->Fields("firstname")) != 'Yat Sun') {
print '<p>'.$rs->Fields("id")."<b>$db->databaseType: Move(7) failed</b></p>";
......
if ($rs->EOF) Err("Move(7) is EOF already");
$rs->MoveLast();
if (trim($rs->Fields("firstname")) != 'Steven'){
print '<p>'.$rs->Fields("id")."<b>$db->databaseType: MoveLast() failed</b></p>";
print_r($rs);
print '<p>'.$rs->Fields("id")."<b>$db->databaseType: MoveLast() failed</b></p>";
print_r($rs);
}else print "MoveLast() OK<BR>";
$rs->MoveNext();
if (!$rs->EOF) err("Bad MoveNext");
......
$rs->Move(3);
if (trim($rs->Fields("firstname")) != 'George') {
print '<p>'.$rs->Fields("id")."<b>$db->databaseType: Move(3) after MoveLast failed</b></p>";
} else print "Move(3) after MoveLast() OK<BR>";
}
print "<p>Empty Move Test";
$rs = $db->Execute("select * from ADOXYZ where id > 0 and id < 0");
$rs->MoveFirst();
if (!$rs->EOF || $rs->fields) Err("Error in empty move first");
}
}
$rs = $db->Execute('select * from ADOXYZ where id = 2');
if ($rs->EOF || !is_array($rs->fields)) Err("Error in select");
$rs->MoveNext();
if (!$rs->EOF) Err("Error in EOF (xx) ");
// $db->debug=true;
// $db->debug=true;
print "<p>Testing ADODB_FETCH_ASSOC and concat: concat firstname and lastname</p>";
$save = $ADODB_FETCH_MODE;
......
$ADODB_FETCH_MODE = $save;
print "<hr />Testing GetArray() ";
//$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
$rs = $db->Execute("select * from ADOXYZ order by id");
if ($rs) {
$arr = $rs->GetArray(10);
if (sizeof($arr) != 10 || trim($arr[1][1]) != 'John' || trim($arr[1][2]) != 'Lim') print $arr[1][1].' '.$arr[1][2]."<b> &nbsp; ERROR</b><br>";
else print " OK<BR>";
}
$arr = $db->GetArray("select x from ADOXYZ");
$e = $db->ErrorMsg(); $e2 = $db->ErrorNo();
echo "Testing error handling, should see illegal column 'x' error=<i>$e ($e2) </i><br>";
......
$fcnt = 0;
if ($rs)
while ($o = $rs->FetchNextObject()) {
$fcnt += 1;
$fcnt += 1;
}
if ($fcnt == 1) print " OK<BR>";
else print "<b>FAILED</b><BR>";
$stmt = $db->Prepare("select * from ADOXYZ where id < 3");
$rs = $db->Execute($stmt);
if (!$rs) Err("Prepare failed");
......
//print_r($arr);
print "<hr />";
$rs = $db->Execute("select distinct lastname,firstname,created from ADOXYZ");
if ($rs) {
$arr = $rs->GetAssoc();
//print_r($arr);
if (empty($arr['See']) || trim(reset($arr['See'])) != 'Wai Hun') print $arr['See']." &nbsp; <b>ERROR</b><br>";
else print " OK 1";
}
$arr = $db->GetAssoc("select distinct lastname,firstname from ADOXYZ");
if ($arr) {
//print_r($arr);
......
$query = $db->Prepare("select count(*) from ADOXYZ");
$rs = $db->CacheExecute(10,$query);
if (reset($rs->fields) != 50) echo Err("$cnt wrong for Prepare/CacheGetOne");
for ($loop=0; $loop < 1; $loop++) {
print "Testing GetMenu() and CacheExecute<BR>";
$db->debug = true;
$rs = $db->CacheExecute(4,"select distinct firstname,lastname from ADOXYZ");
if ($rs) print 'With blanks, Steven selected:'. $rs->GetMenu('menu','Steven').'<BR>';
if ($rs) print 'With blanks, Steven selected:'. $rs->GetMenu('menu','Steven').'<BR>';
else print " Fail<BR>";
$rs = $db->CacheExecute(4,"select distinct firstname,lastname from ADOXYZ");
if ($rs) print ' No blanks, Steven selected: '. $rs->GetMenu('menu','Steven',false).'<BR>';
else print " Fail<BR>";
$rs = $db->CacheExecute(4,"select distinct firstname,lastname from ADOXYZ");
if ($rs) print ' 1st line set to **** , Steven selected: '. $rs->GetMenu('menu','Steven','1st:****').'<BR>';
else print " Fail<BR>";
$rs = $db->CacheExecute(4,"select distinct firstname,lastname from ADOXYZ");
if ($rs) print ' Multiple, Alan selected: '. $rs->GetMenu('menu','Alan',false,true).'<BR>';
else print " Fail<BR>";
print '</p><hr />';
$rs = $db->CacheExecute(4,"select distinct firstname,lastname from ADOXYZ");
if ($rs) {
print ' Multiple, Alan and George selected: '. $rs->GetMenu('menu',array('Alan','George'),false,true);
if (empty($rs->connection)) print "<b>Connection object missing from recordset</b></br>";
} else print " Fail<BR>";
print '</p><hr />';
print "Testing GetMenu3()<br>";
$rs = $db->Execute("select ".$db->Concat('firstname',"'-'",'id').",id, lastname from ADOXYZ order by lastname,id");
if ($rs) print "Grouped Menu: ".$rs->GetMenu3('name');
......
print "Testing GetMenu2() <BR>";
$rs = $db->CacheExecute(4,"select distinct firstname,lastname from ADOXYZ");
if ($rs) print 'With blanks, Steven selected:'. $rs->GetMenu2('menu',('Oey')).'<BR>';
if ($rs) print 'With blanks, Steven selected:'. $rs->GetMenu2('menu',('Oey')).'<BR>';
else print " Fail<BR>";
$rs = $db->CacheExecute(6,"select distinct firstname,lastname from ADOXYZ");
if ($rs) print ' No blanks, Steven selected: '. $rs->GetMenu2('menu',('Oey'),false).'<BR>';
......
$rs = $db->CacheExecute(6,"select distinct firstname,lastname from ADOXYZ");
print_r($rs->fields); echo $rs->fetchMode;echo "<br>";
echo $rs->Fields('firstname');
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
$rs = $db->CacheExecute(6,"select distinct firstname,lastname from ADOXYZ");
print_r($rs->fields);echo "<br>";
echo $rs->Fields('firstname');
$db->debug = false;
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
// phplens
$sql = 'select * from ADOXYZ where 0=1';
echo "<p>**Testing '$sql' (phplens compat 1)</p>";
$rs = $db->Execute($sql);
if (!$rs) err( "<b>No recordset returned for '$sql'</b>");
if (!$rs->FieldCount()) err( "<b>No fields returned for $sql</b>");
if (!$rs->FetchField(1)) err( "<b>FetchField failed for $sql</b>");
$sql = 'select * from ADOXYZ order by 1';
echo "<p>**Testing '$sql' (phplens compat 2)</p>";
$rs = $db->Execute($sql);
if (!$rs) err( "<b>No recordset returned for '$sql'<br>".$db->ErrorMsg()."</b>");
$sql = 'select * from ADOXYZ order by 1,1';
echo "<p>**Testing '$sql' (phplens compat 3)</p>";
$rs = $db->Execute($sql);
if (!$rs) err( "<b>No recordset returned for '$sql'<br>".$db->ErrorMsg()."</b>");
// Move
$rs1 = $db->Execute("select id from ADOXYZ where id <= 2 order by 1");
$rs2 = $db->Execute("select id from ADOXYZ where id = 3 or id = 4 order by 1");
if ($rs1) $rs1->MoveLast();
if ($rs2) $rs2->MoveLast();
if (empty($rs1) || empty($rs2) || $rs1->fields[0] != 2 || $rs2->fields[0] != 4) {
$a = $rs1->fields[0];
$b = $rs2->fields[0];
print "<p><b>Error in multiple recordset test rs1=$a rs2=$b (should be rs1=2 rs2=4)</b></p>";
} else
print "<p>Testing multiple recordsets OK</p>";
echo "<p> GenID test: ";
for ($i=1; $i <= 10; $i++)
for ($i=1; $i <= 10; $i++)
echo "($i: ",$val = $db->GenID($db->databaseType.'abcseq6' ,5), ") ";
if ($val == 0) Err("GenID not supported");
if ($val) {
$db->DropSequence('abc_seq2');
$db->CreateSequence('abc_seq2');
......
if ($val != 1) Err("Drop and Create Sequence not supported ($val)");
}
echo "<p>";
if (substr($db->dataProvider,0,3) != 'notused') { // used to crash ado
$sql = "select firstnames from ADOXYZ";
print "<p>Testing execution of illegal statement: <i>$sql</i></p>";
if ($db->Execute($sql) === false) {
print "<p>This returns the following ErrorMsg(): <i>".$db->ErrorMsg()."</i> and ErrorNo(): ".$db->ErrorNo().'</p>';
} else
} else
print "<p><b>Error in error handling -- Execute() should return false</b></p>";
} else
} else
print "<p><b>ADO skipped error handling of bad select statement</b></p>";
print "<p>ASSOC TEST 2<br>";
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
$rs = $db->query('select * from ADOXYZ order by id');
......
Err("Error No = $ee");
}
print_r($rs->fields);
for($i=0;$i<$rs->FieldCount();$i++)
{
$fld=$rs->FetchField($i);
print "<br> Field name is ".$fld->name;
print " ".$rs->Fields($fld->name);
}
for($i=0;$i<$rs->FieldCount();$i++)
{
$fld=$rs->FetchField($i);
print "<br> Field name is ".$fld->name;
print " ".$rs->Fields($fld->name);
}
print "<p>BOTH TEST 2<br>";
if ($db->dataProvider == 'ado') {
print "<b>ADODB_FETCH_BOTH not supported</b> for dataProvider=".$db->dataProvider."<br>";
} else {
$ADODB_FETCH_MODE = ADODB_FETCH_BOTH;
$rs = $db->query('select * from ADOXYZ order by id');
for($i=0;$i<$rs->FieldCount();$i++)
{
$fld=$rs->FetchField($i);
print "<br> Field name is ".$fld->name;
print " ".$rs->Fields($fld->name);
}
for($i=0;$i<$rs->FieldCount();$i++)
{
$fld=$rs->FetchField($i);
print "<br> Field name is ".$fld->name;
print " ".$rs->Fields($fld->name);
}
}
print "<p>NUM TEST 2<br>";
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
$rs = $db->query('select * from ADOXYZ order by id');
for($i=0;$i<$rs->FieldCount();$i++)
{
$fld=$rs->FetchField($i);
print "<br> Field name is ".$fld->name;
print " ".$rs->Fields($fld->name);
}
for($i=0;$i<$rs->FieldCount();$i++)
{
$fld=$rs->FetchField($i);
print "<br> Field name is ".$fld->name;
print " ".$rs->Fields($fld->name);
}
print "<p>ASSOC Test of SelectLimit<br>";
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
$rs = $db->selectlimit('select * from ADOXYZ order by id',3,4);
......
$rs->MoveNext();
}
if ($cnt != 3) print "<br><b>Count should be 3, instead it was $cnt</b></p>";
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
if ($db->sysDate) {
$saved = $db->debug;
......
print "<p><b>Invalid date {$rs->fields[0]}</b></p>";
} else
print "<p>Passed \$sysDate test ({$rs->fields[0]})</p>";
print_r($rs->FetchField(0));
print time();
$db->debug=$saved;
......
print "<p>Test CSV</p>";
include_once('../toexport.inc.php');
//$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
$rs = $db->SelectLimit('select id,firstname,lastname,created,\'He, he\' he,\'"\' q from ADOXYZ',10);
$rs = $db->SelectLimit('select id,firstname,lastname,created,\'He, he\' he,\'"\' q from ADOXYZ',10);
print "<pre>";
... This diff was truncated because it exceeds the maximum size that can be displayed.
(2-2/2)