Initial add...just the first two tables, config and course.
[moodle.git] / lib / db / schema.php
CommitLineData
18eaa5d2 1<?php
2echo "<h2>Moodle lib/db ADODB XML Schema</h2>";
3include_once('tohtml.inc.php');
4include_once('adodb.inc.php');
5include_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');
14print "<pre>";
15print_r($rs->GetRows());
16print "</pre>";
17rs2html($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');
23echo "<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');
32rs2html($rs,'border=2 cellpadding=3',array('id','name','value'));
33echo "<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');
42rs2html($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?>