Example #1
0
 static function schema(array $load)
 {
     Modyllic_Tokenizer::on_advance(array("Modyllic_Status", "status"));
     try {
         $schema = Modyllic_Loader::load($load);
     } catch (Modyllic_Exception $e) {
         Modyllic_Status::clear_progress();
         Modyllic_Status::warn($e->getMessage() . "\n");
         if (Modyllic_Status::$debug) {
             Modyllic_Status::warn($e->getTraceAsString() . "\n");
         }
         exit(1);
     } catch (Modyllic_Loader_Exception $e) {
         Modyllic_Status::clear_progress();
         Modyllic_Status::warn($e->getMessage() . "\n");
         exit(1);
     } catch (Exception $e) {
         Modyllic_Status::clear_progress();
         throw $e;
     }
     Modyllic_Status::clear_progress();
     return $schema;
 }
Example #2
0
 function unquote_sql_str($sql)
 {
     $tok = new Modyllic_Tokenizer($sql);
     return $tok->next()->unquote();
 }
Example #3
0
 /**
  * Generate the reserved words regexp, from the list as the bottom of the class.
  */
 private function generate_reserved_re()
 {
     if (isset(self::$reserved_words_re)) {
         return;
     }
     $reserved = self::reserved_words();
     $strans = array();
     foreach ($reserved as $word) {
         $strans[] = sprintf("%2d:%s", strlen($word), $word);
     }
     rsort($strans);
     $reserved = array();
     foreach ($strans as $word) {
         $reserved[] = substr($word, 3);
     }
     self::$reserved_words_re = '/\\G(' . implode('|', $reserved) . ')\\b/si';
 }