public function getNextArray($name) { if (isset($this->result[$name]) && (gettype($this->result[$name]) == 'object' || gettype($this->result[$name]) == 'resource')) { return pg_Fetch_Array($this->result[$name], $this->row++); } return 0; }
function fetch_array($result, $ligne, $type = "") { if (!$type) { $data = pg_Fetch_Array($result, $ligne); } else { $data = pg_Fetch_Array($result, $ligne, $type); } if (!$data) { echo "Erreur de parcours des données"; return 0; } return $data; }
function nextid($seq_name) { $this->connect(); if ($this->lock($this->Seq_Table)) { // get sequence number (locked) and increment $q = sprintf("\n SELECT \n nextid \n FROM \n %s \n WHERE \n seq_name = '%s'", $this->Seq_Table, $seq_name); $id = @pg_Exec($this->Link_ID, $q); $res = @pg_Fetch_Array($id, 0); // No current value, make one if (!is_array($res)) { $currentid = 0; $q = sprintf("\n INSERT INTO \n %s \n VALUES('%s', %s)", $this->Seq_Table, $seq_name, $currentid); $id = @pg_Exec($this->Link_ID, $q); } else { $currentid = $res["nextid"]; } $nextid = $currentid + 1; $q = sprintf("\n UPDATE \n %s \n SET \n nextid = '%s' \n WHERE \n seq_name = '%s'", $this->Seq_Table, $nextid, $seq_name); $id = @pg_Exec($this->Link_ID, $q); $this->unlock(); } else { $this->halt("cannot lock " . $this->Seq_Table . " - has it been created?"); return 0; } return $nextid; }
function nextid($seq_name) { $this->connect(); if ($this->lock($this->Seq_Table)) { /* get sequence number (locked) and increment */ $q = sprintf("select nextid from %s where seq_name = '%s' LIMIT 1", $this->Seq_Table, $seq_name); $id = @pg_Exec($this->Link_ID, $q); $res = @pg_Fetch_Array($id, 0); /* No current value, make one */ if (!is_array($res)) { $currentid = 0; $q = sprintf("insert into %s values('%s', %s)", $this->Seq_Table, $seq_name, $currentid); $id = @pg_Exec($this->Link_ID, $q); } else { $currentid = $res["nextid"]; } $nextid = $currentid + 1; $q = sprintf("update %s set nextid = '%s' where seq_name = '%s'", $this->Seq_Table, $nextid, $seq_name); $id = @pg_Exec($this->Link_ID, $q); $this->unlock(); } else { $this->Errors->addError("Database error: Cannot lock " . $this->Seq_Table . " - has it been created?"); return 0; } return $nextid; }
public function getRow($p_objquery, $p_index) { return pg_Fetch_Array($p_objquery, $p_index); }
function pg_db_fetch_array($iQry, $iRow) { $rRow = @pg_Fetch_Array($iQry, $iRow); return $rRow; }
function fcdb_fetch_array($res, $inx) { global $fcdb_sel, $fcdb_conn; set_error_handler("fcdb_error_handler"); switch ($fcdb_sel) { case "PostgreSQL": $arr = pg_Fetch_Array($res, $inx); break; case "MySQL": $ok = mysql_data_seek($res, $inx); if (!$ok) { build_fcdb_error("I couldn't seek to given row."); } $arr = mysql_fetch_array($res); break; } restore_error_handler(); return $arr; }