]> git.mjollnir.org Git - moodle.git/commitdiff
Initial add...just the first two tables, config and course.
authorles_kopari <les_kopari>
Thu, 1 Jan 2004 19:38:51 +0000 (19:38 +0000)
committerles_kopari <les_kopari>
Thu, 1 Jan 2004 19:38:51 +0000 (19:38 +0000)
lib/db/schema.php [new file with mode: 0755]

diff --git a/lib/db/schema.php b/lib/db/schema.php
new file mode 100755 (executable)
index 0000000..4ba374f
--- /dev/null
@@ -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'));
+?>