Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit135dea6

Browse files
committed
Since PQoidStatus is deprecated, we should probably stop using it in
our own code ...
1 parent633b5d5 commit135dea6

File tree

4 files changed

+22
-16
lines changed

4 files changed

+22
-16
lines changed

‎doc/src/sgml/libpq.sgml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.65 2001/08/1014:42:47 momjian Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.66 2001/08/1022:50:09 tgl Exp $
33
-->
44

55
<chapter id="libpq">
@@ -1073,8 +1073,9 @@ char * PQcmdTuples(const PGresult *res);
10731073
<listitem>
10741074
<para>
10751075
<function>PQoidValue</function>
1076-
Returns the object id of the tuple
1077-
inserted, if the <acronym>SQL</acronym> command was an INSERT.
1076+
Returns the object id of the tuple inserted, if the
1077+
<acronym>SQL</acronym> command was an INSERT
1078+
that inserted exactly one row into a table that has OIDs.
10781079
Otherwise, returns <literal>InvalidOid</literal>.
10791080
<synopsis>
10801081
Oid PQoidValue(const PGresult *res);
@@ -1088,9 +1089,11 @@ Oid PQoidValue(const PGresult *res);
10881089
<listitem>
10891090
<para>
10901091
<function>PQoidStatus</function>
1091-
Returns a string with the object id of the tuple
1092-
inserted, if the <acronym>SQL</acronym> command was an INSERT.
1093-
Otherwise, returns an empty string.
1092+
Returns a string with the object id of the tuple inserted, if the
1093+
<acronym>SQL</acronym> command was an INSERT.
1094+
(The string will be "0" if the INSERT did not insert exactly one
1095+
row, or if the target table does not have OIDs.) If the command
1096+
was not an INSERT, returns an empty string.
10941097
<synopsis>
10951098
char * PQoidStatus(const PGresult *res);
10961099
</synopsis>

‎src/bin/pg_dump/pg_dump.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*
2323
*
2424
* IDENTIFICATION
25-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.219 2001/08/1018:57:38 tgl Exp $
25+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.220 2001/08/1022:50:09 tgl Exp $
2626
*
2727
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
2828
*
@@ -4698,7 +4698,7 @@ setMaxOid(Archive *fout)
46984698
write_msg(NULL,"could not insert into pgdump_oid table: %s",PQerrorMessage(g_conn));
46994699
exit_nicely();
47004700
}
4701-
max_oid=atooid(PQoidStatus(res));
4701+
max_oid=PQoidValue(res);
47024702
if (max_oid==0)
47034703
{
47044704
write_msg(NULL,"inserted invalid oid\n");

‎src/interfaces/ecpg/lib/execute.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ ECPGexecute(struct statement * stmt)
937937
break;
938938
casePGRES_COMMAND_OK:
939939
status= true;
940-
sqlca.sqlerrd[1]=atol(PQoidStatus(results));
940+
sqlca.sqlerrd[1]=PQoidValue(results);
941941
sqlca.sqlerrd[2]=atol(PQcmdTuples(results));
942942
ECPGlog("ECPGexecute line %d Ok: %s\n",stmt->lineno,PQcmdStatus(results));
943943
if (!sqlca.sqlerrd[2]&& (!strncmp(PQcmdStatus(results),"UPDATE",6)
@@ -1032,7 +1032,7 @@ ECPGdo(int lineno, const char *connection_name, char *query,...)
10321032
*
10331033
* Copyright (c) 2000, Christof Petig <christof.petig@wtal.de>
10341034
*
1035-
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.19 2001/03/22 04:01:19 momjian Exp $
1035+
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.20 2001/08/10 22:50:10 tgl Exp $
10361036
*/
10371037

10381038
PGconn*ECPG_internal_get_connection(char*name);
@@ -1101,7 +1101,7 @@ execute_descriptor(int lineno, const char *query
11011101
break;
11021102
casePGRES_COMMAND_OK:
11031103
status= true;
1104-
sqlca.sqlerrd[1]=atol(PQoidStatus(results));
1104+
sqlca.sqlerrd[1]=PQoidValue(results);
11051105
sqlca.sqlerrd[2]=atol(PQcmdTuples(results));
11061106
ECPGlog("ECPGexecute line %d Ok: %s\n",lineno,PQcmdStatus(results));
11071107
break;

‎src/interfaces/libpgtcl/pgtclCmds.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclCmds.c,v 1.55 2001/03/22 04:01:23 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclCmds.c,v 1.56 2001/08/10 22:50:10 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -574,7 +574,7 @@ Pg_result(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
574574
returnPgGetConnByResultId(interp,argv[1]);
575575
elseif (strcmp(opt,"-oid")==0)
576576
{
577-
Tcl_AppendResult(interp,PQoidStatus(result),0);
577+
sprintf(interp->result,"%u",PQoidValue(result));
578578
returnTCL_OK;
579579
}
580580
elseif (strcmp(opt,"-clear")==0)
@@ -900,12 +900,15 @@ Pg_execute(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
900900

901901
/*
902902
* Set the oid variable to the returned oid of an INSERT statement if
903-
* requested (oran empty string if it wasn't an INSERT)
903+
* requested (or0 if it wasn't an INSERT)
904904
*/
905905
if (oid_varname!=NULL)
906906
{
907-
if (Tcl_SetVar(interp,oid_varname,
908-
PQoidStatus(result),TCL_LEAVE_ERR_MSG)!=TCL_OK)
907+
charoid_buf[32];
908+
909+
sprintf(oid_buf,"%u",PQoidValue(result));
910+
if (Tcl_SetVar(interp,oid_varname,oid_buf,
911+
TCL_LEAVE_ERR_MSG)!=TCL_OK)
909912
{
910913
PQclear(result);
911914
returnTCL_ERROR;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp