mirror of
https://github.com/dg/dibi.git
synced 2025-08-13 09:34:30 +02:00
- removed DibiPostgreDriver workaround (there is no bug in pg_affected_rows)
- added IDibiConnection::isConnected()
This commit is contained in:
@@ -90,7 +90,7 @@ class DibiConnection extends /*Nette::*/Object
|
||||
}
|
||||
|
||||
if (isset($config['result:objects'])) {
|
||||
// normalize
|
||||
// normalize
|
||||
$val = $config['result:objects'];
|
||||
$config['result:objects'] = is_string($val) && !is_numeric($val) ? $val : (bool) $val;
|
||||
}
|
||||
@@ -154,6 +154,18 @@ class DibiConnection extends /*Nette::*/Object
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns TRUE when connection was established.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
final public function isConnected()
|
||||
{
|
||||
return $this->connected;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns configuration variable. If no $key is passed, returns the entire array.
|
||||
*
|
||||
@@ -411,9 +423,9 @@ class DibiConnection extends /*Nette::*/Object
|
||||
{
|
||||
$this->connect();
|
||||
|
||||
@set_time_limit(0);
|
||||
@set_time_limit(0); // intentionally @
|
||||
|
||||
$handle = @fopen($file, 'r');
|
||||
$handle = @fopen($file, 'r'); // intentionally @
|
||||
if (!$handle) {
|
||||
throw new FileNotFoundException("Cannot open file '$file'.");
|
||||
}
|
||||
|
@@ -117,7 +117,7 @@ class DibiResult extends /*Nette::*/Object implements IDataSource
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
@$this->free();
|
||||
@$this->free(); // intentionally @
|
||||
}
|
||||
|
||||
|
||||
|
@@ -131,9 +131,9 @@ final class DibiTranslator extends /*Nette::*/Object
|
||||
)/xs',
|
||||
*/ // note: this can change $this->args & $this->cursor & ...
|
||||
. preg_replace_callback('/(?=`|\[|\'|"|%)(?:`(.+?)`|\[(.+?)\]|(\')((?:\'\'|[^\'])*)\'|(")((?:""|[^"])*)"|(\'|")|%([a-zA-Z]{1,4})(?![a-zA-Z]))/s',
|
||||
array($this, 'cb'),
|
||||
substr($arg, $toSkip)
|
||||
);
|
||||
array($this, 'cb'),
|
||||
substr($arg, $toSkip)
|
||||
);
|
||||
|
||||
}
|
||||
continue;
|
||||
@@ -302,9 +302,9 @@ final class DibiTranslator extends /*Nette::*/Object
|
||||
} else {
|
||||
return substr($value, 0, $toSkip)
|
||||
. preg_replace_callback('/(?=`|\[|\'|")(?:`(.+?)`|\[(.+?)\]|(\')((?:\'\'|[^\'])*)\'|(")((?:""|[^"])*)"(\'|"))/s',
|
||||
array($this, 'cb'),
|
||||
substr($value, $toSkip)
|
||||
);
|
||||
array($this, 'cb'),
|
||||
substr($value, $toSkip)
|
||||
);
|
||||
}
|
||||
|
||||
case 'a':
|
||||
|
@@ -85,6 +85,15 @@ interface IDibiDriver
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns TRUE when connection was established.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function isConnected();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Internal: Executes the SQL query.
|
||||
*
|
||||
|
Reference in New Issue
Block a user