Exemple #1
0
 /**
  * Parses a column out of a provided query line
  * 
  * @param string $line The query line to parse
  * 
  * @return Column|false A column object or false if the string provided is
  *  not a valid column definition query string.
  */
 protected function _parseColumn($line)
 {
     $line = trim($line);
     $regExp = '/[`"](?P<name>[a-z-_]+)[`"] (?P<type>[a-z_]+)\\(?[0-9]*\\)?';
     $regExp .= '\\s?(?P<properties>[a-z\\s]*)/i';
     $column = false;
     if (preg_match($regExp, $line, $matches)) {
         $column = new Column();
         $column->setName($matches['name']);
         $this->_setType($column, $matches['type']);
         if (isset($matches['properties'])) {
             $this->_checkColumnProperties($column, $matches['properties']);
         }
     }
     return $column;
 }