*/
public function &query($query, $params = array())
{
- if (sizeof($params) > 0) {
+ $params = (array)$params;
+ if (count($params)) {
$sth = $this->prepare($query);
if (DB::isError($sth)) {
return $sth;
{
$params = (array)$params;
// modifyLimitQuery() would be nice here, but it causes BC issues
- if (sizeof($params) > 0) {
+ $params = (array)$params;
+ if (count($params)) {
$sth = $this->prepare($query);
if (DB::isError($sth)) {
return $sth;
}
}
- if (sizeof($params) > 0) {
+ $params = (array)$params;
+ if (count($params)) {
$sth = $this->prepare($query);
if (DB::isError($sth)) {
$query = $this->modifyQuery($query);
if (!$this->autocommit && $ismanip) {
if ($this->transaction_opcount == 0) {
- $result = @pg_exec($this->connection, 'begin;');
+ $result = @pg_query($this->connection, 'begin;');
if (!$result) {
return $this->pgsqlRaiseError();
}
}
$this->transaction_opcount++;
}
- $result = @pg_exec($this->connection, $query);
+ $result = @pg_query($this->connection, $query);
if (!$result) {
return $this->pgsqlRaiseError();
}
if ($this->transaction_opcount > 0) {
// (disabled) hack to shut up error messages from libpq.a
//@fclose(@fopen("php://stderr", "w"));
- $result = @pg_exec($this->connection, 'end;');
+ $result = @pg_query($this->connection, 'end;');
$this->transaction_opcount = 0;
if (!$result) {
return $this->pgsqlRaiseError();
public function rollback()
{
if ($this->transaction_opcount > 0) {
- $result = @pg_exec($this->connection, 'abort;');
+ $result = @pg_query($this->connection, 'abort;');
$this->transaction_opcount = 0;
if (!$result) {
return $this->pgsqlRaiseError();
* Probably received a table name.
* Create a result resource identifier.
*/
- $id = @pg_exec($this->connection, "SELECT * FROM $result LIMIT 0");
+ $id = @pg_query($this->connection, "SELECT * FROM $result LIMIT 0");
$got_string = true;
} elseif (isset($result->result)) {
/*
$tableWhere = "tab.relname = '$table_name'";
}
- $result = @pg_exec($this->connection, "SELECT f.attnotnull, f.atthasdef
+ $result = @pg_query($this->connection, "SELECT f.attnotnull, f.atthasdef
FROM $from
WHERE tab.relname = typ.typname
AND typ.typrelid = f.attrelid
$flags = ($row[0] == 't') ? 'not_null ' : '';
if ($row[1] == 't') {
- $result = @pg_exec($this->connection, "SELECT a.adsrc
+ $result = @pg_query($this->connection, "SELECT a.adsrc
FROM $from, pg_attrdef a
WHERE tab.relname = typ.typname AND typ.typrelid = f.attrelid
AND f.attrelid = a.adrelid AND f.attname = '$field_name'
} else {
$flags = '';
}
- $result = @pg_exec($this->connection, "SELECT i.indisunique, i.indisprimary, i.indkey
+ $result = @pg_query($this->connection, "SELECT i.indisunique, i.indisprimary, i.indkey
FROM $from, pg_index i
WHERE tab.relname = typ.typname
AND typ.typrelid = f.attrelid