Some blank index.html files to prevent browsing
[moodle.git] / lib / db / schema.php
1 <?php 
2 echo "<h2>Moodle lib/db ADODB XML Schema</h2>";
3 include_once('tohtml.inc.php'); 
4 include_once('adodb.inc.php'); 
5 include_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'); 
14 print "<pre>"; 
15 print_r($rs->GetRows()); 
16 print "</pre>"; 
17 rs2html($rs,'border=2 cellpadding=3',array('Deptno','DName','Loc'));
18 $dict = NewDataDictionary($db);
20 echo "<h3>schemaConfig.xml</h3>";
21 $rs = $db->Execute('drop table config');
22 $rs = $db->Execute('drop sequence SEQ_config');
23 $schema = new adoSchema($db);
24 $sql = $schema->ParseSchema("schemaConfig.xml");
25 $result = $schema->ExecuteSchema( $sql );
26 $sql = "insert into config values (2,'2','2')";
27 $rs = $db->Execute($sql);
28 $sql = "insert into config values (3,'3','3')";
29 $rs = $db->Execute($sql);
30 $rs = $db->Execute('select * from config');
31 rs2html($rs,'border=2 cellpadding=3',array('id','name','value'));
32 echo "<h3>schemaCourse.xml</h3>";
34 $schema = new adoSchema($db);
35 $sql = $schema->ParseSchema("schemaCourse.xml");
36 $rs = $db->Execute('drop table course');
37 $rs = $db->Execute('drop sequence SEQ_course');
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,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,3,3)";
42 $rs = $db->Execute($sql);
43 $rs = $db->Execute('select * from course');
44 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'));
46 echo "<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');
57 rs2html($rs,'border=2 cellpadding=3',array('id','name','description','parent','sortorder','coursecount','visible','timemodified'));
59 echo "<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');
70 rs2html($rs,'border=2 cellpadding=3',array('id','course','userid','display'));
72 echo "<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,2)";
79 $rs = $db->Execute($sql);
80 $sql = "insert into Course_modules values (3,3,3,3,3,3,3,3,3,3,3)";
81 $rs = $db->Execute($sql);
82 $rs = $db->Execute('select * from Course_modules');
83 rs2html($rs,'border=2 cellpadding=3',array('id','course','module','instance','section','added','deleted','score','indent','visible','groupmode'));
85 echo "<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');
96 rs2html($rs,'border=2 cellpadding=3',array('id','course','section','summary','sequence','visible'));
98 echo "<h3>schemaEvent.xml</h3>";
99 $rs = $db->Execute('drop table event');
100 $rs = $db->Execute('drop sequence SEQ_event');
101 $schema = new adoSchema($db);
102 $sql = $schema->ParseSchema("schemaevent.xml");
103 $result = $schema->ExecuteSchema( $sql );
104 $sql = "insert into event values (2,2,2,2,2,2,2,2,2,2,2,2)";
105 $rs = $db->Execute($sql);
106 $sql = "insert into event values (3,3,3,3,3,3,3,3,3,3,3,3)";
107 $rs = $db->Execute($sql);
108 $rs = $db->Execute('select * from event');
109 rs2html($rs,'border=2 cellpadding=3',array('id','name','description','courseid','groupid','userid','modulename','instance','eventtype','timestart','timeduration','timemodified'));
111 echo "<h3>schemaGroups.xml</h3>";
112 $rs = $db->Execute('drop table Groups');
113 $rs = $db->Execute('drop sequence SEQ_Groups');
114 $schema = new adoSchema($db);
115 $sql = $schema->ParseSchema("schemaGroups.xml");
116 $result = $schema->ExecuteSchema( $sql );
117 $sql = "insert into Groups values (2,2,2,2,2,2,2,2)";
118 $rs = $db->Execute($sql);
119 $sql = "insert into Groups values (3,3,3,3,3,3,3,3)";
120 $rs = $db->Execute($sql);
121 $rs = $db->Execute('select * from Groups');
122 rs2html($rs,'border=2 cellpadding=3',array('id','courseid','name','description','lang','picture','timecreated','timemodified'));
124 echo "<h3>schemaGroups_members.xml</h3>";
125 $rs = $db->Execute('drop table Groups_members');
126 $rs = $db->Execute('drop sequence SEQ_Groups_members');
127 $schema = new adoSchema($db);
128 $sql = $schema->ParseSchema("schemaGroups_members.xml");
129 $result = $schema->ExecuteSchema( $sql );
130 $sql = "insert into Groups_members values (2,2,2,2)";
131 $rs = $db->Execute($sql);
132 $sql = "insert into Groups_members values (3,3,3,3)";
133 $rs = $db->Execute($sql);
134 $rs = $db->Execute('select * from Groups_members');
135 rs2html($rs,'border=2 cellpadding=3',array('id','courseid','name','description','lang','picture','timecreated','timemodified'));
137 echo "<h3>schemaLog.xml</h3>";
138 $rs = $db->Execute('drop table log');
139 $rs = $db->Execute('drop sequence SEQ_log');
140 $schema = new adoSchema($db);
141 $sql = $schema->ParseSchema("schemaLog.xml");
142 $result = $schema->ExecuteSchema( $sql );
143 $sql = "insert into log values (2,2,2,2,2,2,2,2,2)";
144 $rs = $db->Execute($sql);
145 $sql = "insert into log values (3,3,3,3,3,3,3,3,3)";
146 $rs = $db->Execute($sql);
147 $rs = $db->Execute('select * from log');
148 rs2html($rs,'border=2 cellpadding=3',array('id','time','userid','ip','course','module','action','url','info'));
150 echo "<h3>schemaLog_display.xml</h3>";
151 $rs = $db->Execute('drop table log_display');
152 $rs = $db->Execute('drop sequence SEQ_log_display');
153 $schema = new adoSchema($db);
154 $sql = $schema->ParseSchema("schemalog_display.xml");
155 $result = $schema->ExecuteSchema( $sql );
156 $sql = "insert into log_display values (2,2,2,2)";
157 $rs = $db->Execute($sql);
158 $sql = "insert into log_display values (3,3,3,3)";
159 $rs = $db->Execute($sql);
160 $rs = $db->Execute('select * from log_display');
161 rs2html($rs,'border=2 cellpadding=3',array('id','time','userid','ip','course','module','action','url','info'));
163 echo "<h3>schemaModules.xml</h3>";
164 $rs = $db->Execute('drop table modules');
165 $rs = $db->Execute('drop sequence SEQ_modules');
166 $schema = new adoSchema($db);
167 $sql = $schema->ParseSchema("schemamodules.xml");
168 $result = $schema->ExecuteSchema( $sql );
169 $sql = "insert into modules values (2,2,2,2,2,2,2)";
170 $rs = $db->Execute($sql);
171 $sql = "insert into modules values (3,3,3,3,3,3,3)";
172 $rs = $db->Execute($sql);
173 $rs = $db->Execute('select * from modules');
174 rs2html($rs,'border=2 cellpadding=3',array('id','name','version','cron','lastcron','search','visible'));
176 echo "<h3>schemaScale.xml</h3>";
177 $rs = $db->Execute('drop table scale');
178 $rs = $db->Execute('drop sequence SEQ_scale');
179 $schema = new adoSchema($db);
180 $sql = $schema->ParseSchema("schemaScale.xml");
181 $result = $schema->ExecuteSchema( $sql );
182 $sql = "insert into scale values (2,2,2,2,2,2,2)";
183 $rs = $db->Execute($sql);
184 $sql = "insert into scale values (3,3,3,3,3,3,3)";
185 $rs = $db->Execute($sql);
186 $rs = $db->Execute('select * from scale');
187 rs2html($rs,'border=2 cellpadding=3',array('id','courseid','userid','name','scale','description','timemodified'));
189 echo "<h3>schemaUser.xml</h3>";
190 $rs = $db->Execute('drop table m_user');
191 $rs = $db->Execute('drop sequence SEQ_m_user');
192 $schema = new adoSchema($db);
193 $sql = $schema->ParseSchema("schemaUser.xml");
194 $result = $schema->ExecuteSchema( $sql );
195 $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)";
197 $rs = $db->Execute($sql);
198 $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)";
199 $rs = $db->Execute($sql);
200 $rs = $db->Execute('select * from m_user');
201 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'));
203 echo "<h3>schemaUser_admins.xml</h3>";
204 $rs = $db->Execute('drop table user_admins');
205 $rs = $db->Execute('drop sequence SEQ_user_admins');
206 $schema = new adoSchema($db);
207 $sql = $schema->ParseSchema("schemaUser_admins.xml");
208 $result = $schema->ExecuteSchema( $sql );
209 $sql = "insert into user_admins values (2,2)";
210 $rs = $db->Execute($sql);
211 $sql = "insert into user_admins values (3,3)";
212 $rs = $db->Execute($sql);
213 $rs = $db->Execute('select * from user_admins');
214 rs2html($rs,'border=2 cellpadding=3',array('id','userid'));
216 echo "<h3>schemaUser_students.xml</h3>";
217 $rs = $db->Execute('drop table user_students');
218 $rs = $db->Execute('drop sequence SEQ_user_students');
219 $schema = new adoSchema($db);
220 $sql = $schema->ParseSchema("schemaUser_students.xml");
221 $result = $schema->ExecuteSchema( $sql );
222 $sql = "insert into user_students values (2,2,2,2,2,2,2)";
223 $rs = $db->Execute($sql);
224 $sql = "insert into user_students values (3,3,3,3,3,3,3)";
225 $rs = $db->Execute($sql);
226 $rs = $db->Execute('select * from user_students');
227 rs2html($rs,'border=2 cellpadding=3',array('id','userid','course','timestart','timeend','time','timeaccess'));
229 echo "<h3>schemaUser_teachers.xml</h3>";
230 $rs = $db->Execute('drop table user_teachers');
231 $rs = $db->Execute('drop sequence SEQ_user_teachers');
232 $schema = new adoSchema($db);
233 $sql = $schema->ParseSchema("schemaUser_teachers.xml");
234 $result = $schema->ExecuteSchema( $sql );
235 $sql = "insert into user_teachers values (2,2,2,2,2,2,2,2)";
236 $rs = $db->Execute($sql);
237 $sql = "insert into user_teachers values (3,3,3,3,3,3,3,3)";
238 $rs = $db->Execute($sql);
239 $rs = $db->Execute('select * from user_teachers');
240 rs2html($rs,'border=2 cellpadding=3',array('id','userid','course','authority','role','editall','timemodified','timeaccess'));
242 echo "<h3>schemaUser_coursecreators.xml</h3>";
243 $rs = $db->Execute('drop table user_coursecreators');
244 $rs = $db->Execute('drop sequence SEQ_user_coursecreators');
245 $schema = new adoSchema($db);
246 $sql = $schema->ParseSchema("schemaUser_coursecreators.xml");
247 $result = $schema->ExecuteSchema( $sql );
248 $sql = "insert into user_coursecreators values (2,2)";
249 $rs = $db->Execute($sql);
250 $sql = "insert into user_coursecreators values (3,3)";
251 $rs = $db->Execute($sql);
252 $rs = $db->Execute('select * from user_coursecreators');
253 rs2html($rs,'border=2 cellpadding=3',array('id','userid'));
255 ?>