function next_record()
 {
     $this->Record = @pg_fetch_array($this->Query_ID, $this->Row);
     $this->Row += 1;
     $this->Error = pg_errormessage();
     $stat = is_array($this->Record);
     if (!$stat) {
         pg_freeresult($this->Query_ID);
         $this->Query_ID = 0;
     }
     return $this->Record;
 }
Exemple #2
0
 /**
  * That one was messing the parser...
  */
 function pg_insert_id($tablename, $fieldname)
 {
     $result = pg_exec($this->_connectionID, "SELECT last_value FROM {$tablename}_seq");
     if ($result) {
         $arr = @pg_fetch_row($result, 0);
         pg_freeresult($result);
         if (isset($arr[0])) {
             return $arr[0];
         }
     }
     return false;
 }
 function next_record()
 {
     $this->Record = @pg_fetch_array($this->Query_ID, $this->Row++);
     $this->Error = pg_ErrorMessage($this->Link_ID);
     $this->Errno = $this->Error == "" ? 0 : 1;
     $stat = is_array($this->Record);
     if (!$stat && $this->Auto_Free) {
         pg_freeresult($this->Query_ID);
         $this->Query_ID = 0;
     }
     return $stat;
 }
Exemple #4
0
 /**
  * Performs an SQL query.
  *
  * @param  string  $query
  * @param  mixed   $limit
  * @param  boolean $warnOnFailure
  * @access public
  */
 function query($query, $limit = false, $warnOnFailure = true)
 {
     if ($limit != false) {
         $query .= ' LIMIT ' . $limit;
     }
     if ($this->config['debug_level'] > 1) {
         $this->debugQuery($query);
     }
     @pg_freeresult($this->result);
     $this->result = @pg_exec($this->connection, $query);
     if (!$this->result && $warnOnFailure) {
         phpOpenTracker::handleError(@pg_errormessage($this->connection), E_USER_ERROR);
     }
 }
Exemple #5
0
    $title = $r[1];
    $axislabel = $r[2];
    $is_clickable = $r[3];
    pg_freeresult($data);
    // get graph data
    $data = @pg_exec($db, $query) or die("PGERR 2: " . pg_ErrorMessage());
    $v = array();
    $l = array();
    $u = array();
    for ($i = 0; $i < pg_numrows($data); $i++) {
        $r = pg_fetch_row($data, $i);
        array_push($v, $r[1]);
        array_push($l, $r[0] . "  ");
        array_push($u, $r[2]);
    }
    pg_freeresult($data);
    // draw
    $map = FreshPortsChart($title, $axislabel, $v, $l, $u, $filename);
    if ($is_clickable == 't') {
        // save map
        $fp = fopen($cache_dir . $fid . ".map", "w");
        fputs($fp, $map);
        fclose($fp);
    }
    pg_close();
}
header("Content-type: image/png");
readfile($filename);
//  CREATE TABLE "graph" ("id" integer NOT NULL, "query" text NOT NULL,
//  "title" text NOT NULL);
// insert into graph (id, query, title) values (0,'select category,
Exemple #6
0
 /**
  * Goto the next record in the result set.
  *
  * @return bool result of going to the next record
  */
 public function next_record()
 {
     /* goto next record */
     $this->m_record = @pg_fetch_array($this->m_query_id, $this->m_row, PGSQL_ASSOC);
     ++$this->m_row;
     /* are we there? */
     $result = is_array($this->m_record);
     if (!$result && $this->m_auto_free) {
         @pg_freeresult($this->m_query_id);
         $this->m_query_id = 0;
     }
     /* return result */
     return $result;
 }
 function _close()
 {
     return @pg_freeresult($this->_queryID);
 }
