1
0
mirror of https://github.com/dg/dibi.git synced 2025-10-23 02:36:04 +02:00

DibiMysqlDriver & DibiPostgreSql: escape() checks if resource is alive [Closes #46]

This commit is contained in:
David Grudl
2012-01-19 03:04:21 +01:00
parent 660a9db522
commit 5efb11d780
2 changed files with 12 additions and 0 deletions

View File

@@ -300,9 +300,15 @@ class DibiMySqlDriver extends DibiObject implements IDibiDriver, IDibiResultDriv
{
switch ($type) {
case dibi::TEXT:
if (!is_resource($this->connection)) {
throw new DibiException('Lost connection to server.');
}
return "'" . mysql_real_escape_string($value, $this->connection) . "'";
case dibi::BINARY:
if (!is_resource($this->connection)) {
throw new DibiException('Lost connection to server.');
}
return "_binary'" . mysql_real_escape_string($value, $this->connection) . "'";
case dibi::IDENTIFIER: