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


PHP pg_getlastoid函数代码示例

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


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

示例1: _insertid

 function _insertid($table, $column)
 {
     if (!is_resource($this->_resultid) || get_resource_type($this->_resultid) !== 'pgsql result') {
         return false;
     }
     $oid = pg_getlastoid($this->_resultid);
     // to really return the id, we need the table and column-name, else we can only return the oid != id
     return empty($table) || empty($column) ? $oid : $this->GetOne("select {$column} FROM {$table} WHERE oid=" . (int) $oid);
 }
开发者ID:dasatti,项目名称:dashboard,代码行数:9,代码来源:adodb-postgres64.inc.php

示例2: _insertid

 function _insertid()
 {
     return pg_getlastoid($this->_resultid);
 }
开发者ID:qoire,项目名称:portal,代码行数:4,代码来源:adodb-postgres.inc.php

示例3: _insertid

 function _insertid()
 {
     if (!is_resource($this->_resultid)) {
         return false;
     }
     return pg_getlastoid($this->_resultid);
 }
开发者ID:BackupTheBerlios,项目名称:osiswebprinter,代码行数:7,代码来源:adodb-postgres64.inc.php

示例4: getInsertID

 function getInsertID()
 {
     return pg_getlastoid($this->result[$this->stack_last]);
 }
开发者ID:guohuadeng,项目名称:stampApp,代码行数:4,代码来源:pgsql.php

示例5: _insertid

 function _insertid()
 {
     if (!is_resource($this->_resultid) || get_resource_type($this->_resultid) !== 'pgsql result') {
         return false;
     }
     return pg_getlastoid($this->_resultid);
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:7,代码来源:adodb-postgres64.inc.php

示例6: db_last_oid

function db_last_oid()
{
    global $sys_dbhost, $sys_dbuser, $sys_dbpasswd, $sys_dbname, $db_debug, $conn, $conn_update, $QUERY_COUNT;
    global $DBSERVER, $OWNER, $PW, $DB;
    return pg_getlastoid($conn);
}
开发者ID:bfpi,项目名称:klarschiff-frontend-mit-mapbender,代码行数:6,代码来源:database-pgsql.php

示例7: db_insertid

/**
 *
 *  Returns the last primary key from an insert
 *
 *  @param qhandle query result set handle
 *  @param table_name is the name of the table you inserted into
 *  @param pkey_field_name is the field name of the primary key
 *
 */
function db_insertid($qhandle, $table_name, $pkey_field_name)
{
    $oid = @pg_getlastoid($qhandle);
    if ($oid) {
        $sql = "SELECT {$pkey_field_name} AS id FROM {$table_name} WHERE oid='{$oid}'";
        //echo $sql;
        $res = db_query($sql);
        if (db_numrows($res) > 0) {
            return db_result($res, 0, 'id');
        } else {
            //	echo "No Rows Matched";
            //	echo db_error();
            return 0;
        }
    } else {
        //		echo "No OID";
        //		echo db_error();
        return 0;
    }
}
开发者ID:BackupTheBerlios,项目名称:berlios,代码行数:29,代码来源:database-pgsql.php

示例8: get_last_insert_id

 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];
 }
开发者ID:helenadeus,项目名称:s3db.map,代码行数:20,代码来源:class.db_pgsql.inc.php

示例9: _insertid

	function _insertid($table,$column)
	{
		if (!is_resource($this->_resultid) || get_resource_type($this->_resultid) !== 'pgsql result') return false;
		$oid = pg_getlastoid($this->_resultid);
		// to really return the id, we need the table and column-name, else we can only return the oid != id
		return empty($table) || empty($column) ? $oid : $this->GetOne("SELECT $column FROM $table ORDER BY $column DESC LIMIT 1");
	}
开发者ID:joeymetal,项目名称:v1,代码行数:7,代码来源:adodb-postgres64.inc.php

示例10: pg_connect

<?php

include 'config.inc';
$db = pg_connect($conn_str);
$result = pg_exec("SELECT * FROM " . $table_name);
pg_numrows($result);
pg_numfields($result);
pg_fieldname($result, 0);
pg_fieldsize($result, 0);
pg_fieldtype($result, 0);
pg_fieldprtlen($result, 0);
pg_fieldisnull($result, 0);
pg_result($result, 0, 0);
$result = pg_exec("INSERT INTO " . $table_name . " VALUES (7777, 'KKK')");
$oid = pg_getlastoid($result);
pg_freeresult($result);
pg_errormessage();
$result = pg_exec("UPDATE " . $table_name . " SET str = 'QQQ' WHERE str like 'RGD';");
pg_cmdtuples($result);
echo "OK";
开发者ID:badlamer,项目名称:hhvm,代码行数:20,代码来源:98old_api.php

示例11: insert_id

 /**
  * Return the last insert ID
  * @return integer
  */
 protected function insert_id()
 {
     return @pg_getlastoid($this->resResult);
 }
开发者ID:jens-wetzel,项目名称:use2,代码行数:8,代码来源:DB_Postgresql.php

示例12: Add_table

 function Add_table($value, $func_fields = null, $func_table = null, $id_name = null)
 {
     //global $link;
     global $DBHandle;
     if ($func_fields != "") {
         $this->fields = $func_fields;
     }
     if ($func_table != "") {
         $this->table = $func_table;
     }
     $QUERY = "INSERT INTO \"" . $this->table . "\" (" . $this->fields . ") values (" . trim($value) . ")";
     if ($this->debug_st) {
         echo "<br>QUERY:" . $QUERY;
     }
     if (!($res = $DBHandle->query($QUERY))) {
         //if (! $res=DbExec($link, $QUERY)) {
         //$this -> errstr = "Could not create a new instance in the table '".$this -> table."'";
         $this->errstr = $DBHandle->Error;
         return false;
     }
     if ($id_name != "") {
         $oid = pg_getlastoid($res);
         if ($oid < 0) {
             return false;
         }
         $sql = 'SELECT "' . $id_name . '" FROM "' . $this->table . '" WHERE oid=\'' . $oid . '\'';
         if (!($res = $DBHandle->query($sql))) {
             return false;
         }
         $DBHandle->next_record();
         $row[] = $DBHandle->Record;
         return $row[0][0];
     }
     return true;
 }
开发者ID:butch,项目名称:asterisk-cdr-plus,代码行数:35,代码来源:Class.Table.php

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

示例14: _insertid

 function _insertid($table, $column)
 {
     if (!is_resource($this->_resultid) || get_resource_type($this->_resultid) !== 'pgsql result') {
         return false;
     }
     $oid = pg_getlastoid($this->_resultid);
     // to really return the id, we need the table and column-name, else we can only return the oid != id
     return empty($table) || empty($column) ? $oid : $this->GetOne("SELECT CURRVAL('" . $table . "_" . $column . "_seq')");
 }
开发者ID:ddrmoscow,项目名称:queXS,代码行数:9,代码来源:adodb-postgres64.inc.php


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