php8
[web.mtrack] / MTrackWeb / CreateSchema.php
1 <?php 
2
3  
4 class MTrackWeb_CreateSchema  extends MTrackWeb
5 {
6
7     
8     function getAuth() 
9     {
10         if (!$this->cli) die("access denied");
11     }
12     
13     function get()
14     {
15         require_once 'SQL/Parser.php';
16         $p = new SQL_Parser(file_get_contents('../schema/schema.sql'),'MySQL');
17         $struct = $p->parse();
18         print_r($struct);
19         require_once 'SQL/Parser/Compiler.php';
20         $c = new SQL_Parser_Compiler();
21         foreach($struct as $i=>$cmd) {
22             if (!is_array($cmd)) {
23                 continue;
24             }
25             echo $c->compile($cmd) . "\n"; flush();
26             
27         }
28     }
29     
30 }