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


PHP pg_Exec函数代码示例

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


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

示例1: 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

示例2: 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

示例3: execQuery

 public function execQuery($name, $query)
 {
     if ($GLOBALS['DB_DEBUG']) {
         echo $query . '<br>';
     }
     if ($this->connection) {
         $this->freeResult($name);
         $this->result[$name] = pg_Exec($this->connection, $query);
     }
     $this->row = 0;
     return $this->result[$name];
 }
开发者ID:rawork,项目名称:colors-life,代码行数:12,代码来源:pgConnector.php

示例4: execute

 function execute($sql, $db, $type = "mysql")
 {
     $start = $this->row * $this->numrowsperpage;
     if ($type == "mysql") {
         $result = mysql_query($sql, $db);
         $this->total_records = mysql_num_rows($result);
         $sql .= " LIMIT {$start}, {$this->numrowsperpage}";
         $result = mysql_query($sql, $db);
     } elseif ($type == "pgsql") {
         $result = pg_Exec($db, $sql);
         $this->total_records = pg_NumRows($result);
         $sql .= " LIMIT {$this->numrowsperpage}, {$start}";
         $result = pg_Exec($db, $sql);
     }
     return $result;
 }
开发者ID:wborbajr,项目名称:TecnodataApp,代码行数:16,代码来源:navbar.php

示例5: execute

 function execute($sql, $db, $type = "mysql")
 {
     global $total_records, $row, $numtoshow;
     $numtoshow = $this->numrowsperpage;
     if (!isset($row)) {
         $row = 0;
     }
     $start = $row * $numtoshow;
     if ($type == "mysql") {
         $result = mysql_query($sql, $db);
         $total_records = mysql_num_rows($result);
         $sql .= " LIMIT {$start}, {$numtoshow}";
         $result = mysql_query($sql, $db);
     } elseif ($type == "pgsql") {
         $result = pg_Exec($db, $sql);
         $total_records = pg_NumRows($result);
         $sql .= " LIMIT {$numtoshow}, {$start}";
         $result = pg_Exec($db, $sql);
     }
     return $result;
 }
开发者ID:redrock,项目名称:xlrstats-web-v2,代码行数:21,代码来源:inc_recordnav.php

示例6: fcdb_query_single_value

function fcdb_query_single_value($stmt)
{
    global $fcdb_sel, $fcdb_conn;
    set_error_handler("fcdb_error_handler");
    switch ($fcdb_sel) {
        case "PostgreSQL":
            $res = pg_Exec($fcdb_conn, $stmt);
            if (!$res) {
                build_fcdb_error("I cannot run a query: '{$stmt}'.");
            }
            $val = pg_Result($res, 0, 0);
            break;
        case "MySQL":
            $res = mysql_query($stmt, $fcdb_conn);
            if (!$res) {
                build_fcdb_error("I cannot run a query: '{$stmt}'.");
            }
            $val = mysql_result($res, 0, 0);
            break;
    }
    restore_error_handler();
    return $val;
}
开发者ID:andreasrosdal,项目名称:freeciv-web,代码行数:23,代码来源:fcdb.php

示例7: listOptionsLabel

function listOptionsLabel($dataset, $choixdef)
{
    global $database;
    $result = pg_Exec($database, "SELECT * FROM " . $dataset);
    $Nbr = pg_NumRows($result);
    for ($i = 0; $i < $Nbr; $i++) {
        $tablo[$i] = pg_fetch_array($result, $i);
    }
    if ($Nbr > 2) {
        sort($tablo);
    }
    echo "<select name=liste_" . $dataset . ">\n";
    for ($i = 0; $i < $Nbr; $i++) {
        list($cle, $label) = $tablo[$i];
        if ($cle == $choixdef) {
            echo "  <option selected>" . $cle . " = " . $label . "</option>\n";
        } else {
            echo "  <option>" . $cle . " = " . $label . "</option>\n";
        }
    }
    echo "</select>\n";
    return 1;
}
开发者ID:pierrechtux,项目名称:QCV,代码行数:23,代码来源:inc_select.php

示例8: execute

 function execute($sql, $db, $type = "mysql")
 {
     global $total_records, $row, $numtoshow;
     $numtoshow = $this->numrowsperpage;
     if (!isset($_GET['row'])) {
         $row = 0;
     } else {
         $row = $_GET['row'];
     }
     $start = $row * $numtoshow;
     if ($type == "mysql") {
         // echo " the sql statement is --".$sql."and Db is --".$db;
         $query_result = mysql_query($sql, $db);
         //$total_records = mysql_num_rows($query_result);
         $sql .= " LIMIT {$start}, {$numtoshow}";
         $query_result = mysql_query($sql, $db);
     } elseif ($type == "pgsql") {
         $query_result = pg_Exec($db, $sql);
         $total_records = pg_NumRows($query_result);
         $sql .= " LIMIT {$numtoshow}, {$start}";
         $query_result = pg_Exec($db, $sql);
     }
     return $query_result;
 }
开发者ID:sraj4,项目名称:EthicsPublicHtmlProd,代码行数:24,代码来源:navbar.php

示例9: Sincronizar

function Sincronizar($db)
{
    $rows = 0;
    // Number of rows
    $qid = 0;
    // Query result resource
    // See PostgreSQL developer manual (www.postgresql.org) for system table spec.
    // Get catalog data from system tables.
    $sql = 'SELECT * FROM migracion.f_sincronizacion()';
    $qid = pg_Exec($db, $sql);
    // Check error
    if (!is_resource($qid)) {
        print 'Error en la Sincronizacion';
        return null;
    }
    $rows = pg_NumRows($qid);
    // Store meta data
    for ($i = 0; $i < $rows; $i++) {
        $res = pg_Result($qid, $i, 0);
        // Field Name
    }
    echo 'Sincronizacion terminada (' . $res . ')  - ' . date("m-d-Y H:i:s") . '<BR>';
    return $res;
}
开发者ID:rensi4rn,项目名称:ADQUI_BOA,代码行数:24,代码来源:ActionSincronizarPXP.php

