Skip to content

Commit

Permalink
Merge pull request #22 from flightaware/issue21
Browse files Browse the repository at this point in the history
Change calling sequence for PgSetResultId to allow error pass back
  • Loading branch information
resuna authored Nov 14, 2017
2 parents 3536b79 + 5c4caac commit f34d022
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 18 deletions.
18 changes: 9 additions & 9 deletions configure
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for pgtcl 2.3.3.
# Generated by GNU Autoconf 2.69 for pgtcl 2.3.4.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
Expand Down Expand Up @@ -577,8 +577,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='pgtcl'
PACKAGE_TARNAME='pgtcl'
PACKAGE_VERSION='2.3.3'
PACKAGE_STRING='pgtcl 2.3.3'
PACKAGE_VERSION='2.3.4'
PACKAGE_STRING='pgtcl 2.3.4'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''

Expand Down Expand Up @@ -1303,7 +1303,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures pgtcl 2.3.3 to adapt to many kinds of systems.
\`configure' configures pgtcl 2.3.4 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
Expand Down Expand Up @@ -1364,7 +1364,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of pgtcl 2.3.3:";;
short | recursive ) echo "Configuration of pgtcl 2.3.4:";;
esac
cat <<\_ACEOF
Expand Down Expand Up @@ -1467,7 +1467,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
pgtcl configure 2.3.3
pgtcl configure 2.3.4
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
Expand Down Expand Up @@ -1832,7 +1832,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by pgtcl $as_me 2.3.3, which was
It was created by pgtcl $as_me 2.3.4, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
Expand Down Expand Up @@ -9412,7 +9412,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by pgtcl $as_me 2.3.3, which was
This file was extended by pgtcl $as_me 2.3.4, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
Expand Down Expand Up @@ -9465,7 +9465,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
pgtcl config.status 2.3.3
pgtcl config.status 2.3.4
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
Expand Down
2 changes: 1 addition & 1 deletion configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dnl to configure the system for the local environment.
# so you can encode the package version directly into the source files.
#-----------------------------------------------------------------------

AC_INIT([pgtcl], [2.3.3])
AC_INIT([pgtcl], [2.3.4])

#-----
# Version with patch stripped
Expand Down
31 changes: 26 additions & 5 deletions generic/pgtclCmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,11 @@ Pg_exec(ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])

if (result)
{
int rId = PgSetResultId(interp, connString, result);
int rId;
if(PgSetResultId(interp, connString, result, &rId) != TCL_OK) {
PQclear(result);
return TCL_ERROR;
}

ExecStatusType rStat = PQresultStatus(result);

Expand Down Expand Up @@ -936,7 +940,11 @@ Pg_exec_prepared(ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST

if (result)
{
int rId = PgSetResultId(interp, connString, result);
int rId;
if(PgSetResultId(interp, connString, result, &rId) != TCL_OK) {
PQclear(result);
return TCL_ERROR;
}

ExecStatusType rStat = PQresultStatus(result);

Expand Down Expand Up @@ -3765,7 +3773,11 @@ Pg_getresult(ClientData cData, Tcl_Interp *interp, int objc,
/* if there's a non-null result, give the caller the handle */
if (result)
{
int rId = PgSetResultId(interp, connString, result);
int rId;
if(PgSetResultId(interp, connString, result, &rId) != TCL_OK) {
PQclear(result);
return TCL_ERROR;
}

ExecStatusType rStat = PQresultStatus(result);

Expand Down Expand Up @@ -3839,7 +3851,11 @@ Pg_getdata(ClientData cData, Tcl_Interp *interp, int objc,
/* if there's a non-null result, give the caller the handle */
if (result)
{
int rId = PgSetResultId(interp, connString, result);
int rId;
if(PgSetResultId(interp, connString, result, &rId) != TCL_OK) {
PQclear(result);
return TCL_ERROR;
}

ExecStatusType rStat = PQresultStatus(result);

Expand Down Expand Up @@ -5118,7 +5134,12 @@ Pg_sql(ClientData cData, Tcl_Interp *interp, int objc,

if (((result != NULL) || (iResult > 0)) && !callback)
{
int rId = PgSetResultId(interp, connString, result);
int rId;
if(PgSetResultId(interp, connString, result, &rId) != TCL_OK) {
PQclear(result);
return TCL_ERROR;
}

ExecStatusType rStat = PQresultStatus(result);

if (rStat == PGRES_COPY_IN || rStat == PGRES_COPY_OUT)
Expand Down
6 changes: 4 additions & 2 deletions generic/pgtclId.c
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ PgDelConnectionId(DRIVER_DEL_PROTO)
*/

int
PgSetResultId(Tcl_Interp *interp, CONST84 char *connid_c, PGresult *res)
PgSetResultId(Tcl_Interp *interp, CONST84 char *connid_c, PGresult *res, int *idPtr)
{
Tcl_Channel conn_chan;
Pg_ConnectionId *connid;
Expand Down Expand Up @@ -904,7 +904,9 @@ PgSetResultId(Tcl_Interp *interp, CONST84 char *connid_c, PGresult *res)

Tcl_SetObjResult(interp, cmd);

return resid;
*idPtr = resid;

return TCL_OK;
}


Expand Down
2 changes: 1 addition & 1 deletion generic/pgtclId.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ extern PGconn *PgGetConnectionId(Tcl_Interp *interp, CONST84 char *id,
extern int PgDelConnectionId(DRIVER_DEL_PROTO);
extern int PgOutputProc(DRIVER_OUTPUT_PROTO);
extern int PgInputProc(DRIVER_INPUT_PROTO);
extern int PgSetResultId(Tcl_Interp *interp, CONST84 char *connid, PGresult *res);
extern int PgSetResultId(Tcl_Interp *interp, CONST84 char *connid, PGresult *res, int *idPtr);
extern PGresult *PgGetResultId(Tcl_Interp *interp, CONST84 char *id, Pg_resultid **resultidPtr);
extern void PgDelResultId(Tcl_Interp *interp, CONST84 char *id);
extern int PgGetConnByResultId(Tcl_Interp *interp, CONST84 char *resid);
Expand Down

0 comments on commit f34d022

Please sign in to comment.