mirror of
https://github.com/moodle/moodle.git
synced 2025-01-21 23:48:45 +01:00
256 lines
12 KiB
PHP
Executable File
256 lines
12 KiB
PHP
Executable File
<?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);
|
|
|
|
echo "<h3>schemaConfig.xml</h3>";
|
|
$rs = $db->Execute('drop table config');
|
|
$rs = $db->Execute('drop sequence SEQ_config');
|
|
$schema = new adoSchema($db);
|
|
$sql = $schema->ParseSchema("schemaConfig.xml");
|
|
$result = $schema->ExecuteSchema( $sql );
|
|
$sql = "insert into config values (2,'2','2')";
|
|
$rs = $db->Execute($sql);
|
|
$sql = "insert into config 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.xml</h3>";
|
|
|
|
$schema = new adoSchema($db);
|
|
$sql = $schema->ParseSchema("schemaCourse.xml");
|
|
$rs = $db->Execute('drop table course');
|
|
$rs = $db->Execute('drop sequence SEQ_course');
|
|
$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,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,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'));
|
|
|
|
echo "<h3>schemaCourse_categories.xml</h3>";
|
|
$rs = $db->Execute('drop table course_categories');
|
|
$rs = $db->Execute('drop sequence SEQ_course_categories');
|
|
$schema = new adoSchema($db);
|
|
$sql = $schema->ParseSchema("schemaCourse_categories.xml");
|
|
$result = $schema->ExecuteSchema( $sql );
|
|
$sql = "insert into Course_categories values (2,'2','2',2,2,2,2,2)";
|
|
$rs = $db->Execute($sql);
|
|
$sql = "insert into Course_categories values (3,'3','3',3,3,3,3,3)";
|
|
$rs = $db->Execute($sql);
|
|
$rs = $db->Execute('select * from Course_categories');
|
|
rs2html($rs,'border=2 cellpadding=3',array('id','name','description','parent','sortorder','coursecount','visible','timemodified'));
|
|
|
|
echo "<h3>schemaCourse_display.xml</h3>";
|
|
$rs = $db->Execute('drop table course_display');
|
|
$rs = $db->Execute('drop sequence SEQ_course_display');
|
|
$schema = new adoSchema($db);
|
|
$sql = $schema->ParseSchema("schemaCourse_display.xml");
|
|
$result = $schema->ExecuteSchema( $sql );
|
|
$sql = "insert into Course_display values (2,2,2,2)";
|
|
$rs = $db->Execute($sql);
|
|
$sql = "insert into Course_display values (3,3,3,3)";
|
|
$rs = $db->Execute($sql);
|
|
$rs = $db->Execute('select * from Course_display');
|
|
rs2html($rs,'border=2 cellpadding=3',array('id','course','userid','display'));
|
|
|
|
echo "<h3>schemaCourse_modules.xml</h3>";
|
|
$rs = $db->Execute('drop table course_modules');
|
|
$rs = $db->Execute('drop sequence SEQ_course_modules');
|
|
$schema = new adoSchema($db);
|
|
$sql = $schema->ParseSchema("schemaCourse_modules.xml");
|
|
$result = $schema->ExecuteSchema( $sql );
|
|
$sql = "insert into Course_modules values (2,2,2,2,2,2,2,2,2,2,2)";
|
|
$rs = $db->Execute($sql);
|
|
$sql = "insert into Course_modules values (3,3,3,3,3,3,3,3,3,3,3)";
|
|
$rs = $db->Execute($sql);
|
|
$rs = $db->Execute('select * from Course_modules');
|
|
rs2html($rs,'border=2 cellpadding=3',array('id','course','module','instance','section','added','deleted','score','indent','visible','groupmode'));
|
|
|
|
echo "<h3>schemaCourse_sections.xml</h3>";
|
|
$rs = $db->Execute('drop table course_sections');
|
|
$rs = $db->Execute('drop sequence SEQ_course_sections');
|
|
$schema = new adoSchema($db);
|
|
$sql = $schema->ParseSchema("schemaCourse_sections.xml");
|
|
$result = $schema->ExecuteSchema( $sql );
|
|
$sql = "insert into Course_sections values (2,2,2,2,2,2)";
|
|
$rs = $db->Execute($sql);
|
|
$sql = "insert into Course_sections values (3,3,3,3,3,3)";
|
|
$rs = $db->Execute($sql);
|
|
$rs = $db->Execute('select * from Course_sections');
|
|
rs2html($rs,'border=2 cellpadding=3',array('id','course','section','summary','sequence','visible'));
|
|
|
|
echo "<h3>schemaEvent.xml</h3>";
|
|
$rs = $db->Execute('drop table event');
|
|
$rs = $db->Execute('drop sequence SEQ_event');
|
|
$schema = new adoSchema($db);
|
|
$sql = $schema->ParseSchema("schemaevent.xml");
|
|
$result = $schema->ExecuteSchema( $sql );
|
|
$sql = "insert into event values (2,2,2,2,2,2,2,2,2,2,2,2)";
|
|
$rs = $db->Execute($sql);
|
|
$sql = "insert into event values (3,3,3,3,3,3,3,3,3,3,3,3)";
|
|
$rs = $db->Execute($sql);
|
|
$rs = $db->Execute('select * from event');
|
|
rs2html($rs,'border=2 cellpadding=3',array('id','name','description','courseid','groupid','userid','modulename','instance','eventtype','timestart','timeduration','timemodified'));
|
|
|
|
echo "<h3>schemaGroups.xml</h3>";
|
|
$rs = $db->Execute('drop table Groups');
|
|
$rs = $db->Execute('drop sequence SEQ_Groups');
|
|
$schema = new adoSchema($db);
|
|
$sql = $schema->ParseSchema("schemaGroups.xml");
|
|
$result = $schema->ExecuteSchema( $sql );
|
|
$sql = "insert into Groups values (2,2,2,2,2,2,2,2)";
|
|
$rs = $db->Execute($sql);
|
|
$sql = "insert into Groups values (3,3,3,3,3,3,3,3)";
|
|
$rs = $db->Execute($sql);
|
|
$rs = $db->Execute('select * from Groups');
|
|
rs2html($rs,'border=2 cellpadding=3',array('id','courseid','name','description','lang','picture','timecreated','timemodified'));
|
|
|
|
echo "<h3>schemaGroups_members.xml</h3>";
|
|
$rs = $db->Execute('drop table Groups_members');
|
|
$rs = $db->Execute('drop sequence SEQ_Groups_members');
|
|
$schema = new adoSchema($db);
|
|
$sql = $schema->ParseSchema("schemaGroups_members.xml");
|
|
$result = $schema->ExecuteSchema( $sql );
|
|
$sql = "insert into Groups_members values (2,2,2,2)";
|
|
$rs = $db->Execute($sql);
|
|
$sql = "insert into Groups_members values (3,3,3,3)";
|
|
$rs = $db->Execute($sql);
|
|
$rs = $db->Execute('select * from Groups_members');
|
|
rs2html($rs,'border=2 cellpadding=3',array('id','courseid','name','description','lang','picture','timecreated','timemodified'));
|
|
|
|
echo "<h3>schemaLog.xml</h3>";
|
|
$rs = $db->Execute('drop table log');
|
|
$rs = $db->Execute('drop sequence SEQ_log');
|
|
$schema = new adoSchema($db);
|
|
$sql = $schema->ParseSchema("schemaLog.xml");
|
|
$result = $schema->ExecuteSchema( $sql );
|
|
$sql = "insert into log values (2,2,2,2,2,2,2,2,2)";
|
|
$rs = $db->Execute($sql);
|
|
$sql = "insert into log values (3,3,3,3,3,3,3,3,3)";
|
|
$rs = $db->Execute($sql);
|
|
$rs = $db->Execute('select * from log');
|
|
rs2html($rs,'border=2 cellpadding=3',array('id','time','userid','ip','course','module','action','url','info'));
|
|
|
|
echo "<h3>schemaLog_display.xml</h3>";
|
|
$rs = $db->Execute('drop table log_display');
|
|
$rs = $db->Execute('drop sequence SEQ_log_display');
|
|
$schema = new adoSchema($db);
|
|
$sql = $schema->ParseSchema("schemalog_display.xml");
|
|
$result = $schema->ExecuteSchema( $sql );
|
|
$sql = "insert into log_display values (2,2,2,2)";
|
|
$rs = $db->Execute($sql);
|
|
$sql = "insert into log_display values (3,3,3,3)";
|
|
$rs = $db->Execute($sql);
|
|
$rs = $db->Execute('select * from log_display');
|
|
rs2html($rs,'border=2 cellpadding=3',array('id','time','userid','ip','course','module','action','url','info'));
|
|
|
|
echo "<h3>schemaModules.xml</h3>";
|
|
$rs = $db->Execute('drop table modules');
|
|
$rs = $db->Execute('drop sequence SEQ_modules');
|
|
$schema = new adoSchema($db);
|
|
$sql = $schema->ParseSchema("schemamodules.xml");
|
|
$result = $schema->ExecuteSchema( $sql );
|
|
$sql = "insert into modules values (2,2,2,2,2,2,2)";
|
|
$rs = $db->Execute($sql);
|
|
$sql = "insert into modules values (3,3,3,3,3,3,3)";
|
|
$rs = $db->Execute($sql);
|
|
$rs = $db->Execute('select * from modules');
|
|
rs2html($rs,'border=2 cellpadding=3',array('id','name','version','cron','lastcron','search','visible'));
|
|
|
|
echo "<h3>schemaScale.xml</h3>";
|
|
$rs = $db->Execute('drop table scale');
|
|
$rs = $db->Execute('drop sequence SEQ_scale');
|
|
$schema = new adoSchema($db);
|
|
$sql = $schema->ParseSchema("schemaScale.xml");
|
|
$result = $schema->ExecuteSchema( $sql );
|
|
$sql = "insert into scale values (2,2,2,2,2,2,2)";
|
|
$rs = $db->Execute($sql);
|
|
$sql = "insert into scale values (3,3,3,3,3,3,3)";
|
|
$rs = $db->Execute($sql);
|
|
$rs = $db->Execute('select * from scale');
|
|
rs2html($rs,'border=2 cellpadding=3',array('id','courseid','userid','name','scale','description','timemodified'));
|
|
|
|
echo "<h3>schemaUser.xml</h3>";
|
|
$rs = $db->Execute('drop table m_user');
|
|
$rs = $db->Execute('drop sequence SEQ_m_user');
|
|
$schema = new adoSchema($db);
|
|
$sql = $schema->ParseSchema("schemaUser.xml");
|
|
$result = $schema->ExecuteSchema( $sql );
|
|
$sql = "insert into m_user 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,2,2,2,2,2,2,2,2)";
|
|
|
|
$rs = $db->Execute($sql);
|
|
$sql = "insert into m_user 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,3,3,3,3,3,3,3,3)";
|
|
$rs = $db->Execute($sql);
|
|
$rs = $db->Execute('select * from m_user');
|
|
rs2html($rs,'border=2 cellpadding=3',array('id','confirmed','deleted','m_username','password','idnumber','firstname','lastname','email','icq','phone1','phone2','institution','department','address','city','country','lang','timezone','firstaccess','lastaccess','lastlogin','currentlogin','lastIP','secret','picture','url','description','mailformat','maildisplay','htmleditor','autosubscribe','timemodified'));
|
|
|
|
echo "<h3>schemaUser_admins.xml</h3>";
|
|
$rs = $db->Execute('drop table user_admins');
|
|
$rs = $db->Execute('drop sequence SEQ_user_admins');
|
|
$schema = new adoSchema($db);
|
|
$sql = $schema->ParseSchema("schemaUser_admins.xml");
|
|
$result = $schema->ExecuteSchema( $sql );
|
|
$sql = "insert into user_admins values (2,2)";
|
|
$rs = $db->Execute($sql);
|
|
$sql = "insert into user_admins values (3,3)";
|
|
$rs = $db->Execute($sql);
|
|
$rs = $db->Execute('select * from user_admins');
|
|
rs2html($rs,'border=2 cellpadding=3',array('id','userid'));
|
|
|
|
echo "<h3>schemaUser_students.xml</h3>";
|
|
$rs = $db->Execute('drop table user_students');
|
|
$rs = $db->Execute('drop sequence SEQ_user_students');
|
|
$schema = new adoSchema($db);
|
|
$sql = $schema->ParseSchema("schemaUser_students.xml");
|
|
$result = $schema->ExecuteSchema( $sql );
|
|
$sql = "insert into user_students values (2,2,2,2,2,2,2)";
|
|
$rs = $db->Execute($sql);
|
|
$sql = "insert into user_students values (3,3,3,3,3,3,3)";
|
|
$rs = $db->Execute($sql);
|
|
$rs = $db->Execute('select * from user_students');
|
|
rs2html($rs,'border=2 cellpadding=3',array('id','userid','course','timestart','timeend','time','timeaccess'));
|
|
|
|
echo "<h3>schemaUser_teachers.xml</h3>";
|
|
$rs = $db->Execute('drop table user_teachers');
|
|
$rs = $db->Execute('drop sequence SEQ_user_teachers');
|
|
$schema = new adoSchema($db);
|
|
$sql = $schema->ParseSchema("schemaUser_teachers.xml");
|
|
$result = $schema->ExecuteSchema( $sql );
|
|
$sql = "insert into user_teachers values (2,2,2,2,2,2,2,2)";
|
|
$rs = $db->Execute($sql);
|
|
$sql = "insert into user_teachers values (3,3,3,3,3,3,3,3)";
|
|
$rs = $db->Execute($sql);
|
|
$rs = $db->Execute('select * from user_teachers');
|
|
rs2html($rs,'border=2 cellpadding=3',array('id','userid','course','authority','role','editall','timemodified','timeaccess'));
|
|
|
|
echo "<h3>schemaUser_coursecreators.xml</h3>";
|
|
$rs = $db->Execute('drop table user_coursecreators');
|
|
$rs = $db->Execute('drop sequence SEQ_user_coursecreators');
|
|
$schema = new adoSchema($db);
|
|
$sql = $schema->ParseSchema("schemaUser_coursecreators.xml");
|
|
$result = $schema->ExecuteSchema( $sql );
|
|
$sql = "insert into user_coursecreators values (2,2)";
|
|
$rs = $db->Execute($sql);
|
|
$sql = "insert into user_coursecreators values (3,3)";
|
|
$rs = $db->Execute($sql);
|
|
$rs = $db->Execute('select * from user_coursecreators');
|
|
rs2html($rs,'border=2 cellpadding=3',array('id','userid'));
|
|
|
|
?>
|