Initial add...just the first two tables, config and course.
[moodle.git] / lib / db / schema.php
1 <?php 
2 echo "<h2>Moodle lib/db ADODB XML Schema</h2>";
3 include_once('tohtml.inc.php'); 
4 include_once('adodb.inc.php'); 
5 include_once('adodb-xmlschema.inc.php'); 
6 $database = "oci8po";
7 $db = ADONewConnection("$database"); 
8 $db->debug = true;
9 $server = "false";
10 $user = "scott";
11 $password = "tiger";
12 $db->Connect(false, $user, $password); 
13 $rs = $db->Execute('select * from dept'); 
14 print "<pre>"; 
15 print_r($rs->GetRows()); 
16 print "</pre>"; 
17 rs2html($rs,'border=2 cellpadding=3',array('Deptno','DName','Loc'));
18 $dict = NewDataDictionary($db);
19 $rs = $db->Execute('drop table config');
20 $rs = $db->Execute('drop sequence SEQ_config');
21 $rs = $db->Execute('drop table course');
22 $rs = $db->Execute('drop sequence SEQ_course');
23 echo "<h3>schemaConfig</h3>";
24 $schema = new adoSchema($db);
25 $sql = $schema->ParseSchema("schemaConfig.xml");
26 $result = $schema->ExecuteSchema( $sql );
27 $sql = "insert into config(id,name,value) values (2,'2','2')";
28 $rs = $db->Execute($sql);
29 $sql = "insert into config(id,name,value) values (3,'3','3')";
30 $rs = $db->Execute($sql);
31 $rs = $db->Execute('select * from config');
32 rs2html($rs,'border=2 cellpadding=3',array('id','name','value'));
33 echo "<h3>schemaCourse</h3>";
34 $schema = new adoSchema($db);
35 $sql = $schema->ParseSchema("schemaCourse.xml");
36 $result = $schema->ExecuteSchema( $sql );
37 $sql = "insert into course values (2,2,2,'2','2','2','2','2',2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2)";
38 $rs = $db->Execute($sql);
39 $sql = "insert into course values (3,3,3,'3','3','3','3','3',3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3)";
40 $rs = $db->Execute($sql);
41 $rs = $db->Execute('select * from course');
42 rs2html($rs,'border=2 cellpadding=3',array('id','category','sortorder','password','fullname','shortname','summary','format','showgrades','modinfo','newsitems','teacher','teachers','student','students','guest','startdate','numsections','showrecent','marker','maxbytes','showreports','visible','timecreated','timemodified'));
43 ?>