Report lines after a matching question in screen display and Excel fixed.
[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);
0253cd4e 19
20echo "<h3>schemaConfig.xml</h3>";
18eaa5d2 21$rs = $db->Execute('drop table config');
22$rs = $db->Execute('drop sequence SEQ_config');
18eaa5d2 23$schema = new adoSchema($db);
24$sql = $schema->ParseSchema("schemaConfig.xml");
25$result = $schema->ExecuteSchema( $sql );
0253cd4e 26$sql = "insert into config values (2,'2','2')";
18eaa5d2 27$rs = $db->Execute($sql);
0253cd4e 28$sql = "insert into config values (3,'3','3')";
18eaa5d2 29$rs = $db->Execute($sql);
30$rs = $db->Execute('select * from config');
31rs2html($rs,'border=2 cellpadding=3',array('id','name','value'));
0253cd4e 32echo "<h3>schemaCourse.xml</h3>";
33
18eaa5d2 34$schema = new adoSchema($db);
35$sql = $schema->ParseSchema("schemaCourse.xml");
0253cd4e 36$rs = $db->Execute('drop table course');
37$rs = $db->Execute('drop sequence SEQ_course');
18eaa5d2 38$result = $schema->ExecuteSchema( $sql );
39$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)";
40$rs = $db->Execute($sql);
41$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)";
42$rs = $db->Execute($sql);
43$rs = $db->Execute('select * from course');
44rs2html($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'));
0253cd4e 45
46echo "<h3>schemaCourse_categories.xml</h3>";
47$rs = $db->Execute('drop table course_categories');
48$rs = $db->Execute('drop sequence SEQ_course_categories');
49$schema = new adoSchema($db);
50$sql = $schema->ParseSchema("schemaCourse_categories.xml");
51$result = $schema->ExecuteSchema( $sql );
52$sql = "insert into Course_categories values (2,'2','2',2,2,2,2,2)";
53$rs = $db->Execute($sql);
54$sql = "insert into Course_categories values (3,'3','3',3,3,3,3,3)";
55$rs = $db->Execute($sql);
56$rs = $db->Execute('select * from Course_categories');
57rs2html($rs,'border=2 cellpadding=3',array('id','name','description','parent','sortorder','coursecount','visible','timemodified'));
58
59echo "<h3>schemaCourse_display.xml</h3>";
60$rs = $db->Execute('drop table course_display');
61$rs = $db->Execute('drop sequence SEQ_course_display');
62$schema = new adoSchema($db);
63$sql = $schema->ParseSchema("schemaCourse_display.xml");
64$result = $schema->ExecuteSchema( $sql );
65$sql = "insert into Course_display values (2,2,2,2)";
66$rs = $db->Execute($sql);
67$sql = "insert into Course_display values (3,3,3,3)";
68$rs = $db->Execute($sql);
69$rs = $db->Execute('select * from Course_display');
70rs2html($rs,'border=2 cellpadding=3',array('id','course','userid','display'));
71
72echo "<h3>schemaCourse_modules.xml</h3>";
73$rs = $db->Execute('drop table course_modules');
74$rs = $db->Execute('drop sequence SEQ_course_modules');
75$schema = new adoSchema($db);
76$sql = $schema->ParseSchema("schemaCourse_modules.xml");
77$result = $schema->ExecuteSchema( $sql );
78$sql = "insert into Course_modules values (2,2,2,2,2,2,2,2,2,2)";
79$rs = $db->Execute($sql);
80$sql = "insert into Course_modules values (3,3,3,3,3,3,3,3,3,3)";
81$rs = $db->Execute($sql);
82$rs = $db->Execute('select * from Course_modules');
83rs2html($rs,'border=2 cellpadding=3',array('id','course','module','instance','section','added','deleted','score','indent','visible'));
84
85echo "<h3>schemaCourse_sections.xml</h3>";
86$rs = $db->Execute('drop table course_sections');
87$rs = $db->Execute('drop sequence SEQ_course_sections');
88$schema = new adoSchema($db);
89$sql = $schema->ParseSchema("schemaCourse_sections.xml");
90$result = $schema->ExecuteSchema( $sql );
91$sql = "insert into Course_sections values (2,2,2,2,2,2)";
92$rs = $db->Execute($sql);
93$sql = "insert into Course_sections values (3,3,3,3,3,3)";
94$rs = $db->Execute($sql);
95$rs = $db->Execute('select * from Course_sections');
96rs2html($rs,'border=2 cellpadding=3',array('id','course','section','summary','sequence','visible'));
97
98echo "<h3>schemaCourse_groups.xml</h3>";
99$rs = $db->Execute('drop table course_groups');
100$rs = $db->Execute('drop sequence SEQ_course_groups');
101$schema = new adoSchema($db);
102$sql = $schema->ParseSchema("schemaCourse_groups.xml");
103$result = $schema->ExecuteSchema( $sql );
104$sql = "insert into Course_groups values (2,2,2,2,2,2,2,2)";
105$rs = $db->Execute($sql);
106$sql = "insert into Course_groups values (3,3,3,3,3,3,3,3)";
107$rs = $db->Execute($sql);
108$rs = $db->Execute('select * from Course_groups');
109rs2html($rs,'border=2 cellpadding=3',array('id','courseid','name','description','lang','picture','timecreated','timemodified'));
110
111echo "<h3>schemaCourse_groups_members.xml</h3>";
112$rs = $db->Execute('drop table course_groups_members');
113$rs = $db->Execute('drop sequence SEQ_course_groups_members');
114$schema = new adoSchema($db);
115$sql = $schema->ParseSchema("schemaCourse_groups_members.xml");
116$result = $schema->ExecuteSchema( $sql );
117$sql = "insert into Course_groups_members values (2,2,2,2)";
118$rs = $db->Execute($sql);
119$sql = "insert into Course_groups_members values (3,3,3,3)";
120$rs = $db->Execute($sql);
121$rs = $db->Execute('select * from Course_groups_members');
122rs2html($rs,'border=2 cellpadding=3',array('id','courseid','name','description','lang','picture','timecreated','timemodified'));
123
124echo "<h3>schemaLog.xml</h3>";
125$rs = $db->Execute('drop table log');
126$rs = $db->Execute('drop sequence SEQ_log');
127$schema = new adoSchema($db);
128$sql = $schema->ParseSchema("schemaLog.xml");
129$result = $schema->ExecuteSchema( $sql );
130$sql = "insert into log values (2,2,2,2,2,2,2,2,2)";
131$rs = $db->Execute($sql);
132$sql = "insert into log values (3,3,3,3,3,3,3,3,3)";
133$rs = $db->Execute($sql);
134$rs = $db->Execute('select * from log');
135rs2html($rs,'border=2 cellpadding=3',array('id','time','userid','ip','course','module','action','url','info'));
136
137echo "<h3>schemaLog_display.xml</h3>";
138$rs = $db->Execute('drop table log_display');
139$rs = $db->Execute('drop sequence SEQ_log_display');
140$schema = new adoSchema($db);
141$sql = $schema->ParseSchema("schemalog_display.xml");
142$result = $schema->ExecuteSchema( $sql );
143$sql = "insert into log_display values (2,2,2,2)";
144$rs = $db->Execute($sql);
145$sql = "insert into log_display values (3,3,3,3)";
146$rs = $db->Execute($sql);
147$rs = $db->Execute('select * from log_display');
148rs2html($rs,'border=2 cellpadding=3',array('id','time','userid','ip','course','module','action','url','info'));
149
150echo "<h3>schemaModules.xml</h3>";
151$rs = $db->Execute('drop table modules');
152$rs = $db->Execute('drop sequence SEQ_modules');
153$schema = new adoSchema($db);
154$sql = $schema->ParseSchema("schemamodules.xml");
155$result = $schema->ExecuteSchema( $sql );
156$sql = "insert into modules values (2,2,2,2,2,2,2)";
157$rs = $db->Execute($sql);
158$sql = "insert into modules values (3,3,3,3,3,3,3)";
159$rs = $db->Execute($sql);
160$rs = $db->Execute('select * from modules');
161rs2html($rs,'border=2 cellpadding=3',array('id','name','version','cron','lastcron','search','visible'));
162
163echo "<h3>schemaScale.xml</h3>";
164$rs = $db->Execute('drop table scale');
165$rs = $db->Execute('drop sequence SEQ_scale');
166$schema = new adoSchema($db);
167$sql = $schema->ParseSchema("schemaScale.xml");
168$result = $schema->ExecuteSchema( $sql );
169$sql = "insert into scale values (2,2,2,2,2,2,2)";
170$rs = $db->Execute($sql);
171$sql = "insert into scale values (3,3,3,3,3,3,3)";
172$rs = $db->Execute($sql);
173$rs = $db->Execute('select * from scale');
174rs2html($rs,'border=2 cellpadding=3',array('id','courseid','userid','name','scale','description','timemodified'));
175
176echo "<h3>schemaUser.xml</h3>";
177$rs = $db->Execute('drop table m_user');
178$rs = $db->Execute('drop sequence SEQ_m_user');
179$schema = new adoSchema($db);
180$sql = $schema->ParseSchema("schemaUser.xml");
181$result = $schema->ExecuteSchema( $sql );
182$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)";
183
184$rs = $db->Execute($sql);
185$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)";
186$rs = $db->Execute($sql);
187$rs = $db->Execute('select * from m_user');
188rs2html($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'));
189
190
191echo "<h3>schemaUser_admins.xml</h3>";
192$rs = $db->Execute('drop table user_admins');
193$rs = $db->Execute('drop sequence SEQ_user_admins');
194$schema = new adoSchema($db);
195$sql = $schema->ParseSchema("schemaUser_admins.xml");
196$result = $schema->ExecuteSchema( $sql );
197$sql = "insert into user_admins values (2,2)";
198
199$rs = $db->Execute($sql);
200$sql = "insert into user_admins values (3,3)";
201$rs = $db->Execute($sql);
202$rs = $db->Execute('select * from user_admins');
203rs2html($rs,'border=2 cellpadding=3',array('id','userid'));
204
18eaa5d2 205?>