PHP ".PHP_VERSION."\n"; try { $dbt = 'mysql'; try { switch($dbt) { case 'oci8po': $db = NewADOConnection("oci8po"); $db->Connect('','scott','natsoft'); 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(); } 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

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