Exemple #8
0
 /**
  */
 function free_result($query_id = false)
 {
     return $query_id ? pg_freeresult($query_id) : false;
 }
 function _query($sql, $inputarr = false)
 {
     if (!$this->_bindInputArray) {
         // We don't have native support for parameterized queries, so let's emulate it at the parent
         return ADODB_postgres64::_query($sql, $inputarr);
     }
     $this->_pnum = 0;
     $this->_errorMsg = false;
     // -- added Cristiano da Cunha Duarte
     if ($inputarr) {
         $sqlarr = explode('?', trim($sql));
         $sql = '';
         $i = 1;
         $last = sizeof($sqlarr) - 1;
         $localedata = localeconv();
         foreach ($sqlarr as $v) {
             if ($last < $i) {
                 $sql .= $v;
             } else {
                 $sql .= $v . ' $' . $i;
             }
             $i++;
             // pg_query_params may incorrectly format
             // doubles using localized number formats, i.e.
             // , instead of . for floats, violating the
             // SQL standard. Format it locally.
             $k = $i - 2;
             // Use proper index for $inputarr to avoid going over the end
             if ($k < $last) {
                 if (gettype($inputarr[$k]) == 'double') {
                     $inputarr[$k] = str_replace($localedata['decimal_point'], '.', $inputarr[$k]);
                 }
             }
         }
         $rez = pg_query_params($this->_connectionID, $sql, $inputarr);
     } else {
         $rez = pg_query($this->_connectionID, $sql);
     }
     // check if no data returned, then no need to create real recordset
     if ($rez && pg_numfields($rez) <= 0) {
         if (is_resource($this->_resultid) && get_resource_type($this->_resultid) === 'pgsql result') {
             pg_freeresult($this->_resultid);
         }
         $this->_resultid = $rez;
         return true;
     }
     return $rez;
 }
Exemple #10
0
 function sql_freeresult($query_id = 0)
 {
     if (!$query_id) {
         $query_id = $this->query_result;
     }
     return $query_id ? @pg_freeresult($query_id) : false;
 }
Exemple #11
0
	/**
	* pg_free_result
	* Backwards compatible function
	*/
	function pg_free_result($result)
	{
		return pg_freeresult($result);
	}
 function get_last_insert_id($table, $field)
 {
     if (!isset($table) || $table == '' || !isset($field) || $field == '') {
         return -1;
     }
     $oid = pg_getlastoid($this->Query_ID);
     if ($oid == -1) {
         return -1;
     }
     $result = @pg_Exec($this->Link_ID, "select {$field} from {$table} where oid={$oid}");
     if (!$result) {
         return -1;
     }
     $Record = @pg_fetch_array($result, 0);
     @pg_freeresult($result);
     if (!is_array($Record)) {
         return -1;
     }
     return $Record[0];
 }
 /**
  * PostgreSQL::getInsertId()
  *
  * Get the id of the last inserted record
  *
  * @param string $table: de tabel waarvan de laatste id van terug gegeven moet worden
  * @return int
  * @access public
  * @author Teye Heimans
  */
 function getInsertId($table)
 {
     $k = $this->getPrKeys($table);
     // select the last insert id for that table
     $sql = $this->query("\r\n          SELECT last_value\r\n          FROM " . $this->quote($table . "_" . $k[0] . "_seq"));
     // query failed?
     if (!$sql) {
         trigger_error("Could not retrieve the last inserted id for the table '" . $table . "'.\n" . "Query: " . $this->getLastQuery() . "\n" . "Error: " . $this->getError(), E_USER_WARNING);
         return false;
     }
     // get the last inserted id
     if ($this->recordCount($sql) == 1) {
         $row = @pg_fetch_row($sql, 0);
         pg_freeresult($sql);
         return $row[0];
     } else {
         pg_freeresult($sql);
         trigger_error("Could not retrieve the last inserted id for the table '" . $table . "'.\n" . "Query: " . $this->getLastQuery() . "\n" . "Error: " . $this->getError(), E_USER_WARNING);
         return false;
     }
 }
