Esempio n. 1
0
 public function tables()
 {
     // Collecting all table names and storing them (A)
     if (preg_match_all(Initialize::$replace["tableName"], Compose::databaseFile3(), $tableNameCode)) {
         new Compile($tableNameCode);
         $tableNames = $tableNameCode[1];
         Initialize::databaseTableNames($tableNames);
         new Compile($tableNames);
     } else {
         echo "ERROR 1";
     }
     echo Compose::databaseFile2();
     echo '<br><br><br>';
     new Compile((string) Compose::databaseFile3());
     echo '<br><br><br>';
     // For every table name..
     for ($i = 0; $i < count($tableNames); $i++) {
         // Check if code in database file is written correctly (B)
         if (preg_match_all(sprintf(Initialize::$replace["table"], $tableNames[$i], $tableNames[$i]), Compose::databaseFile3(), $tableCode)) {
             new Compile($tableCode);
             // Store data in arrays
             $tables[$tableNames[$i]] = $tableCode[0][0];
             $inTables[$tableNames[$i]] = $tableCode[1][0];
         } else {
             echo "noo";
         }
         // Initializing the code inside database table
         // Must initialize it here, if not, the collection of columns will not work.. [BUG]
         Initialize::databaseCode($inTables, "inTables");
         // Collecting the columns from table (C)
         if (preg_match_all(sprintf(Initialize::$replace["tableColumns"], $tableNames[$i], $tableNames[$i]), Compose::databaseCode()["inTables"][$tableNames[$i]], $columns)) {
             $columnsCode[$tableNames[$i]] = $columns[0][0];
             $column[] = $columns[1][0];
             $sortColumns[$tableNames[$i]] = preg_split(Initialize::$replace["seperate"], $column[$i]);
         } else {
             echo "He has not created columns..";
         }
         Initialize::databaseTableColumns($sortColumns);
         // Collecting all rows from tables (D)
         if (preg_match_all(sprintf(Initialize::$replace["tableRows"], $tableNames[$i]), Compose::undo(Compose::databaseCode()["inTables"][$tableNames[$i]]), $rows)) {
             new Compile($rows);
             $rowsCode[$tableNames[$i]] = $rows[0];
             $newRows[$tableNames[$i]] = $rows[1];
             foreach ($newRows[$tableNames[$i]] as $key => $value) {
                 $newRows2[$tableNames[$i]][] = preg_split(Initialize::$replace["seperate"], $newRows[$tableNames[$i]][$key]);
                 $newRows3[$tableNames[$i]][] = array_combine(Compose::databaseTableColumns()[$tableNames[$i]], $newRows2[$tableNames[$i]][$key]);
             }
         }
     }
     // End of loop
     //new Compile($newRows3);
     //new Compile($sortColumns);
     // Initializing the table code
     Initialize::databaseCode($tables, "tables");
     // Initializing the column code inside table
     Initialize::databaseCode($columnsCode, "inTableColumns");
     // Initializing the rows code inside table
     Initialize::databaseCode($rowsCode, "inTableRows");
     Initialize::databaseTableRows($newRows3);
     new Compile(Compose::databaseCode());
 }
Esempio n. 2
0
 public static function databaseTableColumns($tableColumns)
 {
     self::$databaseTableColumns = $tableColumns;
 }