当前位置: 首页>>代码示例>>PHP>>正文


PHP pg_ErrorMessage函数代码示例

本文整理汇总了PHP中pg_ErrorMessage函数的典型用法代码示例。如果您正苦于以下问题:PHP pg_ErrorMessage函数的具体用法?PHP pg_ErrorMessage怎么用?PHP pg_ErrorMessage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pg_ErrorMessage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: pgquery

 function pgquery($query)
 {
     $result = pg_exec($this->pgcon(), $query);
     if (!$result) {
         $this->mydie("Could not successfully run query ({$query}) from DB: " . pg_ErrorMessage());
     }
     return $result;
 }
开发者ID:najamelan,项目名称:vhffs-4.5,代码行数:8,代码来源:VHFFSAuthPlugin.php

示例2: pg_db_send_query

 function pg_db_send_query($iConn, $sQry)
 {
     $iQuery = @pg_send_query($iConn, $sQry);
     if (!$iQuery) {
         $erro = pg_ErrorMessage($iConn) . "\n" . $sQry;
         msgErro($erro);
     }
     return $iQuery;
 }
开发者ID:brunopagno,项目名称:everydayvis,代码行数:9,代码来源:postgresql.php

示例3: exec_query

function exec_query($connection, $query)
{
    $result = pg_Exec($connection, $query);
    if (!$result) {
        echo "Connection to database failed.";
        echo pg_ErrorMessage($connection);
        return 0;
    }
    return $result;
}
开发者ID:pierrechtux,项目名称:QCV,代码行数:10,代码来源:database_functions.php

示例4: StandaloneQuery

 function StandaloneQuery(&$db, $query)
 {
     if (($connection = $db->DoConnect("template1", 0)) == 0) {
         return 0;
     }
     if (!($success = @pg_Exec($connection, "{$query}"))) {
         $db->SetError("Standalone query", pg_ErrorMessage($connection));
     }
     pg_Close($connection);
     return $success;
 }
开发者ID:BackupTheBerlios,项目名称:zvs,代码行数:11,代码来源:manager_pgsql.php

示例5: connect

 function connect()
 {
     if ($this->isConnected()) {
         $this->setError("sqLink->connect(0): Already connected.");
         return false;
     }
     if ($this->db_host) {
         $this->db_host = "host = " . $this->db_host;
     }
     $this->db_link = pg_connect($this->db_host . ' dbname = ' . $this->db_name . ' user = ' . $this->db_user . ' password = ' . $this->db_pass);
     if ($this->db_link) {
         return true;
     } else {
         pg_close($this->db_link);
         $this->setError("Error: sqLink->connect(2) PSQL - " . pg_ErrorMessage($this->db_link));
         return false;
     }
 }
开发者ID:mmr,项目名称:b1n,代码行数:18,代码来源:sql_link.inc.php

示例6: connect

 function connect()
 {
     if ($this->isConnected()) {
         user_error('sqLink->connect(0): Already connected.');
         return false;
     }
     if ($this->db_host) {
         $this->db_host = "host = " . $this->db_host;
     }
     $this->db_link = pg_connect($this->db_host . " dbname = " . $this->db_name . " user = " . $this->db_user . " password = " . $this->db_pass);
     if ($this->db_link) {
         return true;
     } else {
         pg_close($this->db_link);
         user_error("Error: sqLink->connect(2)PSQL - " . pg_ErrorMessage($this->db_link));
         return false;
     }
 }
开发者ID:mmr,项目名称:b1n,代码行数:18,代码来源:sqllink.lib.php

示例7: metadata

 function metadata($table = "")
 {
     $count = 0;
     $id = 0;
     $res = array();
     if ($table) {
         $this->connect();
         $id = pg_exec($this->Link_ID, "SELECT * FROM {$table}");
         if ($id < 0) {
             $this->Error = pg_ErrorMessage($id);
             $this->Errno = 1;
             $this->halt("Metadata query failed.");
         }
     } else {
         $id = $this->Query_ID;
         if (!$id) {
             $this->halt("No query specified.");
         }
     }
     $count = pg_NumFields($id);
     for ($i = 0; $i < $count; $i++) {
         $res[$i]["table"] = $table;
         $res[$i]["name"] = pg_FieldName($id, $i);
         $res[$i]["type"] = pg_FieldType($id, $i);
         $res[$i]["len"] = pg_FieldSize($id, $i);
         $res[$i]["flags"] = "";
     }
     if ($table) {
         pg_FreeResult($id);
     }
     return $res;
 }
开发者ID:BackupTheBerlios,项目名称:core-svn,代码行数:32,代码来源:cls_db_pgsql.php

示例8: die