Exemple #14
0
                } else {
                    pg_freeresult($registered);
                    $registered = pg_execute($conn, "register_stats", array($uid));
                    if (!$registered) {
                        pg_execute($conn, "delete_profile", array($uid)) or die("Can't execute delete_profile: " . pg_last_error());
                        pg_execute($conn, "delete_user", array($uid)) or die("Can't execute delete_user: "******"<script type='text/javascript'>\n\t\t\tjSuccess('You have been registered! Please log in!',\n\t\t\t\t{\n\t\t\t\t\tonClosed:function()\n\t\t\t\t\t{\n\t\t\t\t\t\twindow.location.href='" . $root . "/index.php'\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\t\t\t</script>";
                exit;
            } else {
                pg_freeresult($registered);
                dealloc_qrys($conn);
                echo "<script type='text/javascript'>\n\t\t\tjError('Oops, something went wrong...',\n\t\t\t\t{\n\t\t\t\t\tonClosed:function()\n\t\t\t\t\t{\n\t\t\t\t\t\twindow.location.href='" . $root . "/index.php'\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\t\t\t</script>";
                exit;
            }
        }
    }
} else {
    header("Location: " . $root . "/index.php");
}
exit;
?>
</div><!-- container -->
</body>
</html>
 function sql_report($mode, $query = '')
 {
     if (empty($_GET['explain'])) {
         return;
     }
     global $cache, $starttime, $phpbb_root_path;
     static $curtime, $query_hold, $html_hold;
     static $sql_report = '';
     static $cache_num_queries = 0;
     if (!$query && !empty($query_hold)) {
         $query = $query_hold;
     }
     switch ($mode) {
         case 'display':
             if (!empty($cache)) {
                 $cache->unload();
             }
             $this->sql_close();
             $mtime = explode(' ', microtime());
             $totaltime = $mtime[0] + $mtime[1] - $starttime;
             echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8869-1"><meta http-equiv="Content-Style-Type" content="text/css"><link rel="stylesheet" href="' . $phpbb_root_path . 'adm/subSilver.css" type="text/css"><style type="text/css">' . "\n";
             echo 'th { background-image: url(\'' . $phpbb_root_path . 'adm/images/cellpic3.gif\') }' . "\n";
             echo 'td.cat	{ background-image: url(\'' . $phpbb_root_path . 'adm/images/cellpic1.gif\') }' . "\n";
             echo '</style><title>' . $msg_title . '</title></head><body>';
             echo '<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td><a href="' . htmlspecialchars(preg_replace('/&explain=([^&]*)/', '', $_SERVER['REQUEST_URI'])) . '"><img src="' . $phpbb_root_path . 'adm/images/header_left.jpg" width="200" height="60" alt="phpBB Logo" title="phpBB Logo" border="0"/></a></td><td width="100%" background="' . $phpbb_root_path . 'adm/images/header_bg.jpg" height="60" align="right" nowrap="nowrap"><span class="maintitle">SQL Report</span> &nbsp; &nbsp; &nbsp;</td></tr></table><br clear="all"/><table width="95%" cellspacing="1" cellpadding="4" border="0" align="center"><tr><td height="40" align="center" valign="middle"><b>Page generated in ' . round($totaltime, 4) . " seconds with {$this->num_queries} queries" . ($cache_num_queries ? " + {$cache_num_queries} " . ($cache_num_queries == 1 ? 'query' : 'queries') . ' returning data from cache' : '') . '</b></td></tr><tr><td align="center" nowrap="nowrap">Time spent on MySQL queries: <b>' . round($this->sql_time, 5) . 's</b> | Time spent on PHP: <b>' . round($totaltime - $this->sql_time, 5) . 's</b></td></tr></table><table width="95%" cellspacing="1" cellpadding="4" border="0" align="center"><tr><td>';
             echo $sql_report;
             echo '</td></tr></table><br /></body></html>';
             exit;
             break;
         case 'start':
             $query_hold = $query;
             $html_hold = '';
             $curtime = explode(' ', microtime());
             $curtime = $curtime[0] + $curtime[1];
             break;
         case 'fromcache':
             $endtime = explode(' ', microtime());
             $endtime = $endtime[0] + $endtime[1];
             $result = @pg_exec($this->db_connect_id, $query);
             while ($void = @pg_fetch_array($result, NULL, PGSQL_ASSOC)) {
                 // Take the time spent on parsing rows into account
             }
             $splittime = explode(' ', microtime());
             $splittime = $splittime[0] + $splittime[1];
             $time_cache = $endtime - $curtime;
             $time_db = $splittime - $endtime;
             $color = $time_db > $time_cache ? 'green' : 'red';
             $sql_report .= '<hr width="100%"/><br /><table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0"><tr><th>Query results obtained from the cache</th></tr><tr><td class="row1"><textarea style="font-family:\'Courier New\',monospace;width:100%" rows="5">' . preg_replace('/\\t(AND|OR)(\\W)/', "\$1\$2", htmlspecialchars(preg_replace('/[\\s]*[\\n\\r\\t]+[\\n\\r\\s\\t]*/', "\n", $query))) . '</textarea></td></tr></table><p align="center">';
             $sql_report .= 'Before: ' . sprintf('%.5f', $curtime - $starttime) . 's | After: ' . sprintf('%.5f', $endtime - $starttime) . 's | Elapsed [cache]: <b style="color: ' . $color . '">' . sprintf('%.5f', $time_cache) . 's</b> | Elapsed [db]: <b>' . sprintf('%.5f', $time_db) . 's</b></p>';
             // Pad the start time to not interfere with page timing
             $starttime += $time_db;
             @pg_freeresult($result);
             $cache_num_queries++;
             break;
         case 'stop':
             $endtime = explode(' ', microtime());
             $endtime = $endtime[0] + $endtime[1];
             $sql_report .= '<hr width="100%"/><br /><table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0"><tr><th>Query #' . $this->num_queries . '</th></tr><tr><td class="row1"><textarea style="font-family:\'Courier New\',monospace;width:100%" rows="5">' . preg_replace('/\\t(AND|OR)(\\W)/', "\$1\$2", htmlspecialchars(preg_replace('/[\\s]*[\\n\\r\\t]+[\\n\\r\\s\\t]*/', "\n", $query))) . '</textarea></td></tr></table> ' . $html_hold . '<p align="center">';
             if ($this->query_result) {
                 if (preg_match('/^(UPDATE|DELETE|REPLACE)/', $query)) {
                     $sql_report .= "Affected rows: <b>" . $this->sql_affectedrows($this->query_result) . '</b> | ';
                 }
                 $sql_report .= 'Before: ' . sprintf('%.5f', $curtime - $starttime) . 's | After: ' . sprintf('%.5f', $endtime - $starttime) . 's | Elapsed: <b>' . sprintf('%.5f', $endtime - $curtime) . 's</b>';
             } else {
                 $error = $this->sql_error();
                 $sql_report .= '<b style="color: red">FAILED</b> - ' . SQL_LAYER . ' Error ' . $error['code'] . ': ' . htmlspecialchars($error['message']);
             }
             $sql_report .= '</p>';
             $this->sql_time += $endtime - $curtime;
             break;
     }
 }
 /**
  * Find the primary key of the last insertion on the current db connection
  *
  * @param string $table name of table the insert was performed on
  * @param string $field the autoincrement primary key of the table
  * @return integer the id, -1 if fails
  */
 public function get_last_insert_id($table, $field = '')
 {
     switch ($GLOBALS['phpgw_info']['server']['db_type']) {
         case 'postgres':
             $params = explode('.', $this->adodb->pgVersion);
             if ($params[0] < 8 || $params[0] == 8 && $params[1] == 0) {
                 $oid = pg_getlastoid($this->adodb->_resultid);
                 if ($oid == -1) {
                     return -1;
                 }
                 $result = @pg_Exec($this->adodb->_connectionID, "select {$field} from {$table} where oid={$oid}");
             } else {
                 $result = @pg_Exec($this->adodb->_connectionID, "select lastval()");
             }
             if (!$result) {
                 return -1;
             }
             $Record = @pg_fetch_array($result, 0);
             @pg_freeresult($result);
             if (!is_array($Record)) {
                 return -1;
             }
             return $Record[0];
             break;
         case 'mssql':
             /*  MSSQL uses a query to retrieve the last
              *  identity on the connection, so table and field are ignored here as well.
              */
             if (!isset($table) || $table == '' || !isset($field) || $field == '') {
                 return -1;
             }
             $result = @mssql_query("select @@identity", $this->adodb->_queryID);
             if (!$result) {
                 return -1;
             }
             return mssql_result($result, 0, 0);
             break;
         default:
             return $this->adodb->Insert_ID($table, $field);
     }
 }
