Since PQoidStatus is deprecated, we should probably stop using it in
authorTom Lane
Fri, 10 Aug 2001 22:50:10 +0000 (22:50 +0000)
committerTom Lane
Fri, 10 Aug 2001 22:50:10 +0000 (22:50 +0000)
our own code ...

doc/src/sgml/libpq.sgml
src/bin/pg_dump/pg_dump.c
src/interfaces/ecpg/lib/execute.c
src/interfaces/libpgtcl/pgtclCmds.c

index 7e16dee59a19ee247cfc6f0d178bc9efe63e06cd..edda51533fed946d6465703b1e7c48e5ba27596f 100644 (file)
@@ -1,5 +1,5 @@
 
 
  
@@ -1073,8 +1073,9 @@ char * PQcmdTuples(const PGresult *res);
 
 
 PQoidValue
-          Returns the object id of  the  tuple
-          inserted,  if  the SQL command was an INSERT.
+          Returns the object id of the tuple inserted, if the
+     SQL command was an INSERT
+     that inserted exactly one row into a table that has OIDs.
           Otherwise, returns InvalidOid.
 
 Oid PQoidValue(const PGresult *res);
@@ -1088,9 +1089,11 @@ Oid PQoidValue(const PGresult *res);
 
 
 PQoidStatus
-          Returns a string with the object id of  the  tuple
-          inserted,  if  the SQL command was an INSERT.
-          Otherwise, returns an empty string.
+          Returns a string with the object id of the tuple inserted, if the
+     SQL command was an INSERT.
+     (The string will be "0" if the INSERT did not insert exactly one
+     row, or if the target table does not have OIDs.)  If the command
+     was not an INSERT, returns an empty string.
 
 char * PQoidStatus(const PGresult *res);
 
index 82675bbf573d2d1eaa8739cd519bb04edf059338..958ad3298507f13a7008b320f981884d5fb9ed25 100644 (file)
@@ -22,7 +22,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.219 2001/08/10 18:57:38 tgl Exp $
+ *   $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.220 2001/08/10 22:50:09 tgl Exp $
  *
  * Modifications - 6/10/96 - [email protected] - version 1.13.dhb
  *
@@ -4698,7 +4698,7 @@ setMaxOid(Archive *fout)
        write_msg(NULL, "could not insert into pgdump_oid table: %s", PQerrorMessage(g_conn));
        exit_nicely();
    }
-   max_oid = atooid(PQoidStatus(res));
+   max_oid = PQoidValue(res);
    if (max_oid == 0)
    {
        write_msg(NULL, "inserted invalid oid\n");
index 99177844717d2d161f86ab153344c0a2d319c864..a947e957a86fd8ebce93c11750e9d12c71c53324 100644 (file)
@@ -937,7 +937,7 @@ ECPGexecute(struct statement * stmt)
                break;
            case PGRES_COMMAND_OK:
                status = true;
-               sqlca.sqlerrd[1] = atol(PQoidStatus(results));
+               sqlca.sqlerrd[1] = PQoidValue(results);
                sqlca.sqlerrd[2] = atol(PQcmdTuples(results));
                ECPGlog("ECPGexecute line %d Ok: %s\n", stmt->lineno, PQcmdStatus(results));
                if (!sqlca.sqlerrd[2] && (!strncmp(PQcmdStatus(results), "UPDATE", 6)
@@ -1032,7 +1032,7 @@ ECPGdo(int lineno, const char *connection_name, char *query,...)
  *
  * Copyright (c) 2000, Christof Petig 
  *
- * $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.19 2001/03/22 04:01:19 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.20 2001/08/10 22:50:10 tgl Exp $
  */
 
 PGconn    *ECPG_internal_get_connection(char *name);
@@ -1101,7 +1101,7 @@ execute_descriptor(int lineno, const char *query
                break;
            case PGRES_COMMAND_OK:
                status = true;
-               sqlca.sqlerrd[1] = atol(PQoidStatus(results));
+               sqlca.sqlerrd[1] = PQoidValue(results);
                sqlca.sqlerrd[2] = atol(PQcmdTuples(results));
                ECPGlog("ECPGexecute line %d Ok: %s\n", lineno, PQcmdStatus(results));
                break;
index bf9f56471f71facb29ecc7bb9a2872bb259a0bfb..a87cb1842cba1154209f3e1a6482d1bb5c2c45dd 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclCmds.c,v 1.55 2001/03/22 04:01:23 momjian Exp $
+ *   $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclCmds.c,v 1.56 2001/08/10 22:50:10 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -574,7 +574,7 @@ Pg_result(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
        return PgGetConnByResultId(interp, argv[1]);
    else if (strcmp(opt, "-oid") == 0)
    {
-       Tcl_AppendResult(interp, PQoidStatus(result), 0);
+       sprintf(interp->result, "%u", PQoidValue(result));
        return TCL_OK;
    }
    else if (strcmp(opt, "-clear") == 0)
@@ -900,12 +900,15 @@ Pg_execute(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
 
    /*
     * Set the oid variable to the returned oid of an INSERT statement if
-    * requested (or an empty string if it wasn't an INSERT)
+    * requested (or 0 if it wasn't an INSERT)
     */
    if (oid_varname != NULL)
    {
-       if (Tcl_SetVar(interp, oid_varname,
-                      PQoidStatus(result), TCL_LEAVE_ERR_MSG) != TCL_OK)
+       char        oid_buf[32];
+
+       sprintf(oid_buf, "%u", PQoidValue(result));
+       if (Tcl_SetVar(interp, oid_varname, oid_buf,
+                      TCL_LEAVE_ERR_MSG) != TCL_OK)
        {
            PQclear(result);
            return TCL_ERROR;