protected function validate($value) { $valueArray = explode(".", $value); parent::validate($valueArray[0]); if (!preg_match("/^([a-zA-Z0-9:_-]+\\.)?[a-zA-Z0-9:_-]+\$/is", $value)) { throw new ErrorException("Invalid table-specifier given: '{$value}'!"); } }
public function convertSqlToJob(SQLTokenIterator $tokens) { $parts = array(); do { if (!$tokens->seekTokenNum(T_STRING)) { throw new ErrorException("Tried to convert sql-database-specifier when token-iterator does not point to T_STRING!"); } $part = $tokens->getCurrentTokenString(); if ($part[0] === '`' && $part[strlen($part) - 1] === '`') { $part = substr($part, 1, strlen($part) - 2); } $parts[] = $part; } while ($tokens->seekTokenText(".")); $specifier = DatabaseSpecifier::factory(implode(".", $parts)); return $specifier; }