Exemple #17
0
 /**
  * Returns information about a table or a result set
  *
  * NOTE: doesn't support table name and flags if called from a db_result
  *
  * @param  mixed $resource PostgreSQL result identifier or table name
  * @param  int $mode A valid tableInfo mode (DB_TABLEINFO_ORDERTABLE or
  *                   DB_TABLEINFO_ORDER)
  *
  * @return array An array with all the information
  */
 function tableInfo($result, $mode = null)
 {
     $count = 0;
     $id = 0;
     $res = array();
     /*
      * depending on $mode, metadata returns the following values:
      *
      * - mode is false (default):
      * $result[]:
      *   [0]["table"]  table name
      *   [0]["name"]   field name
      *   [0]["type"]   field type
      *   [0]["len"]    field length
      *   [0]["flags"]  field flags
      *
      * - mode is DB_TABLEINFO_ORDER
      * $result[]:
      *   ["num_fields"] number of metadata records
      *   [0]["table"]  table name
      *   [0]["name"]   field name
      *   [0]["type"]   field type
      *   [0]["len"]    field length
      *   [0]["flags"]  field flags
      *   ["order"][field name]  index of field named "field name"
      *   The last one is used, if you have a field name, but no index.
      *   Test:  if (isset($result['meta']['myfield'])) { ...
      *
      * - mode is DB_TABLEINFO_ORDERTABLE
      *    the same as above. but additionally
      *   ["ordertable"][table name][field name] index of field
      *      named "field name"
      *
      *      this is, because if you have fields from different
      *      tables with the same field name * they override each
      *      other with DB_TABLEINFO_ORDER
      *
      *      you can combine DB_TABLEINFO_ORDER and
      *      DB_TABLEINFO_ORDERTABLE with DB_TABLEINFO_ORDER |
      *      DB_TABLEINFO_ORDERTABLE * or with DB_TABLEINFO_FULL
      */
     // if $result is a string, then we want information about a
     // table without a resultset
     if (is_string($result)) {
         $id = pg_exec($this->connection, "SELECT * FROM {$result}");
         if (empty($id)) {
             return $this->pgsqlRaiseError();
         }
     } else {
         // else we want information about a resultset
         $id = $result;
         if (empty($id)) {
             return $this->pgsqlRaiseError();
         }
     }
     $count = @pg_numfields($id);
     // made this IF due to performance (one if is faster than $count if's)
     if (empty($mode)) {
         for ($i = 0; $i < $count; $i++) {
             $res[$i]['table'] = is_string($result) ? $result : '';
             $res[$i]['name'] = @pg_fieldname($id, $i);
             $res[$i]['type'] = @pg_fieldtype($id, $i);
             $res[$i]['len'] = @pg_fieldsize($id, $i);
             $res[$i]['flags'] = is_string($result) ? $this->_pgFieldflags($id, $i, $result) : '';
         }
     } else {
         // full
         $res["num_fields"] = $count;
         for ($i = 0; $i < $count; $i++) {
             $res[$i]['table'] = is_string($result) ? $result : '';
             $res[$i]['name'] = @pg_fieldname($id, $i);
             $res[$i]['type'] = @pg_fieldtype($id, $i);
             $res[$i]['len'] = @pg_fieldsize($id, $i);
             $res[$i]['flags'] = is_string($result) ? $this->_pgFieldFlags($id, $i, $result) : '';
             if ($mode & DB_TABLEINFO_ORDER) {
                 $res['order'][$res[$i]['name']] = $i;
             }
             if ($mode & DB_TABLEINFO_ORDERTABLE) {
                 $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
             }
         }
     }
     // free the result only if we were called on a table
     if (is_resource($id)) {
         @pg_freeresult($id);
     }
     return $res;
 }