if (!file_exists($filename) || filemtime($filename) + $period < time()) {
    // get graph information
    global $db;
    // XXX CHANGE THE QUERY XXX
    $data = @pg_exec($db, "select query, title, label, is_clickable from graphs where id = {$id}") or die("PGERR 1: " . pg_ErrorMessage());
    if (pg_numrows($data) == 0) {
        die("GRAPH: invalid id");
    }
    $r = pg_fetch_row($data, $i);
    $query = $r[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");
开发者ID:brycied00d,项目名称:freshports,代码行数:31,代码来源:graph.php

示例9: metadata

 function metadata($table)
 {
     $count = 0;
     $id = 0;
     $res = array();
     $this->connect();
     $id = pg_exec($this->Link_ID, "select * from {$table} LIMIT 1");
     if ($id < 0) {
         $this->Error = pg_ErrorMessage($id);
         $this->Errno = 1;
         $this->Errors->addError("Metadata query failed: " . $this->Error);
         return 0;
     }
     $count = pg_NumFields($id);
     for ($i = 0; $i < $count; $i++) {
         $res[$i]["table"] = $table;
         $res[$i]["name"] = pg_FieldName($id, $i);
         $res[$i]["type"] = pg_FieldType($id, $i);
         $res[$i]["len"] = pg_FieldSize($id, $i);
         $res[$i]["flags"] = "";
     }
     pg_FreeResult($id);
     return $res;
 }
开发者ID:rayminami,项目名称:chumanis,代码行数:24,代码来源:db_pgsql.php

示例10: errDie

/**
 * reports ands logs error
 *
 * skip the log of there are filesystem problems.
 *
 * @param string $err
 * @param bool $skiplog
 */
function errDie($errstring, $skiplog = false)
{
    $err = DATE_LOGGING . " - " . SELF . " - {$errstring}";
    if (pg_ErrorMessage()) {
        $err .= " - " . pg_ErrorMessage();
    }
    // log error to file
    die($errstring);
    if ($skiplog === false && ($fd = cfs::fopen("error_log", 'a'))) {
        if (cfs::fwrite($fd, "{$err}\n")) {
            $errlog_msg = "Error has been logged. Please notify the administrator.";
        } else {
            $errlog_msg = "Error writing to error log. Please notify the administrator.";
        }
        cfs::fclose($fd);
    } else {
        $errlog_msg = "Error opening error log. Please notify the administrator.";
    }
    $OUTPUT = "{$errstring} {$errlog_msg}";
    require "newtemplate.php";
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:29,代码来源:newsettings.php

示例11: _getLobValue

 /**
  * Convert a text value into a DBMS specific format that is suitable to
  * compose query statements.
  *
  * @param resource  $prepared_query query handle from prepare()
  * @param           $parameter
  * @param           $lob
  * @return string text string that represents the given argument value in
  *      a DBMS specific format.
  * @access private
  */
 function _getLobValue($prepared_query, $parameter, $lob)
 {
     $connect = $this->connect();
     if (MDB::isError($connect)) {
         return $connect;
     }
     if ($this->auto_commit && !@pg_exec($this->connection, 'BEGIN')) {
         return $this->raiseError(MDB_ERROR, NULL, NULL, '_getLobValue: error starting transaction');
     }
     if ($lo = @pg_locreate($this->connection)) {
         if ($handle = @pg_loopen($this->connection, $lo, 'w')) {
             while (!$this->endOfLob($lob)) {
                 $result = $this->readLob($lob, $data, $this->options['lob_buffer_length']);
                 if (MDB::isError($result)) {
                     break;
                 }
                 if (!@pg_lowrite($handle, $data)) {
                     $result = $this->raiseError(MDB_ERROR, NULL, NULL, 'Get LOB field value: ' . @pg_errormessage($this->connection));
                     break;
                 }
             }
             @pg_loclose($handle);
             if (!MDB::isError($result)) {
                 $value = strval($lo);
             }
         } else {
             $result = $this->raiseError(MDB_ERROR, NULL, NULL, 'Get LOB field value: ' . @pg_errormessage($this->connection));
         }
         if (MDB::isError($result)) {
             $result = @pg_lounlink($this->connection, $lo);
         }
     } else {
         $result = $this->raiseError(MDB_ERROR, NULL, NULL, 'Get LOB field value: ' . pg_ErrorMessage($this->connection));
     }
     if ($this->auto_commit) {
         @pg_exec($this->connection, 'END');
     }
     if (MDB::isError($result)) {
         return $result;
     }
     return $value;
 }
开发者ID:ookwudili,项目名称:chisimba,代码行数:53,代码来源:pgsql.php

示例12: _generate_csv

 function _generate_csv($query_string, $dbname = "mysql", $user = "root", $password = "", $host = "localhost")
 {
     /*echo " dbname=cdrasterisk host=db01.fr4.egwn.net user=ivr password=7Q8GFTK9fq </br>$query_string<br>";
       $ConnId = pg_connect("dbname=cdrasterisk host=db01.fr4.egwn.net user=ivr password=7Q8GFTK9fq");
       $ResId = pg_query ($ConnId, $query_string);
       if (!$ResId) pg_ErrorMessage($ResId);
       pg_close ($ConnId);
       $row = pg_fetch_array ($ResId, 4);
       print_r($row);
       exit();*/
     if (!($conn = $this->_db_connect($dbname, $user, $password, $host))) {
         die("Error. Cannot connect to Database.");
     } else {
         //$result = @mysql_query($query_string, $conn);
         $result = pg_query($conn, $query_string);
         if (!$result) {
             die("Could not perform the Query: " . pg_ErrorMessage($result));
             //die("Could not perform the Query: ".mysql_error());
         } else {
             $file = "";
             $crlf = $this->_define_newline();
             //while ($str= @mysql_fetch_array($result, MYSQL_NUM))
             while ($str = @pg_fetch_array($result, NULL, PGSQL_NUM)) {
                 $file .= $this->arrayToCsvString($str, ",") . $crlf;
             }
             echo $file;
         }
     }
 }
开发者ID:shinichi85,项目名称:voiperopen,代码行数:29,代码来源:iam_csvdump.php

示例13: halt

 function halt($msg, $line = '', $file = '')
 {
     /* private: error handling */
     if ($this->Halt_On_Error == 'no') {
         $this->Error = @pg_ErrorMessage($this->Link_ID);
         $this->Errno = 1;
         return;
     }
     /* Just in case there is a table currently locked */
     $this->transaction_abort();
     if ($this->xmlrpc || $this->soap) {
         $s = sprintf("Database error: %s\n", $msg);
         $s .= sprintf("PostgreSQL Error: %s\n\n (%s)\n\n", $this->Errno, $this->Error);
     } else {
         $s = sprintf("<b>Database error:</b> %s<br>\n", $msg);
         $s .= sprintf("<b>PostgreSQL Error</b>: %s (%s)<br>\n", $this->Errno, $this->Error);
     }
     if ($file) {
         if ($this->xmlrpc || $this->soap) {
             $s .= sprintf("File: %s\n", $file);
         } else {
             $s .= sprintf("<br><b>File:</b> %s", $file);
         }
     }
     if ($line) {
         if ($this->xmlrpc || $this->soap) {
             $s .= sprintf("Line: %s\n", $line);
         } else {
             $s .= sprintf("<br><b>Line:</b> %s", $line);
         }
     }
     if ($this->Halt_On_Error == 'yes') {
         if (!$this->xmlrpc && !$this->soap) {
             $s .= '<p><b>Session halted.</b>';
         }
     }
     if ($this->xmlrpc) {
         xmlrpcfault($s);
     } elseif ($this->soap) {
     } else {
         echo $s;
         //$GLOBALS['phpgw']->common->phpgw_exit(True);
     }
 }
开发者ID:helenadeus,项目名称:s3db.map,代码行数:44,代码来源:class.db_pgsql.inc.php

示例14: errDie

function errDie($usrString)
{
    $ERROR = DATE_LOGGING . " - " . SELF . " - " . USER_NAME . " - " . $usrString;
    // Create error from scriptname & user string
    if (pg_ErrorMessage()) {
        $ERROR .= " - " . pg_ErrorMessage();
    }
    // log error to file
    $ERROR_LOG = fopen("error_log", 'a') or die("ERROR while opening error_log. Please notify the administrator.");
    flock($ERROR_LOG, LOCK_EX) or die("ERROR obtaining file lock on error_log. Please notify the administrator.");
    fwrite($ERROR_LOG, $ERROR . "\n") or die("ERROR writing to error_log. Please notify the administrator.");
    flock($ERROR_LOG, LOCK_UN);
    fclose($ERROR_LOG);
    $OUTPUT = $usrString . " Error has been logged, please notify the administrator.";
    require "template.php";
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:16,代码来源:setting_old.php

示例15: pg_connect

<?php

$link = pg_connect("host=localhost port=5432 password=ICInf-551 user=icinf5 dbname=icinf5");
if (!$link) {
    die(' Error al conectarse ' . pg_ErrorMessage($link));
}
开发者ID:0fbn,项目名称:proyecto-isw,代码行数:6,代码来源:conexion.php


注:本文中的pg_ErrorMessage函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。