1
0
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:
David Grudl
2008-05-16 17:56:24 +00:00
parent b27b0193f1
commit a8acce6d59
13 changed files with 60 additions and 49 deletions

View File

@@ -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'.");
}

View File

@@ -117,7 +117,7 @@ class DibiResult extends /*Nette::*/Object implements IDataSource
*/
public function __destruct()
{
@$this->free();
@$this->free(); // intentionally @
}

View File

@@ -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':

View File

@@ -85,6 +85,15 @@ interface IDibiDriver
/**
* Returns TRUE when connection was established.
*
* @return bool
*/
function isConnected();
/**
* Internal: Executes the SQL query.
*