Documentation TYPO3 par Ameos

test-active-recs2.php

00001 <?php
00002 error_reporting(E_ALL);
00003 include('../adodb.inc.php');
00004 
00005 include('../adodb-active-record.inc.php');
00006 
00007 ###########################
00008 
00009 
00010 
00011 $DBMS = @$_GET['db'];
00012 if ($DBMS == 'mysql') {
00013         $db = NewADOConnection('mysql://root@localhost/northwind');
00014 } else if ($DBMS == 'postgres') {
00015         $db = NewADOConnection('postgres');
00016         $db->Connect("localhost","tester","test","test");
00017 } else
00018         $db = NewADOConnection('oci8://scott:natsoft@/');
00019 
00020 
00021 $arr = $db->ServerInfo();
00022 echo "<h3>$db->dataProvider: {$arr['description']}</h3>";
00023 
00024 $arr = $db->GetActiveRecords('products',' productid<10');
00025 adodb_pr($arr);
00026 
00027 ADOdb_Active_Record::SetDatabaseAdapter($db);
00028 if  (!$db)  die('failed');
00029 
00030 
00031 
00032 $rec = new ADODB_Active_Record('photos');
00033 
00034 $rec = new ADODB_Active_Record('products');
00035 
00036 adodb_pr($rec->getAttributeNames());
00037 
00038 echo "<hr>";
00039 
00040 
00041 $rec->load('productid=2');
00042 adodb_pr($rec);
00043 
00044 $db->debug=1;
00045 
00046 
00047 $rec->productname = 'Changie Chan'.rand();
00048 
00049 $rec->insert();
00050 $rec->update();
00051 
00052 $rec->productname = 'Changie Chan 99';
00053 $rec->replace();
00054 
00055 
00056 $rec2 = new ADODB_Active_Record('products');
00057 $rec->load('productid=3');
00058 $rec->save();
00059 
00060 $rec = new ADODB_Active_record('products');
00061 $rec->productname = 'John ActiveRec';
00062 $rec->productid=0;
00063 $rec->discontinued=1;
00064 $rec->Save();
00065 $rec->supplierid=33;
00066 $rec->Save();
00067 $rec->Delete();
00068 
00069 echo "<p>Affected Rows after delete=".$db->Affected_Rows()."</p>";
00070 ?>


Généré par Les spécialistes TYPO3 avec  doxygen 1.4.6