Exemple #18
0
 function Free()
 {
     if ($this->result) {
         if (version_compare(phpversion(), "4.2.0", "ge") > 0) {
             pg_free_result($this->result);
         } else {
             pg_freeresult($this->result);
         }
     }
 }
 function _Free()
 {
     return @pg_freeresult($this->resultid);
 }
Exemple #20
0
/**
 * Frees a result set.
 *
 * @param resource $res The database query resource returned from
 *                      the {@link dbi_query()} function.
 *
 * @return bool True on success
 */
function dbi_free_result($res)
{
    if (strcmp($GLOBALS["db_type"], "mysql") == 0) {
        return mysql_free_result($res);
    } else {
        if (strcmp($GLOBALS["db_type"], "mysqli") == 0) {
            return mysqli_free_result($res);
        } else {
            if (strcmp($GLOBALS["db_type"], "mssql") == 0) {
                return mssql_free_result($res);
            } else {
                if (strcmp($GLOBALS["db_type"], "oracle") == 0) {
                    // Not supported.  Ingore.
                    if ($GLOBALS["oracle_statement"] >= 0) {
                        OCIFreeStatement($GLOBALS["oracle_statement"]);
                        $GLOBALS["oracle_statement"] = -1;
                    }
                } else {
                    if (strcmp($GLOBALS["db_type"], "postgresql") == 0) {
                        return pg_freeresult($res);
                    } else {
                        if (strcmp($GLOBALS["db_type"], "odbc") == 0) {
                            return odbc_free_result($res);
                        } else {
                            if (strcmp($GLOBALS["db_type"], "ibm_db2") == 0) {
                                return db2_free_result($res);
                            } else {
                                if (strcmp($GLOBALS["db_type"], "ibase") == 0) {
                                    return ibase_free_result($res);
                                } else {
                                    dbi_fatal_error("dbi_free_result(): db_type not defined.");
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
Exemple #21
0
 function FreeResult($result)
 {
     unset($this->highest_fetched_row[$result]);
     unset($this->columns[$result]);
     unset($this->result_types[$result]);
     unset($this->result_columns[$result]);
     return pg_freeresult($result);
 }
Exemple #22
0
 /**
  * Returns information about a table or a result set.
  *
  * NOTE: only supports 'table' and 'flags' if <var>$result</var>
  * is a table name.
  *
  * @param object|string  $result  DB_result object from a query or a
  *                                string containing the name of a table
  * @param int            $mode    a valid tableInfo mode
  * @return array  an associative array with the information requested
  *                or an error object if something is wrong
  * @access public
  * @internal
  * @see DB_common::tableInfo()
  */
 function tableInfo($result, $mode = null)
 {
     if (isset($result->result)) {
         /*
          * Probably received a result object.
          * Extract the result resource identifier.
          */
         $id = $result->result;
         $got_string = false;
     } elseif (is_string($result)) {
         /*
          * Probably received a table name.
          * Create a result resource identifier.
          */
         $id = @pg_exec($this->connection, "SELECT * FROM {$result} LIMIT 0");
         $got_string = true;
     } else {
         /*
          * Probably received a result resource identifier.
          * Copy it.
          * Deprecated.  Here for compatibility only.
          */
         $id = $result;
         $got_string = false;
     }
     if (!is_resource($id)) {
         return $this->pgsqlRaiseError(DB_ERROR_NEED_MORE_DATA);
     }
     if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
         $case_func = 'strtolower';
     } else {
         $case_func = 'strval';
     }
     $count = @pg_numfields($id);
     // made this IF due to performance (one if is faster than $count if's)
     if (!$mode) {
         for ($i = 0; $i < $count; $i++) {
             $res[$i]['table'] = $got_string ? $case_func($result) : '';
             $res[$i]['name'] = $case_func(@pg_fieldname($id, $i));
             $res[$i]['type'] = @pg_fieldtype($id, $i);
             $res[$i]['len'] = @pg_fieldsize($id, $i);
             $res[$i]['flags'] = $got_string ? $this->_pgFieldflags($id, $i, $result) : '';
         }
     } else {
         // full
         $res['num_fields'] = $count;
         for ($i = 0; $i < $count; $i++) {
             $res[$i]['table'] = $got_string ? $case_func($result) : '';
             $res[$i]['name'] = $case_func(@pg_fieldname($id, $i));
             $res[$i]['type'] = @pg_fieldtype($id, $i);
             $res[$i]['len'] = @pg_fieldsize($id, $i);
             $res[$i]['flags'] = $got_string ? $this->_pgFieldFlags($id, $i, $result) : '';
             if ($mode & DB_TABLEINFO_ORDER) {
                 $res['order'][$res[$i]['name']] = $i;
             }
             if ($mode & DB_TABLEINFO_ORDERTABLE) {
                 $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
             }
         }
     }
     // free the result only if we were called on a table
     if ($got_string) {
         @pg_freeresult($id);
     }
     return $res;
 }
            if (strlen($username[$x]) < 4) {
                $mmsg .= "\t";
            }
            if (strlen($username[$x]) <= 10) {
                $mmsg .= "\t";
            }
            $mmsg .= "\tSignup IP : " . $ols->signup_ip;
            if (strlen($ols->signup_ip) < 12) {
                $mmsg .= "\t";
            }
            if ($ols->signup_ip == "") {
                $mmsg .= "\t";
            }
            $res0 = pg_safe_exec("SELECT COUNT(levels.access) AS count FROM channels,levels WHERE levels.user_id='" . $id[$x] . "' AND levels.channel_id=channels.id AND channels.registered_ts>0");
            $row0 = pg_fetch_object($res0);
            @pg_freeresult($res0);
            $mmsg .= "\t# axs : " . $row0->count;
            $mmsg .= "\tVerif.Answer : " . $ols->verificationdata;
            if (strlen($ols->verificationdata) < 9) {
                $mmsg .= "\t";
            }
            if ($ols->verificationdata == "") {
                $mmsg .= "\t";
            }
            $mmsg .= "\tEMail : " . $email[$x] . "\n";
            $mail_lines++;
        }
    }
}
if ($debug_me) {
    echo "\n\nFRAUD Reason : <b>" . $freason . "</b>\n";
Exemple #24
0
 function Execute($sql)
 {
     $sql = str_replace("''", 'NULL', $sql);
     LogSQL($sql);
     $rs = pg_exec($this->id, $sql);
     $success = false;
     if ($rs) {
         $success = true;
         pg_freeresult($rs);
     } else {
         $this->traceback[] = $this->GetError();
     }
     return $success;
 }
 function _query($sql, $inputarr = false)
 {
     if (!$this->_bindInputArray) {
         // We don't have native support for parameterized queries, so let's emulate it at the parent
         return ADODB_postgres64::_query($sql, $inputarr);
     }
     $this->_pnum = 0;
     $this->_errorMsg = false;
     // -- added Cristiano da Cunha Duarte
     if ($inputarr) {
         $sqlarr = explode('?', trim($sql));
         $sql = '';
         $i = 1;
         $last = sizeof($sqlarr) - 1;
         foreach ($sqlarr as $v) {
             if ($last < $i) {
                 $sql .= $v;
             } else {
                 $sql .= $v . ' $' . $i;
             }
             $i++;
         }
         $rez = pg_query_params($this->_connectionID, $sql, $inputarr);
     } else {
         $rez = pg_query($this->_connectionID, $sql);
     }
     // check if no data returned, then no need to create real recordset
     if ($rez && pg_numfields($rez) <= 0) {
         if (is_resource($this->_resultid) && get_resource_type($this->_resultid) === 'pgsql result') {
             pg_freeresult($this->_resultid);
         }
         $this->_resultid = $rez;
         return true;
     }
     return $rez;
 }
 /**
  * db::free_results()
  * 
  * @return 
  **/
 function free_results()
 {
     global $GonxAdmin;
     switch ($GonxAdmin["dbtype"]) {
         case "mysql":
             return mysql_free_result($this->dbQryResult);
             break;
         case "postgresql":
             return pg_freeresult($this->dbQryResult);
             break;
         case "oracle":
             return OCIRowCount($this->Link_ID);
             break;
         case "sqlite":
             break;
         case "mssql":
             return mssql_free_result($this->dbQryResult);
             break;
     }
 }
Exemple #27
0
											</div>
											<div style="float:left;">
												<b>Venue</b>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $row[1] . '<br />
												<b>Rating</b>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . round($row[3], 2) . '<br />';
            if (!$distinct) {
                $rating_results = $rating_results . '<b>Checkin Date</b>:&nbsp;&nbsp;&nbsp;&nbsp;' . substr($row[4], 0, 19) . '<br />';
            }
            $rating_results = $rating_results . '<br /><a href="' . $root . '/venue/' . $row[0] . '"><b>Visit venue page</b></a><br />
											</div>
										</div>
										';
        }
        pg_freeresult($result);
        echo $rating_results;
        exit;
    } else {
        pg_freeresult($result);
        echo "<script type='text/javascript'>\n\t\t\t\t\t\t\t\t\tjError('This user has never checked in anywhere!',\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tonClosed:function()\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\twindow.location.href='" . $root . "/profile/" . $id . "/'\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t</script>";
        exit;
    }
}
?>
							</div>
						</div>
					</div>
				</div>
			</div>
		</section>
	</section>
</body>
</html>
Exemple #28
0
 function free_result()
 {
     @pg_freeresult($this->Query_ID);
     $this->Query_ID = 0;
 }
Exemple #29
0
 <td><b>Amount</b>

<?

        $stati=pg_exec($db,"select * from status order by statusid");
        $ln=pg_numrows($stati);
        for($i=0;$i<$ln;$i++){
                $stat=pg_fetch_array($stati,$i);
                $amtr=pg_exec("select count(licenseid) from license where adminid='".$user->getusername()."' and statusid=".$stat["statusid"]);
                $amt=pg_result($amtr,0,0);
                pg_freeresult($amtr);
                print("<tr><td><font color=\"".$stat["colordef"]."\">".($amt>0?"<b>":"").$stat["status"].($amt>0?"</b>":"")."</font><td>");
                print($amt."</tr>\n");
        }

        pg_freeresult($stati);

?>

</table>

<h2>Expirations</h2>

(yet not working)<p>

<table frame=1 border=1>
<tr>
 <td><b>Product</b>
 <td><b>Version</b>
 <td><b>Licensenumber</b>
 <td><b>Possessor</b>
/**
 *
 *  Frees a database result properly 
 *
 *  @param qhandle query result set handle
 *
 */
function db_free_result($qhandle)
{
    return @pg_freeresult($qhandle);
}