From: les_kopari Date: Thu, 1 Jan 2004 19:38:51 +0000 (+0000) Subject: Initial add...just the first two tables, config and course. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=18eaa5d2cac94188fc8ae9226215dff4c47aaf7a;p=moodle.git Initial add...just the first two tables, config and course. --- diff --git a/lib/db/schema.php b/lib/db/schema.php new file mode 100755 index 0000000000..4ba374fc8b --- /dev/null +++ b/lib/db/schema.php @@ -0,0 +1,43 @@ +Moodle lib/db ADODB XML Schema"; +include_once('tohtml.inc.php'); +include_once('adodb.inc.php'); +include_once('adodb-xmlschema.inc.php'); +$database = "oci8po"; +$db = ADONewConnection("$database"); +$db->debug = true; +$server = "false"; +$user = "scott"; +$password = "tiger"; +$db->Connect(false, $user, $password); +$rs = $db->Execute('select * from dept'); +print "
"; 
+print_r($rs->GetRows()); 
+print "
"; +rs2html($rs,'border=2 cellpadding=3',array('Deptno','DName','Loc')); +$dict = NewDataDictionary($db); +$rs = $db->Execute('drop table config'); +$rs = $db->Execute('drop sequence SEQ_config'); +$rs = $db->Execute('drop table course'); +$rs = $db->Execute('drop sequence SEQ_course'); +echo "

schemaConfig

"; +$schema = new adoSchema($db); +$sql = $schema->ParseSchema("schemaConfig.xml"); +$result = $schema->ExecuteSchema( $sql ); +$sql = "insert into config(id,name,value) values (2,'2','2')"; +$rs = $db->Execute($sql); +$sql = "insert into config(id,name,value) values (3,'3','3')"; +$rs = $db->Execute($sql); +$rs = $db->Execute('select * from config'); +rs2html($rs,'border=2 cellpadding=3',array('id','name','value')); +echo "

schemaCourse

"; +$schema = new adoSchema($db); +$sql = $schema->ParseSchema("schemaCourse.xml"); +$result = $schema->ExecuteSchema( $sql ); +$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)"; +$rs = $db->Execute($sql); +$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)"; +$rs = $db->Execute($sql); +$rs = $db->Execute('select * from course'); +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')); +?>