Beispiel #1
0
 /**
  * return regex fragment that can be used to match databases type to enum types
  */
 public static function enum_regex($db_doc)
 {
     // enum_type_regex_expression is cached, this function is called a whole lot
     if ($db_doc !== NULL && self::$enum_type_regex_expression === NULL) {
         self::$enum_type_regex_expression = '';
         $enum_type_names = array();
         $schemas =& dbx::get_schemas($db_doc);
         foreach ($schemas as $schema) {
             $types =& dbx::get_types($schema);
             foreach ($types as $type) {
                 if (strcasecmp($type['type'], 'enum') == 0) {
                     $enum_type_names[] = $schema['name'] . '\\.' . $type['name'];
                 }
             }
         }
         self::$enum_type_regex_expression = implode('|', $enum_type_names);
         if (strlen(self::$enum_type_regex_expression) == 0) {
             self::$enum_type_regex_expression = 'nevermatchyyyyyyzz';
         }
     }
     return self::$enum_type_regex_expression;
 }