Permalink
Browse files

Initial add...just the first two tables, config and course.

  • Loading branch information...
1 parent 431744a commit 18eaa5d2cac94188fc8ae9226215dff4c47aaf7a les_kopari committed Jan 1, 2004
Showing with 43 additions and 0 deletions.
  1. +43 −0 lib/db/schema.php
View
@@ -0,0 +1,43 @@
+<?php
+echo "<h2>Moodle lib/db ADODB XML Schema</h2>";
+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 "<pre>";
+print_r($rs->GetRows());
+print "</pre>";
+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 "<h3>schemaConfig</h3>";
+$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 "<h3>schemaCourse</h3>";
+$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'));
+?>

0 comments on commit 18eaa5d

Please sign in to comment.