示例#1
0
 public static function dialect_to_class($dialect)
 {
     if (!isset(self::$dialect_map)) {
         self::$dialect_map = array();
     }
     if (!isset(self::$dialect_map[$dialect])) {
         $cap_dialect = preg_replace("/sql/", "SQL", $dialect);
         $classes_to_try = array_unique(array("Modyllic_Generator_" . ucfirst($cap_dialect), "Modyllic_Generator_" . ucfirst($dialect) . "SQL", "Modyllic_Generator_" . ucfirst($dialect), "Modyllic_Generator_" . $cap_dialect, "Modyllic_Generator_" . $dialect . "SQL", "Modyllic_Generator_" . $dialect, $dialect));
         foreach ($classes_to_try as $class) {
             $file = preg_replace("/_/", "/", $class) . ".php";
             if (class_exists($class)) {
                 self::$dialect_map[$dialect] = $class;
                 self::$dialect_map[$class] = $class;
                 break;
             }
         }
         if (!isset(self::$dialect_map[$dialect])) {
             throw new Exception("Could not find SQL dialect {$dialect}");
         }
     }
     return self::$dialect_map[$dialect];
 }
示例#2
0
 public function execute($value = false, $params = array())
 {
     $this->setResult(Modyllic_Generator::dialect_to_class($value));
 }