示例10: Setup

 function Setup()
 {
     if (!function_exists("pg_connect")) {
         return "PostgreSQL support is not available in this PHP configuration";
     }
     $this->supported["Sequences"] = $this->supported["Indexes"] = $this->supported["SummaryFunctions"] = $this->supported["OrderByText"] = $this->supported["Transactions"] = $this->supported["GetSequenceCurrentValue"] = $this->supported["SelectRowRanges"] = $this->supported["LOBs"] = $this->supported["Replace"] = $this->supported["AutoIncrement"] = $this->supported["PrimaryKey"] = $this->supported["OmitInsertKey"] = $this->supported["OmitInsertKey"] = $this->supported["PatternBuild"] = 1;
     if (function_exists("pg_cmdTuples")) {
         if ($connection = $this->DoConnect("template1", 0)) {
             if ($result = @pg_Exec($connection, "BEGIN")) {
                 $error_reporting = error_reporting(63);
                 @pg_cmdTuples($result);
                 if (!isset($php_errormsg) || strcmp($php_errormsg, "This compilation does not support pg_cmdtuples()")) {
                     $this->supported["AffectedRows"] = 1;
                 }
                 error_reporting($error_reporting);
             } else {
                 $this->SetError("Setup", pg_ErrorMessage($connection));
             }
             pg_Close($connection);
         } else {
             $result = 0;
         }
         if (!$result) {
             return $this->Error();
         }
     }
     if (isset($this->options["EmulateDecimal"]) && $this->options["EmulateDecimal"]) {
         $this->emulate_decimal = 1;
         $this->decimal_factor = pow(10.0, $this->decimal_places);
     }
     return "";
 }
开发者ID:wycus,项目名称:darmedic,代码行数:32,代码来源:metabase_pgsql.php

示例11: GetLastInsertID

 function GetLastInsertID($sTable)
 {
     @($res = pg_Exec($this->conn, "select currval('seq_{$sTable}')"));
     if ($res) {
         $Record = @pg_fetch_array($res, 0);
         @pg_FreeResult($res);
         return $Record[0];
     }
     trigger_error("Error getting last insert ID for table {$sTable}! " . pg_ErrorMessage());
     return -1;
 }
开发者ID:ljvblfz,项目名称:mysoftwarebrasil,代码行数:11,代码来源:class.DCL_DB_pgsql.inc.php

示例12: _standaloneQuery

 /**
  * execute a query
  *
  * @param string $query
  * @return
  * @access private
  */
 function _standaloneQuery($query)
 {
     if (($connection = $this->_doConnect('template1', 0)) == 0) {
         return $this->raiseError(MDB_ERROR_CONNECT_FAILED, NULL, NULL, '_standaloneQuery: Cannot connect to template1');
     }
     if (!($result = @pg_Exec($connection, $query))) {
         $this->raiseError(MDB_ERROR, NULL, NULL, '_standaloneQuery: ' . @pg_errormessage($connection));
     }
     pg_Close($connection);
     return $result;
 }
开发者ID:ookwudili,项目名称:chisimba,代码行数:18,代码来源:pgsql.php

示例13: header

<!DOCTYPE html>
<html>
<head>
	<title>Conexión Exitosa</title>
</head>

<body>
<font color="hotpink"><h1>Bienvenid@</h1></font>
<?php 
/*Conexion con la base de datos*/
header("Content-type: text/html; charset=utf8");
$v_usuario = $_POST["username"];
$v_password = $_POST["password"];
$v_tabla = $_POST["tabla"];
$conexion = pg_connect("host=localhost port=5432 dbname=eventos user={$v_usuario} password={$v_password}");
echo "Datos de la tabla <b>{$v_tabla}</b>";
echo "<BR>";
echo "<BR>";
if ($v_tabla == "evento") {
    $sql = "select * from {$v_tabla}";
    $resultado_set = pg_Exec($conexion, $sql);
    while ($row = pg_fetch_array($resultado_set)) {
        echo $row["cod_evento"] . ". <i>Nombre evento: </i>" . $row["nom_evento"] . " <i>Fecha: </i>" . $row["fecha_evento"] . " <i>Participantes: </i>" . $row["num_part_evento"] . " <i>Lugar: </i>" . $row["lug_evento"];
        echo "<BR>";
    }
}
pg_close($conexion);
?>
</body>
</html>
开发者ID:vivianamarquez,项目名称:Bases-de-Datos,代码行数:30,代码来源:conectar.php

示例14: get_last_insert_id

 /**
  * 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);
     }
 }
开发者ID:HaakonME,项目名称:porticoestate,代码行数:48,代码来源:class.db_adodb.inc.php

示例15: query

 function query(&$db, $query = "")
 {
     // Constructor of the query object.
     // executes the query, notifies the db object of the query result to clean
     // up later
     if ($query != "") {
         if (!empty($this->result)) {
             $this->free();
             // query not called as constructor therefore there may
             // be something to clean up.
         }
         $this->result = @pg_Exec($db->connect_id, $query);
         $db->addquery($this->result);
         $this->curr_row = 0;
         $this->query = $query;
     }
 }
开发者ID:carriercomm,项目名称:xmec,代码行数:17,代码来源:postgresql.php


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