Skip to content

Commit

Permalink
Merge pull request #4 from MaybeFactor/trunk
Browse files Browse the repository at this point in the history
Change pg_exec to pg_query
  • Loading branch information
ashnazg committed Jul 20, 2018
2 parents 11cd0a1 + 7d0ddaf commit 303e558
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions DB/pgsql.php
Expand Up @@ -325,14 +325,14 @@ function simpleQuery($query)
$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();
}
Expand Down Expand Up @@ -598,7 +598,7 @@ function commit()
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();
Expand All @@ -618,7 +618,7 @@ function commit()
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();
Expand Down Expand Up @@ -887,7 +887,7 @@ function tableInfo($result, $mode = null)
* 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)) {
/*
Expand Down Expand Up @@ -980,7 +980,7 @@ function _pgFieldFlags($resource, $num_field, $table_name)
$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
Expand All @@ -991,7 +991,7 @@ function _pgFieldFlags($resource, $num_field, $table_name)
$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'
Expand All @@ -1003,7 +1003,7 @@ function _pgFieldFlags($resource, $num_field, $table_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
Expand Down

0 comments on commit 303e558

Please sign in to comment.