source: Dev/trunk/rdfapi/util/adodb/tests/test-active-recs2.php @ 12

Last change on this file since 12 was 12, checked in by basvannuland, 14 years ago

Added RAP RDF API
Added RDF reader writer for save and load survey

File size: 1.5 KB
Line 
1<?php
2error_reporting(E_ALL);
3include('../adodb.inc.php');
4
5include('../adodb-active-record.inc.php');
6
7###########################
8
9$ADODB_ACTIVE_CACHESECS = 36;
10
11$DBMS = @$_GET['db'];
12if ($DBMS == 'mysql') {
13        $db = NewADOConnection('mysql://root@localhost/northwind');
14} else if ($DBMS == 'postgres') {
15        $db = NewADOConnection('postgres');
16        $db->Connect("localhost","tester","test","test");
17} else
18        $db = NewADOConnection('oci8://scott:natsoft@/');
19
20
21$arr = $db->ServerInfo();
22echo "<h3>$db->dataProvider: {$arr['description']}</h3>";
23
24$arr = $db->GetActiveRecords('products',' productid<10');
25adodb_pr($arr);
26
27ADOdb_Active_Record::SetDatabaseAdapter($db);
28if  (!$db)  die('failed');
29
30
31
32
33$rec = new ADODB_Active_Record('photos');
34
35$rec = new ADODB_Active_Record('products');
36
37
38adodb_pr($rec->getAttributeNames());
39
40echo "<hr>";
41
42
43$rec->load('productid=2');
44adodb_pr($rec);
45
46$db->debug=1;
47
48
49$rec->productname = 'Changie Chan'.rand();
50
51$rec->insert();
52$rec->update();
53
54$rec->productname = 'Changie Chan 99';
55$rec->replace();
56
57
58$rec2 = new ADODB_Active_Record('products');
59$rec->load('productid=3');
60$rec->save();
61
62$rec = new ADODB_Active_record('products');
63$rec->productname = 'John ActiveRec';
64$rec->notes = 22;
65#$rec->productid=0;
66$rec->discontinued=1;
67$rec->Save();
68$rec->supplierid=33;
69$rec->Save();
70$rec->discontinued=0;
71$rec->Save();
72$rec->Delete();
73
74echo "<p>Affected Rows after delete=".$db->Affected_Rows()."</p>";
75?>
Note: See TracBrowser for help on using the repository browser.