Browse Source

Fixed test brak.

tags/2.0.0-rc
Qiang Xue 10 years ago
parent
commit
478380fb10
  1. 11
      extensions/sphinx/Schema.php
  2. 7
      framework/db/Schema.php

11
extensions/sphinx/Schema.php

@ -518,4 +518,15 @@ class Schema extends Object
throw new Exception($message, $errorInfo, (int) $e->getCode(), $e);
}
}
/**
* Returns a value indicating whether a SQL statement is for read purpose.
* @param string $sql the SQL statement
* @return boolean whether a SQL statement is for read purpose.
*/
public function isReadQuery($sql)
{
$pattern = '/^\s*(SELECT|SHOW|DESCRIBE)\b/i';
return preg_match($pattern, $sql) > 0;
}
}

7
framework/db/Schema.php

@ -520,9 +520,14 @@ abstract class Schema extends Object
}
}
/**
* Returns a value indicating whether a SQL statement is for read purpose.
* @param string $sql the SQL statement
* @return boolean whether a SQL statement is for read purpose.
*/
public function isReadQuery($sql)
{
$pattern = '/^\s*(SELECT|SHOW|DESCRIBE)\b/i';
return preg_match($pattern, $sql);
return preg_match($pattern, $sql) > 0;
}
}

Loading…
Cancel
Save