From 8df3db566a3a937b45ebf11adb90d265e6f5e2d4 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sun, 17 Nov 2019 20:45:02 +0100 Subject: initial checking of customized version 1.0rc9 --- vendor/adodb/adodb-php/tests/test-php5.php | 116 +++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 vendor/adodb/adodb-php/tests/test-php5.php (limited to 'vendor/adodb/adodb-php/tests/test-php5.php') diff --git a/vendor/adodb/adodb-php/tests/test-php5.php b/vendor/adodb/adodb-php/tests/test-php5.php new file mode 100644 index 0000000..4fe7ed8 --- /dev/null +++ b/vendor/adodb/adodb-php/tests/test-php5.php @@ -0,0 +1,116 @@ +PHP ".PHP_VERSION."\n"; +try { + +$dbt = 'oci8po'; + +try { +switch($dbt) { +case 'oci8po': + $db = NewADOConnection("oci8po"); + + $db->Connect('localhost','scott','natsoft','sherkhan'); + break; +default: +case 'mysql': + $db = NewADOConnection("mysql"); + $db->Connect('localhost','root','','northwind'); + break; + +case 'mysqli': + $db = NewADOConnection("mysqli://root:@localhost/northwind"); + //$db->Connect('localhost','root','','test'); + break; +} +} catch (exception $e){ + echo "Connect Failed"; + adodb_pr($e); + die(); +} + +$db->debug=1; + +$cnt = $db->GetOne("select count(*) from adoxyz where ?Prepare("select * from adoxyz where ?ErrorMsg(),"\n"; +$rs = $db->Execute($stmt,array(10,20)); + +echo "
Foreach Iterator Test (rand=".rand().")
"; +$i = 0; +foreach($rs as $v) { + $i += 1; + echo "rec $i: "; $s1 = adodb_pr($v,true); $s2 = adodb_pr($rs->fields,true); + if ($s1 != $s2 && !empty($v)) {adodb_pr($s1); adodb_pr($s2);} + else echo "passed
"; + flush(); +} + +$rs = new ADORecordSet_empty(); +foreach($rs as $v) { + echo "

empty ";var_dump($v); +} + + +if ($i != $cnt) die("actual cnt is $i, cnt should be $cnt\n"); +else echo "Count $i is correct
"; + +$rs = $db->Execute("select bad from badder"); + +} catch (exception $e) { + adodb_pr($e); + echo "

adodb_backtrace:

\n"; + $e = adodb_backtrace($e->gettrace()); +} + +$rs = $db->Execute("select distinct id, firstname,lastname from adoxyz order by id"); +echo "Result=\n",$rs,"

"; + +echo "

Active Record

"; + + include_once("../adodb-active-record.inc.php"); + ADOdb_Active_Record::SetDatabaseAdapter($db); + +try { + class City extends ADOdb_Active_Record{}; + $a = new City(); + +} catch(exception $e){ + echo $e->getMessage(); +} + +try { + + $a = new City(); + + echo "

Successfully created City()
"; + #var_dump($a->GetPrimaryKeys()); + $a->city = 'Kuala Lumpur'; + $a->Save(); + $a->Update(); + #$a->SetPrimaryKeys(array('city')); + $a->country = "M'sia"; + $a->save(); + $a->Delete(); +} catch(exception $e){ + echo $e->getMessage(); +} + +//include_once("test-active-record.php"); -- cgit v1.2.3-54-g00ecf