Subversion Repositories oidplus

Compare Revisions

Regard whitespace Rev 1453 → Rev 1452

/trunk/plugins/viathinksoft/database/oci/OIDplusDatabaseConnectionOci.class.php
66,7 → 66,7
return ":param$i";
}, $sql, count($prepared_args), $count);
 
$res = @oci_parse($this->conn, $sql); // TODO: prepare_cache (is this safe?)
$res = @oci_parse($this->conn, $sql);
if ($res === false) {
$this->last_error = oci_error($this->conn);
throw new OIDplusSQLException($sql, _L('Cannot prepare statement').': '.$this->error());
/trunk/plugins/viathinksoft/database/odbc/OIDplusQueryResultODBC.class.php
42,10 → 42,6
 
if (!$this->no_resultset) {
$this->res = $res;
 
// Since caching prepared statements will cause the testcase "Simultanous prepared statements" to fail,
// this will fix it.
$this->prefetchAll();
}
}
 
103,21 → 99,10
}
 
/**
* Goes to the last result set (in case a query returns multiple result sets)
* @return void
*/
protected function gotoLastResultSet() {
while (@odbc_next_result($this->res)) {
// Do nothing
}
}
 
/**
* @return array|null
*/
protected function do_fetch_array()/*: ?array*/ {
//$this->gotoLastResultSet(); // TODO: This causes problems (read dbms_version on null)
$ret = @odbc_fetch_array($this->res);
$ret = odbc_fetch_array($this->res);
if ($ret === false) $ret = null;
return $ret;
}
126,8 → 111,7
* @return object|null
*/
protected function do_fetch_object()/*: ?object*/ {
//$this->gotoLastResultSet(); // TODO: This causes problems (read dbms_version on null)
$ret = @odbc_fetch_object($this->res);
$ret = odbc_fetch_object($this->res);
if ($ret === false) $ret = null;
return $ret;
}
/trunk/plugins/viathinksoft/database/pdo/OIDplusDatabaseConnectionPDO.class.php
40,11 → 40,6
private $transactions_supported = false;
 
/**
* @var
*/
private $prepare_cache = [];
 
/**
* @param string $sql
* @param array|null $prepared_args
* @return OIDplusQueryResultPDO
78,18 → 73,7
}
unset($value);
 
if (isset($this->prepare_cache[$sql])) {
// Attention: Caching prepared statements in PDO and ODBC is risky,
// because it seems that existing pointers are destroyed
// when execeute() is called.
// However, since we always fetch all data (to allow MARS),
// the testcase "Simultanous prepared statements" works, so we should be fine...?
$ps = $this->prepare_cache[$sql];
} else {
$ps = $this->conn->prepare($sql);
if (!$ps) $ps = false; // because null will result in isset()=false
$this->prepare_cache[$sql] = $ps;
}
if (!$ps) {
$this->last_error = $this->conn->errorInfo()[2];
if (!$this->last_error) $this->last_error = _L("Error")." ".$this->conn->errorInfo()[0]; // if no message is available, only show the error-code