Make ecpg SQLSTATE-aware. Map existing SQLCODE assignments to SQLSTATEs,
rather than parsing the message. Add some documentation about embedded SQL.
This commit is contained in:
parent
1ffc5b05a3
commit
4f7df90db0
File diff suppressed because it is too large
Load Diff
@ -14,7 +14,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/commands/portalcmds.c,v 1.18 2003/07/28 00:09:14 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/backend/commands/portalcmds.c,v 1.19 2003/08/01 13:53:36 petere Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -169,8 +169,7 @@ PerformPortalFetch(FetchStmt *stmt,
|
|||||||
/* FIXME: shouldn't this be an ERROR? */
|
/* FIXME: shouldn't this be an ERROR? */
|
||||||
ereport(WARNING,
|
ereport(WARNING,
|
||||||
(errcode(ERRCODE_UNDEFINED_CURSOR),
|
(errcode(ERRCODE_UNDEFINED_CURSOR),
|
||||||
errmsg("portal \"%s\" does not exist", stmt->portalname),
|
errmsg("portal \"%s\" does not exist", stmt->portalname)));
|
||||||
errfunction("PerformPortalFetch"))); /* for ecpg */
|
|
||||||
if (completionTag)
|
if (completionTag)
|
||||||
strcpy(completionTag, stmt->ismove ? "MOVE 0" : "FETCH 0");
|
strcpy(completionTag, stmt->ismove ? "MOVE 0" : "FETCH 0");
|
||||||
return;
|
return;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 1994, Regents of the University of California
|
# Copyright (c) 1994, Regents of the University of California
|
||||||
#
|
#
|
||||||
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/compatlib/Makefile,v 1.5 2003/06/24 14:45:46 momjian Exp $
|
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/compatlib/Makefile,v 1.6 2003/08/01 13:53:36 petere Exp $
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ NAME= ecpg_compat
|
|||||||
SO_MAJOR_VERSION= 1
|
SO_MAJOR_VERSION= 1
|
||||||
SO_MINOR_VERSION= 0.0
|
SO_MINOR_VERSION= 0.0
|
||||||
|
|
||||||
override CPPFLAGS := -I$(top_srcdir)/src/interfaces/ecpg/include -I$(top_srcdir)/src/include/utils $(CPPFLAGS)
|
override CPPFLAGS := -I$(top_srcdir)/src/interfaces/ecpg/include -I$(libpq_srcdir) -I$(top_srcdir)/src/include/utils $(CPPFLAGS)
|
||||||
SHLIB_LINK = -L../pgtypeslib -lpgtypes -L../ecpglib -lecpg
|
SHLIB_LINK = -L../pgtypeslib -lpgtypes -L../ecpglib -lecpg
|
||||||
|
|
||||||
OBJS= informix.o
|
OBJS= informix.o
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.13 2003/08/01 08:21:04 meskes Exp $ */
|
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.14 2003/08/01 13:53:36 petere Exp $ */
|
||||||
|
|
||||||
#define POSTGRES_ECPG_INTERNAL
|
#define POSTGRES_ECPG_INTERNAL
|
||||||
#include "postgres_fe.h"
|
#include "postgres_fe.h"
|
||||||
@ -116,7 +116,7 @@ ECPGsetcommit(int lineno, const char *mode, const char *connection_name)
|
|||||||
{
|
{
|
||||||
if ((results = PQexec(con->connection, "begin transaction")) == NULL)
|
if ((results = PQexec(con->connection, "begin transaction")) == NULL)
|
||||||
{
|
{
|
||||||
ECPGraise(lineno, ECPG_TRANS, NULL, ECPG_COMPAT_PGSQL);
|
ECPGraise(lineno, ECPG_TRANS, ECPG_SQLSTATE_TRANSACTION_RESOLUTION_UNKNOWN, NULL);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PQclear(results);
|
PQclear(results);
|
||||||
@ -130,7 +130,7 @@ ECPGsetcommit(int lineno, const char *mode, const char *connection_name)
|
|||||||
{
|
{
|
||||||
if ((results = PQexec(con->connection, "commit")) == NULL)
|
if ((results = PQexec(con->connection, "commit")) == NULL)
|
||||||
{
|
{
|
||||||
ECPGraise(lineno, ECPG_TRANS, NULL, ECPG_COMPAT_PGSQL);
|
ECPGraise(lineno, ECPG_TRANS, ECPG_SQLSTATE_TRANSACTION_RESOLUTION_UNKNOWN, NULL);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PQclear(results);
|
PQclear(results);
|
||||||
@ -154,150 +154,46 @@ ECPGsetconn(int lineno, const char *connection_name)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ECPGnoticeProcessor_raise(int code, const char *message)
|
ECPGnoticeReceiver(void *arg, const PGresult *result)
|
||||||
{
|
{
|
||||||
|
char *sqlstate = PQresultErrorField(result, 'C');
|
||||||
|
char *message = PQresultErrorField(result, 'M');
|
||||||
struct sqlca_t *sqlca = ECPGget_sqlca();
|
struct sqlca_t *sqlca = ECPGget_sqlca();
|
||||||
sqlca->sqlcode = code;
|
|
||||||
|
int sqlcode;
|
||||||
|
|
||||||
|
/* these are not warnings */
|
||||||
|
if (strncmp(sqlstate, "00", 2)==0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ECPGlog("%s", message);
|
||||||
|
|
||||||
|
/* map to SQLCODE for backward compatibility */
|
||||||
|
if (strcmp(sqlstate, ECPG_SQLSTATE_INVALID_CURSOR_NAME)==0)
|
||||||
|
sqlcode = ECPG_WARNING_UNKNOWN_PORTAL;
|
||||||
|
else if (strcmp(sqlstate, ECPG_SQLSTATE_ACTIVE_SQL_TRANSACTION)==0)
|
||||||
|
sqlcode = ECPG_WARNING_IN_TRANSACTION;
|
||||||
|
else if (strcmp(sqlstate, ECPG_SQLSTATE_NO_ACTIVE_SQL_TRANSACTION)==0)
|
||||||
|
sqlcode = ECPG_WARNING_NO_TRANSACTION;
|
||||||
|
else if (strcmp(sqlstate, ECPG_SQLSTATE_DUPLICATE_CURSOR)==0)
|
||||||
|
sqlcode = ECPG_WARNING_PORTAL_EXISTS;
|
||||||
|
else
|
||||||
|
sqlcode = 0;
|
||||||
|
|
||||||
|
strncpy(sqlca->sqlstate, sqlstate, sizeof(sqlca->sqlstate));
|
||||||
|
sqlca->sqlcode = sqlcode;
|
||||||
|
sqlca->sqlwarn[2] = 'W';
|
||||||
|
sqlca->sqlwarn[0] = 'W';
|
||||||
|
|
||||||
strncpy(sqlca->sqlerrm.sqlerrmc, message, sizeof(sqlca->sqlerrm.sqlerrmc));
|
strncpy(sqlca->sqlerrm.sqlerrmc, message, sizeof(sqlca->sqlerrm.sqlerrmc));
|
||||||
sqlca->sqlerrm.sqlerrmc[sizeof(sqlca->sqlerrm.sqlerrmc) - 1] = 0;
|
sqlca->sqlerrm.sqlerrmc[sizeof(sqlca->sqlerrm.sqlerrmc) - 1] = 0;
|
||||||
sqlca->sqlerrm.sqlerrml = strlen(sqlca->sqlerrm.sqlerrmc);
|
sqlca->sqlerrm.sqlerrml = strlen(sqlca->sqlerrm.sqlerrmc);
|
||||||
|
|
||||||
/* remove trailing newline */
|
ECPGlog("raising sqlcode %d\n", sqlcode);
|
||||||
if (sqlca->sqlerrm.sqlerrml
|
|
||||||
&& sqlca->sqlerrm.sqlerrmc[sqlca->sqlerrm.sqlerrml - 1] == '\n')
|
|
||||||
{
|
|
||||||
sqlca->sqlerrm.sqlerrmc[sqlca->sqlerrm.sqlerrml - 1] = 0;
|
|
||||||
sqlca->sqlerrm.sqlerrml--;
|
|
||||||
}
|
|
||||||
|
|
||||||
ECPGlog("raising sqlcode %d\n", code);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* I know this is a mess, but we can't redesign the backend
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void
|
|
||||||
ECPGnoticeProcessor(void *arg, const char *message)
|
|
||||||
{
|
|
||||||
struct sqlca_t *sqlca = ECPGget_sqlca();
|
|
||||||
|
|
||||||
/* these notices raise an error */
|
|
||||||
if (strncmp(message, "WARNING: ", 9) && strncmp(message, "NOTICE: ", 8))
|
|
||||||
{
|
|
||||||
ECPGlog("ECPGnoticeProcessor: strange warning '%s'\n", message);
|
|
||||||
ECPGnoticeProcessor_raise(ECPG_WARNING_UNRECOGNIZED, message);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
message += 8;
|
|
||||||
while (*message == ' ')
|
|
||||||
message++;
|
|
||||||
ECPGlog("WARNING: %s", message);
|
|
||||||
|
|
||||||
/* WARNING: (transaction aborted): queries ignored until END */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* WARNING: current transaction is aborted, queries ignored until end
|
|
||||||
* of transaction block
|
|
||||||
*/
|
|
||||||
if (strstr(message, "queries ignored") && strstr(message, "transaction")
|
|
||||||
&& strstr(message, "aborted"))
|
|
||||||
{
|
|
||||||
ECPGnoticeProcessor_raise(ECPG_WARNING_QUERY_IGNORED, message);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* WARNING: PerformPortalClose: portal "*" not found */
|
|
||||||
if ((!strncmp(message, "PerformPortalClose: portal", 26)
|
|
||||||
|| !strncmp(message, "PerformPortalFetch: portal", 26))
|
|
||||||
&& strstr(message + 26, "not found"))
|
|
||||||
{
|
|
||||||
ECPGnoticeProcessor_raise(ECPG_WARNING_UNKNOWN_PORTAL, message);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* WARNING: BEGIN: already a transaction in progress */
|
|
||||||
if (!strncmp(message, "BEGIN: already a transaction in progress", 40))
|
|
||||||
{
|
|
||||||
ECPGnoticeProcessor_raise(ECPG_WARNING_IN_TRANSACTION, message);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* WARNING: AbortTransaction and not in in-progress state */
|
|
||||||
/* WARNING: COMMIT: no transaction in progress */
|
|
||||||
/* WARNING: ROLLBACK: no transaction in progress */
|
|
||||||
if (!strncmp(message, "AbortTransaction and not in in-progress state", 45)
|
|
||||||
|| !strncmp(message, "COMMIT: no transaction in progress", 34)
|
|
||||||
|| !strncmp(message, "ROLLBACK: no transaction in progress", 36))
|
|
||||||
{
|
|
||||||
ECPGnoticeProcessor_raise(ECPG_WARNING_NO_TRANSACTION, message);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* WARNING: BlankPortalAssignName: portal * already exists */
|
|
||||||
if (!strncmp(message, "BlankPortalAssignName: portal", 29)
|
|
||||||
&& strstr(message + 29, "already exists"))
|
|
||||||
{
|
|
||||||
ECPGnoticeProcessor_raise(ECPG_WARNING_PORTAL_EXISTS, message);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* these are harmless - do nothing */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* WARNING: CREATE TABLE / PRIMARY KEY will create implicit index '*'
|
|
||||||
* for table '*'
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* WARNING: ALTER TABLE ... ADD CONSTRAINT will create implicit
|
|
||||||
* trigger(s) for FOREIGN KEY check(s)
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* WARNING: CREATE TABLE will create implicit sequence '*' for SERIAL
|
|
||||||
* column '*.*'
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* WARNING: CREATE TABLE will create implicit trigger(s) for FOREIGN
|
|
||||||
* KEY check(s)
|
|
||||||
*/
|
|
||||||
if ((!strncmp(message, "CREATE TABLE", 12) || !strncmp(message, "ALTER TABLE", 11))
|
|
||||||
&& strstr(message + 11, "will create implicit"))
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* WARNING: QUERY PLAN: */
|
|
||||||
if (!strncmp(message, "QUERY PLAN:", 11)) /* do we really see these? */
|
|
||||||
return;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* WARNING: DROP TABLE implicitly drops referential integrity trigger
|
|
||||||
* from table "*"
|
|
||||||
*/
|
|
||||||
if (!strncmp(message, "DROP TABLE implicitly drops", 27))
|
|
||||||
return;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* WARNING: Caution: DROP INDEX cannot be rolled back, so don't abort
|
|
||||||
* now
|
|
||||||
*/
|
|
||||||
if (strstr(message, "cannot be rolled back"))
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* these and other unmentioned should set sqlca->sqlwarn[2] */
|
|
||||||
/* WARNING: The ':' operator is deprecated. Use exp(x) instead. */
|
|
||||||
/* WARNING: Rel *: Uninitialized page 0 - fixing */
|
|
||||||
/* WARNING: PortalHeapMemoryFree: * not in alloc set! */
|
|
||||||
/* WARNING: Too old parent tuple found - can't continue vc_repair_frag */
|
|
||||||
/* WARNING: identifier "*" will be truncated to "*" */
|
|
||||||
/* WARNING: InvalidateSharedInvalid: cache state reset */
|
|
||||||
/* WARNING: RegisterSharedInvalid: SI buffer overflow */
|
|
||||||
sqlca->sqlwarn[2] = 'W';
|
|
||||||
sqlca->sqlwarn[0] = 'W';
|
|
||||||
}
|
|
||||||
|
|
||||||
/* this contains some quick hacks, needs to be cleaned up, but it works */
|
/* this contains some quick hacks, needs to be cleaned up, but it works */
|
||||||
bool
|
bool
|
||||||
@ -406,7 +302,7 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
|
|||||||
if (strncmp(dbname, "unix:", 5) != 0)
|
if (strncmp(dbname, "unix:", 5) != 0)
|
||||||
{
|
{
|
||||||
ECPGlog("connect: socketname %s given for TCP connection in line %d\n", host, lineno);
|
ECPGlog("connect: socketname %s given for TCP connection in line %d\n", host, lineno);
|
||||||
ECPGraise(lineno, ECPG_CONNECT, realname ? realname : "<DEFAULT>", ECPG_COMPAT_PGSQL);
|
ECPGraise(lineno, ECPG_CONNECT, ECPG_SQLSTATE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION, realname ? realname : "<DEFAULT>");
|
||||||
if (host)
|
if (host)
|
||||||
ECPGfree(host);
|
ECPGfree(host);
|
||||||
if (port)
|
if (port)
|
||||||
@ -429,7 +325,7 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
|
|||||||
if (strcmp(dbname + offset, "localhost") != 0 && strcmp(dbname + offset, "127.0.0.1") != 0)
|
if (strcmp(dbname + offset, "localhost") != 0 && strcmp(dbname + offset, "127.0.0.1") != 0)
|
||||||
{
|
{
|
||||||
ECPGlog("connect: non-localhost access via sockets in line %d\n", lineno);
|
ECPGlog("connect: non-localhost access via sockets in line %d\n", lineno);
|
||||||
ECPGraise(lineno, ECPG_CONNECT, realname ? realname : "<DEFAULT>", ECPG_COMPAT_PGSQL);
|
ECPGraise(lineno, ECPG_CONNECT, ECPG_SQLSTATE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION, realname ? realname : "<DEFAULT>");
|
||||||
if (host)
|
if (host)
|
||||||
ECPGfree(host);
|
ECPGfree(host);
|
||||||
if (port)
|
if (port)
|
||||||
@ -497,7 +393,7 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
|
|||||||
user ? "for user " : "", user ? user : "",
|
user ? "for user " : "", user ? user : "",
|
||||||
lineno, errmsg);
|
lineno, errmsg);
|
||||||
|
|
||||||
ECPGraise(lineno, ECPG_CONNECT, db, ECPG_COMPAT_PGSQL);
|
ECPGraise(lineno, ECPG_CONNECT, ECPG_SQLSTATE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION, db);
|
||||||
if (host)
|
if (host)
|
||||||
ECPGfree(host);
|
ECPGfree(host);
|
||||||
if (port)
|
if (port)
|
||||||
@ -528,7 +424,7 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
|
|||||||
this->committed = true;
|
this->committed = true;
|
||||||
this->autocommit = autocommit;
|
this->autocommit = autocommit;
|
||||||
|
|
||||||
PQsetNoticeProcessor(this->connection, &ECPGnoticeProcessor, (void *) this);
|
PQsetNoticeReceiver(this->connection, &ECPGnoticeReceiver, (void *) this);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.14 2003/08/01 08:21:04 meskes Exp $ */
|
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.15 2003/08/01 13:53:36 petere Exp $ */
|
||||||
|
|
||||||
#define POSTGRES_ECPG_INTERNAL
|
#define POSTGRES_ECPG_INTERNAL
|
||||||
#include "postgres_fe.h"
|
#include "postgres_fe.h"
|
||||||
@ -34,7 +34,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
|
|||||||
{
|
{
|
||||||
if (*pval != '{')
|
if (*pval != '{')
|
||||||
{
|
{
|
||||||
ECPGraise(lineno, ECPG_DATA_NOT_ARRAY, NULL, compat);
|
ECPGraise(lineno, ECPG_DATA_NOT_ARRAY, ECPG_SQLSTATE_DATATYPE_MISMATCH, NULL);
|
||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,13 +90,13 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ECPGraise(lineno, ECPG_MISSING_INDICATOR, NULL, compat);
|
ECPGraise(lineno, ECPG_MISSING_INDICATOR, ECPG_SQLSTATE_NULL_VALUE_NO_INDICATOR_PARAMETER, NULL);
|
||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ECPGraise(lineno, ECPG_UNSUPPORTED, ECPGtype_name(ind_type), compat);
|
ECPGraise(lineno, ECPG_UNSUPPORTED, ECPG_SQLSTATE_ECPG_INTERNAL_ERROR, ECPGtype_name(ind_type));
|
||||||
return (false);
|
return (false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -126,7 +126,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
|
|||||||
if ((isarray && *scan_length != ',' && *scan_length != '}')
|
if ((isarray && *scan_length != ',' && *scan_length != '}')
|
||||||
|| (!isarray && *scan_length != '\0' && *scan_length != ' ')) /* Garbage left */
|
|| (!isarray && *scan_length != '\0' && *scan_length != ' ')) /* Garbage left */
|
||||||
{
|
{
|
||||||
ECPGraise(lineno, ECPG_INT_FORMAT, pval, compat);
|
ECPGraise(lineno, ECPG_INT_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
|
||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -159,7 +159,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
|
|||||||
if ((isarray && *scan_length != ',' && *scan_length != '}')
|
if ((isarray && *scan_length != ',' && *scan_length != '}')
|
||||||
|| (!isarray && *scan_length != '\0' && *scan_length != ' ')) /* Garbage left */
|
|| (!isarray && *scan_length != '\0' && *scan_length != ' ')) /* Garbage left */
|
||||||
{
|
{
|
||||||
ECPGraise(lineno, ECPG_UINT_FORMAT, pval, compat);
|
ECPGraise(lineno, ECPG_UINT_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
|
||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -192,7 +192,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
|
|||||||
if ((isarray && *scan_length != ',' && *scan_length != '}')
|
if ((isarray && *scan_length != ',' && *scan_length != '}')
|
||||||
|| (!isarray && *scan_length != '\0' && *scan_length != ' ')) /* Garbage left */
|
|| (!isarray && *scan_length != '\0' && *scan_length != ' ')) /* Garbage left */
|
||||||
{
|
{
|
||||||
ECPGraise(lineno, ECPG_INT_FORMAT, pval, compat);
|
ECPGraise(lineno, ECPG_INT_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
|
||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -209,7 +209,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
|
|||||||
if ((isarray && *scan_length != ',' && *scan_length != '}')
|
if ((isarray && *scan_length != ',' && *scan_length != '}')
|
||||||
|| (!isarray && *scan_length != '\0' && *scan_length != ' ')) /* Garbage left */
|
|| (!isarray && *scan_length != '\0' && *scan_length != ' ')) /* Garbage left */
|
||||||
{
|
{
|
||||||
ECPGraise(lineno, ECPG_UINT_FORMAT, pval, compat);
|
ECPGraise(lineno, ECPG_UINT_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
|
||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -235,7 +235,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
|
|||||||
if ((isarray && *scan_length != ',' && *scan_length != '}')
|
if ((isarray && *scan_length != ',' && *scan_length != '}')
|
||||||
|| (!isarray && *scan_length != '\0' && *scan_length != ' ')) /* Garbage left */
|
|| (!isarray && *scan_length != '\0' && *scan_length != ' ')) /* Garbage left */
|
||||||
{
|
{
|
||||||
ECPGraise(lineno, ECPG_FLOAT_FORMAT, pval, compat);
|
ECPGraise(lineno, ECPG_FLOAT_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
|
||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -266,7 +266,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
|
|||||||
else if (offset == sizeof(int))
|
else if (offset == sizeof(int))
|
||||||
*((int *) (var + offset * act_tuple)) = false;
|
*((int *) (var + offset * act_tuple)) = false;
|
||||||
else
|
else
|
||||||
ECPGraise(lineno, ECPG_CONVERT_BOOL, "different size", compat);
|
ECPGraise(lineno, ECPG_CONVERT_BOOL, ECPG_SQLSTATE_DATATYPE_MISMATCH, "different size");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (pval[0] == 't' && pval[1] == '\0')
|
else if (pval[0] == 't' && pval[1] == '\0')
|
||||||
@ -276,7 +276,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
|
|||||||
else if (offset == sizeof(int))
|
else if (offset == sizeof(int))
|
||||||
*((int *) (var + offset * act_tuple)) = true;
|
*((int *) (var + offset * act_tuple)) = true;
|
||||||
else
|
else
|
||||||
ECPGraise(lineno, ECPG_CONVERT_BOOL, "different size", compat);
|
ECPGraise(lineno, ECPG_CONVERT_BOOL, ECPG_SQLSTATE_DATATYPE_MISMATCH, "different size");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (pval[0] == '\0' && PQgetisnull(results, act_tuple, act_field))
|
else if (pval[0] == '\0' && PQgetisnull(results, act_tuple, act_field))
|
||||||
@ -286,7 +286,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ECPGraise(lineno, ECPG_CONVERT_BOOL, pval, compat);
|
ECPGraise(lineno, ECPG_CONVERT_BOOL, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
|
||||||
return (false);
|
return (false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -396,7 +396,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
|
|||||||
if ((isarray && *scan_length != ',' && *scan_length != '}')
|
if ((isarray && *scan_length != ',' && *scan_length != '}')
|
||||||
|| (!isarray && *scan_length != '\0' && *scan_length != ' ')) /* Garbage left */
|
|| (!isarray && *scan_length != '\0' && *scan_length != ' ')) /* Garbage left */
|
||||||
{
|
{
|
||||||
ECPGraise(lineno, ECPG_NUMERIC_FORMAT, pval, compat);
|
ECPGraise(lineno, ECPG_NUMERIC_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
|
||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -423,7 +423,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
|
|||||||
if ((isarray && *scan_length != ',' && *scan_length != '}')
|
if ((isarray && *scan_length != ',' && *scan_length != '}')
|
||||||
|| (!isarray && *scan_length != '\0' && *scan_length != ' ')) /* Garbage left */
|
|| (!isarray && *scan_length != '\0' && *scan_length != ' ')) /* Garbage left */
|
||||||
{
|
{
|
||||||
ECPGraise(lineno, ECPG_INTERVAL_FORMAT, pval, compat);
|
ECPGraise(lineno, ECPG_INTERVAL_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
|
||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -446,7 +446,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
|
|||||||
if ((isarray && *scan_length != ',' && *scan_length != '}')
|
if ((isarray && *scan_length != ',' && *scan_length != '}')
|
||||||
|| (!isarray && *scan_length != '\0' && *scan_length != ' ')) /* Garbage left */
|
|| (!isarray && *scan_length != '\0' && *scan_length != ' ')) /* Garbage left */
|
||||||
{
|
{
|
||||||
ECPGraise(lineno, ECPG_DATE_FORMAT, pval, compat);
|
ECPGraise(lineno, ECPG_DATE_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
|
||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -468,7 +468,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
|
|||||||
if ((isarray && *scan_length != ',' && *scan_length != '}')
|
if ((isarray && *scan_length != ',' && *scan_length != '}')
|
||||||
|| (!isarray && *scan_length != '\0' && *scan_length != ' ')) /* Garbage left */
|
|| (!isarray && *scan_length != '\0' && *scan_length != ' ')) /* Garbage left */
|
||||||
{
|
{
|
||||||
ECPGraise(lineno, ECPG_TIMESTAMP_FORMAT, pval, compat);
|
ECPGraise(lineno, ECPG_TIMESTAMP_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
|
||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -477,7 +477,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ECPGraise(lineno, ECPG_UNSUPPORTED, ECPGtype_name(type), compat);
|
ECPGraise(lineno, ECPG_UNSUPPORTED, ECPG_SQLSTATE_ECPG_INTERNAL_ERROR, ECPGtype_name(type));
|
||||||
return (false);
|
return (false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* dynamic SQL support routines
|
/* dynamic SQL support routines
|
||||||
*
|
*
|
||||||
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/descriptor.c,v 1.4 2003/08/01 08:21:04 meskes Exp $
|
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/descriptor.c,v 1.5 2003/08/01 13:53:36 petere Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define POSTGRES_ECPG_INTERNAL
|
#define POSTGRES_ECPG_INTERNAL
|
||||||
@ -103,7 +103,7 @@ get_int_item(int lineno, void *var, enum ECPGttype vartype, int value)
|
|||||||
*(double *) var = (double) value;
|
*(double *) var = (double) value;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ECPGraise(lineno, ECPG_VAR_NOT_NUMERIC, NULL, ECPG_COMPAT_PGSQL);
|
ECPGraise(lineno, ECPG_VAR_NOT_NUMERIC, ECPG_SQLSTATE_RESTRICTED_DATA_TYPE_ATTRIBUTE_VIOLATION, NULL);
|
||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,7 +135,7 @@ get_char_item(int lineno, void *var, enum ECPGttype vartype, char *value, int va
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ECPGraise(lineno, ECPG_VAR_NOT_CHAR, NULL, ECPG_COMPAT_PGSQL);
|
ECPGraise(lineno, ECPG_VAR_NOT_CHAR, ECPG_SQLSTATE_RESTRICTED_DATA_TYPE_ATTRIBUTE_VIOLATION, NULL);
|
||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,13 +162,13 @@ ECPGget_desc(int lineno, char *desc_name, int index,...)
|
|||||||
ntuples = PQntuples(ECPGresult);
|
ntuples = PQntuples(ECPGresult);
|
||||||
if (ntuples < 1)
|
if (ntuples < 1)
|
||||||
{
|
{
|
||||||
ECPGraise(lineno, ECPG_NOT_FOUND, NULL, ECPG_COMPAT_PGSQL);
|
ECPGraise(lineno, ECPG_NOT_FOUND, ECPG_SQLSTATE_NO_DATA, NULL);
|
||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index < 1 || index > PQnfields(ECPGresult))
|
if (index < 1 || index > PQnfields(ECPGresult))
|
||||||
{
|
{
|
||||||
ECPGraise(lineno, ECPG_INVALID_DESCRIPTOR_INDEX, NULL, ECPG_COMPAT_PGSQL);
|
ECPGraise(lineno, ECPG_INVALID_DESCRIPTOR_INDEX, ECPG_SQLSTATE_INVALID_DESCRIPTOR_INDEX, NULL);
|
||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -300,7 +300,7 @@ ECPGget_desc(int lineno, char *desc_name, int index,...)
|
|||||||
{
|
{
|
||||||
ECPGlog("ECPGget_desc line %d: Incorrect number of matches: %d don't fit into array of %d\n",
|
ECPGlog("ECPGget_desc line %d: Incorrect number of matches: %d don't fit into array of %d\n",
|
||||||
lineno, ntuples, arrsize);
|
lineno, ntuples, arrsize);
|
||||||
ECPGraise(lineno, ECPG_TOO_MANY_MATCHES, NULL, ECPG_COMPAT_PGSQL);
|
ECPGraise(lineno, ECPG_TOO_MANY_MATCHES, ECPG_SQLSTATE_CARDINALITY_VIOLATION, NULL);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
/* allocate storage if needed */
|
/* allocate storage if needed */
|
||||||
@ -324,7 +324,7 @@ ECPGget_desc(int lineno, char *desc_name, int index,...)
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
snprintf(type_str, sizeof(type_str), "%d", type);
|
snprintf(type_str, sizeof(type_str), "%d", type);
|
||||||
ECPGraise(lineno, ECPG_UNKNOWN_DESCRIPTOR_ITEM, type_str, ECPG_COMPAT_PGSQL);
|
ECPGraise(lineno, ECPG_UNKNOWN_DESCRIPTOR_ITEM, ECPG_SQLSTATE_ECPG_INTERNAL_ERROR, type_str);
|
||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -361,7 +361,7 @@ ECPGget_desc(int lineno, char *desc_name, int index,...)
|
|||||||
{
|
{
|
||||||
ECPGlog("ECPGget_desc line %d: Incorrect number of matches (indicator): %d don't fit into array of %d\n",
|
ECPGlog("ECPGget_desc line %d: Incorrect number of matches (indicator): %d don't fit into array of %d\n",
|
||||||
lineno, ntuples, data_var.ind_arrsize);
|
lineno, ntuples, data_var.ind_arrsize);
|
||||||
ECPGraise(lineno, ECPG_TOO_MANY_MATCHES, NULL, ECPG_COMPAT_PGSQL);
|
ECPGraise(lineno, ECPG_TOO_MANY_MATCHES, ECPG_SQLSTATE_CARDINALITY_VIOLATION, NULL);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
/* allocate storage if needed */
|
/* allocate storage if needed */
|
||||||
@ -404,7 +404,7 @@ ECPGdeallocate_desc(int line, const char *name)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ECPGraise(line, ECPG_UNKNOWN_DESCRIPTOR, name, ECPG_COMPAT_PGSQL);
|
ECPGraise(line, ECPG_UNKNOWN_DESCRIPTOR, ECPG_SQLSTATE_INVALID_SQL_DESCRIPTOR_NAME, name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -430,7 +430,7 @@ ECPGallocate_desc(int line, const char *name)
|
|||||||
{
|
{
|
||||||
ECPGfree(new->name);
|
ECPGfree(new->name);
|
||||||
ECPGfree(new);
|
ECPGfree(new);
|
||||||
ECPGraise(line, ECPG_OUT_OF_MEMORY, NULL, ECPG_COMPAT_PGSQL);
|
ECPGraise(line, ECPG_OUT_OF_MEMORY, ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, NULL);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
strcpy(new->name, name);
|
strcpy(new->name, name);
|
||||||
@ -449,7 +449,7 @@ ECPGdescriptor_lvalue(int line, const char *descriptor)
|
|||||||
return &i->result;
|
return &i->result;
|
||||||
}
|
}
|
||||||
|
|
||||||
ECPGraise(line, ECPG_UNKNOWN_DESCRIPTOR, (char *) descriptor, ECPG_COMPAT_PGSQL);
|
ECPGraise(line, ECPG_UNKNOWN_DESCRIPTOR, ECPG_SQLSTATE_INVALID_SQL_DESCRIPTOR_NAME, (char *) descriptor);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/error.c,v 1.4 2003/08/01 08:21:04 meskes Exp $ */
|
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/error.c,v 1.5 2003/08/01 13:53:36 petere Exp $ */
|
||||||
|
|
||||||
#define POSTGRES_ECPG_INTERNAL
|
#define POSTGRES_ECPG_INTERNAL
|
||||||
#include "postgres_fe.h"
|
#include "postgres_fe.h"
|
||||||
@ -11,11 +11,13 @@
|
|||||||
#include "extern.h"
|
#include "extern.h"
|
||||||
#include "sqlca.h"
|
#include "sqlca.h"
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ECPGraise(int line, int code, const char *str, int compat)
|
ECPGraise(int line, int code, const char * sqlstate, const char *str)
|
||||||
{
|
{
|
||||||
struct sqlca_t *sqlca = ECPGget_sqlca();
|
struct sqlca_t *sqlca = ECPGget_sqlca();
|
||||||
sqlca->sqlcode = code;
|
sqlca->sqlcode = code;
|
||||||
|
strncpy(sqlca->sqlstate, sqlstate, sizeof(sqlca->sqlstate));
|
||||||
|
|
||||||
switch (code)
|
switch (code)
|
||||||
{
|
{
|
||||||
@ -129,23 +131,6 @@ ECPGraise(int line, int code, const char *str, int compat)
|
|||||||
"Variable is not a character type in line %d.", line);
|
"Variable is not a character type in line %d.", line);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ECPG_PGSQL:
|
|
||||||
{
|
|
||||||
int slen = strlen(str);
|
|
||||||
|
|
||||||
/* strip trailing newline */
|
|
||||||
if (slen > 0 && str[slen - 1] == '\n')
|
|
||||||
slen--;
|
|
||||||
snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
|
|
||||||
"'%.*s' in line %d.", slen, str, line);
|
|
||||||
if (strncmp(str, "ERROR: Cannot insert a duplicate key", strlen("ERROR: Cannot insert a duplicate key")) == 0)
|
|
||||||
sqlca->sqlcode = INFORMIX_MODE(compat) ? ECPG_INFORMIX_DUPLICATE_KEY : ECPG_DUPLICATE_KEY;
|
|
||||||
else if (strncmp(str, "ERROR: More than one tuple returned by a subselect", strlen("ERROR: More than one tuple returned by a subselect")) == 0)
|
|
||||||
sqlca->sqlcode = INFORMIX_MODE(compat) ? ECPG_INFORMIX_SUBSELECT_NOT_ONE : ECPG_SUBSELECT_NOT_ONE;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case ECPG_TRANS:
|
case ECPG_TRANS:
|
||||||
snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
|
snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
|
||||||
"Error in transaction processing in line %d.", line);
|
"Error in transaction processing in line %d.", line);
|
||||||
@ -169,6 +154,38 @@ ECPGraise(int line, int code, const char *str, int compat)
|
|||||||
ECPGfree_auto_mem();
|
ECPGfree_auto_mem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ECPGraise_backend(int line, PGresult *result, PGconn *conn, int compat)
|
||||||
|
{
|
||||||
|
struct sqlca_t *sqlca = ECPGget_sqlca();
|
||||||
|
|
||||||
|
/* copy error message */
|
||||||
|
snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
|
||||||
|
"'%s' in line %d.",
|
||||||
|
result ? PQresultErrorField(result, 'M') : PQerrorMessage(conn),
|
||||||
|
line);
|
||||||
|
sqlca->sqlerrm.sqlerrml = strlen(sqlca->sqlerrm.sqlerrmc);
|
||||||
|
|
||||||
|
/* copy SQLSTATE */
|
||||||
|
strncpy(sqlca->sqlstate,
|
||||||
|
result ? PQresultErrorField(result, 'C') : ECPG_SQLSTATE_ECPG_INTERNAL_ERROR,
|
||||||
|
sizeof(sqlca->sqlstate));
|
||||||
|
|
||||||
|
/* assign SQLCODE for backward compatibility */
|
||||||
|
if (strncmp(sqlca->sqlstate, "23505", sizeof(sqlca->sqlstate))==0)
|
||||||
|
sqlca->sqlcode = INFORMIX_MODE(compat) ? ECPG_INFORMIX_DUPLICATE_KEY : ECPG_DUPLICATE_KEY;
|
||||||
|
if (strncmp(sqlca->sqlstate, "21000", sizeof(sqlca->sqlstate))==0)
|
||||||
|
sqlca->sqlcode = INFORMIX_MODE(compat) ? ECPG_INFORMIX_SUBSELECT_NOT_ONE : ECPG_SUBSELECT_NOT_ONE;
|
||||||
|
else
|
||||||
|
sqlca->sqlcode = ECPG_PGSQL;
|
||||||
|
|
||||||
|
ECPGlog("raising sqlstate %.*s in line %d, '%s'.\n",
|
||||||
|
sqlca->sqlstate, sizeof(sqlca->sqlstate), line, sqlca->sqlerrm.sqlerrmc);
|
||||||
|
|
||||||
|
/* free all memory we have allocated for the user */
|
||||||
|
ECPGfree_auto_mem();
|
||||||
|
}
|
||||||
|
|
||||||
/* print out an error message */
|
/* print out an error message */
|
||||||
void
|
void
|
||||||
sqlprint(void)
|
sqlprint(void)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.21 2003/08/01 08:21:04 meskes Exp $ */
|
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.22 2003/08/01 13:53:36 petere Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The aim is to get a simpler inteface to the database routines.
|
* The aim is to get a simpler inteface to the database routines.
|
||||||
@ -124,7 +124,7 @@ create_statement(int lineno, int compat, int force_indicator, struct connection
|
|||||||
/* if variable is NULL, the statement hasn't been prepared */
|
/* if variable is NULL, the statement hasn't been prepared */
|
||||||
if (var->pointer == NULL)
|
if (var->pointer == NULL)
|
||||||
{
|
{
|
||||||
ECPGraise(lineno, ECPG_INVALID_STMT, NULL, compat);
|
ECPGraise(lineno, ECPG_INVALID_STMT, ECPG_SQLSTATE_INVALID_SQL_STATEMENT_NAME, NULL);
|
||||||
ECPGfree(var);
|
ECPGfree(var);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -351,7 +351,7 @@ ECPGstore_result(const PGresult *results, int act_field,
|
|||||||
{
|
{
|
||||||
ECPGlog("ECPGexecute line %d: Incorrect number of matches: %d don't fit into array of %d\n",
|
ECPGlog("ECPGexecute line %d: Incorrect number of matches: %d don't fit into array of %d\n",
|
||||||
stmt->lineno, ntuples, var->arrsize);
|
stmt->lineno, ntuples, var->arrsize);
|
||||||
ECPGraise(stmt->lineno, ECPG_TOO_MANY_MATCHES, NULL, ECPG_COMPAT_PGSQL);
|
ECPGraise(stmt->lineno, ECPG_TOO_MANY_MATCHES, ECPG_SQLSTATE_CARDINALITY_VIOLATION, NULL);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -362,7 +362,7 @@ ECPGstore_result(const PGresult *results, int act_field,
|
|||||||
*/
|
*/
|
||||||
if (var->arrsize == 0)
|
if (var->arrsize == 0)
|
||||||
{
|
{
|
||||||
ECPGraise(stmt->lineno, ECPG_NO_ARRAY, NULL, ECPG_COMPAT_PGSQL);
|
ECPGraise(stmt->lineno, ECPG_NO_ARRAY, ECPG_SQLSTATE_DATATYPE_MISMATCH, NULL);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -481,12 +481,13 @@ ECPGstore_input(const struct statement * stmt, const struct variable * var,
|
|||||||
* arrays are not possible unless the attribute is an array too FIXME:
|
* arrays are not possible unless the attribute is an array too FIXME:
|
||||||
* we do not know if the attribute is an array here
|
* we do not know if the attribute is an array here
|
||||||
*/
|
*/
|
||||||
|
#if 0
|
||||||
/* if (var->arrsize > 1 && ...)
|
if (var->arrsize > 1 && ...)
|
||||||
{
|
{
|
||||||
ECPGraise(stmt->lineno, ECPG_ARRAY_INSERT, NULL, compat);
|
ECPGraise(stmt->lineno, ECPG_ARRAY_INSERT, ECPG_SQLSTATE_DATATYPE_MISMATCH, NULL);
|
||||||
return false;
|
return false;
|
||||||
}*/
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Some special treatment is needed for records since we want their
|
* Some special treatment is needed for records since we want their
|
||||||
@ -757,7 +758,7 @@ ECPGstore_input(const struct statement * stmt, const struct variable * var,
|
|||||||
for (element = 0; element < var->arrsize; element++)
|
for (element = 0; element < var->arrsize; element++)
|
||||||
sprintf(mallocedval + strlen(mallocedval), "%c,", (((int *) var->value)[element]) ? 't' : 'f');
|
sprintf(mallocedval + strlen(mallocedval), "%c,", (((int *) var->value)[element]) ? 't' : 'f');
|
||||||
else
|
else
|
||||||
ECPGraise(stmt->lineno, ECPG_CONVERT_BOOL, "different size", ECPG_COMPAT_PGSQL);
|
ECPGraise(stmt->lineno, ECPG_CONVERT_BOOL, ECPG_SQLSTATE_DATATYPE_MISMATCH, "different size");
|
||||||
|
|
||||||
strcpy(mallocedval + strlen(mallocedval) - 1, "]");
|
strcpy(mallocedval + strlen(mallocedval) - 1, "]");
|
||||||
}
|
}
|
||||||
@ -768,7 +769,7 @@ ECPGstore_input(const struct statement * stmt, const struct variable * var,
|
|||||||
else if (var->offset == sizeof(int))
|
else if (var->offset == sizeof(int))
|
||||||
sprintf(mallocedval, "'%c'", (*((int *) var->value)) ? 't' : 'f');
|
sprintf(mallocedval, "'%c'", (*((int *) var->value)) ? 't' : 'f');
|
||||||
else
|
else
|
||||||
ECPGraise(stmt->lineno, ECPG_CONVERT_BOOL, "different size", ECPG_COMPAT_PGSQL);
|
ECPGraise(stmt->lineno, ECPG_CONVERT_BOOL, ECPG_SQLSTATE_DATATYPE_MISMATCH, "different size");
|
||||||
}
|
}
|
||||||
|
|
||||||
*tobeinserted_p = mallocedval;
|
*tobeinserted_p = mallocedval;
|
||||||
@ -1021,7 +1022,7 @@ ECPGstore_input(const struct statement * stmt, const struct variable * var,
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
/* Not implemented yet */
|
/* Not implemented yet */
|
||||||
ECPGraise(stmt->lineno, ECPG_UNSUPPORTED, (char *) ECPGtype_name(var->type), ECPG_COMPAT_PGSQL);
|
ECPGraise(stmt->lineno, ECPG_UNSUPPORTED, ECPG_SQLSTATE_ECPG_INTERNAL_ERROR, (char *) ECPGtype_name(var->type));
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1034,7 +1035,7 @@ ECPGexecute(struct statement * stmt)
|
|||||||
{
|
{
|
||||||
bool status = false;
|
bool status = false;
|
||||||
char *copiedquery;
|
char *copiedquery;
|
||||||
char *errmsg, *cmdstat;
|
char *cmdstat;
|
||||||
PGresult *results;
|
PGresult *results;
|
||||||
PGnotify *notify;
|
PGnotify *notify;
|
||||||
struct variable *var;
|
struct variable *var;
|
||||||
@ -1073,7 +1074,7 @@ ECPGexecute(struct statement * stmt)
|
|||||||
* We have an argument but we dont have the matched up string
|
* We have an argument but we dont have the matched up string
|
||||||
* in the string
|
* in the string
|
||||||
*/
|
*/
|
||||||
ECPGraise(stmt->lineno, ECPG_TOO_MANY_ARGUMENTS, NULL, stmt->compat);
|
ECPGraise(stmt->lineno, ECPG_TOO_MANY_ARGUMENTS, ECPG_SQLSTATE_USING_CLAUSE_DOES_NOT_MATCH_PARAMETERS, NULL);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1111,7 +1112,7 @@ ECPGexecute(struct statement * stmt)
|
|||||||
/* Check if there are unmatched things left. */
|
/* Check if there are unmatched things left. */
|
||||||
if (next_insert(copiedquery) != NULL)
|
if (next_insert(copiedquery) != NULL)
|
||||||
{
|
{
|
||||||
ECPGraise(stmt->lineno, ECPG_TOO_FEW_ARGUMENTS, NULL, stmt->compat);
|
ECPGraise(stmt->lineno, ECPG_TOO_FEW_ARGUMENTS, ECPG_SQLSTATE_USING_CLAUSE_DOES_NOT_MATCH_PARAMETERS, NULL);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1121,7 +1122,7 @@ ECPGexecute(struct statement * stmt)
|
|||||||
{
|
{
|
||||||
if ((results = PQexec(stmt->connection->connection, "begin transaction")) == NULL)
|
if ((results = PQexec(stmt->connection->connection, "begin transaction")) == NULL)
|
||||||
{
|
{
|
||||||
ECPGraise(stmt->lineno, ECPG_TRANS, NULL, stmt->compat);
|
ECPGraise(stmt->lineno, ECPG_TRANS, ECPG_SQLSTATE_TRANSACTION_RESOLUTION_UNKNOWN, NULL);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PQclear(results);
|
PQclear(results);
|
||||||
@ -1134,9 +1135,8 @@ ECPGexecute(struct statement * stmt)
|
|||||||
|
|
||||||
if (results == NULL)
|
if (results == NULL)
|
||||||
{
|
{
|
||||||
errmsg = PQerrorMessage(stmt->connection->connection);
|
ECPGlog("ECPGexecute line %d: error: %s", stmt->lineno, PQerrorMessage(stmt->connection->connection));
|
||||||
ECPGlog("ECPGexecute line %d: error: %s", stmt->lineno, errmsg);
|
ECPGraise_backend(stmt->lineno, NULL, stmt->connection->connection, stmt->compat);
|
||||||
ECPGraise(stmt->lineno, ECPG_PGSQL, errmsg, stmt->compat);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
||||||
@ -1148,8 +1148,6 @@ ECPGexecute(struct statement * stmt)
|
|||||||
bool clear_result = TRUE;
|
bool clear_result = TRUE;
|
||||||
struct sqlca_t *sqlca = ECPGget_sqlca();
|
struct sqlca_t *sqlca = ECPGget_sqlca();
|
||||||
|
|
||||||
errmsg = PQresultErrorMessage(results);
|
|
||||||
|
|
||||||
var = stmt->outlist;
|
var = stmt->outlist;
|
||||||
switch (PQresultStatus(results))
|
switch (PQresultStatus(results))
|
||||||
{
|
{
|
||||||
@ -1167,7 +1165,7 @@ ECPGexecute(struct statement * stmt)
|
|||||||
if (ntuples)
|
if (ntuples)
|
||||||
ECPGlog("ECPGexecute line %d: Incorrect number of matches: %d\n",
|
ECPGlog("ECPGexecute line %d: Incorrect number of matches: %d\n",
|
||||||
stmt->lineno, ntuples);
|
stmt->lineno, ntuples);
|
||||||
ECPGraise(stmt->lineno, ECPG_NOT_FOUND, NULL, stmt->compat);
|
ECPGraise(stmt->lineno, ECPG_NOT_FOUND, ECPG_SQLSTATE_NO_DATA, NULL);
|
||||||
status = false;
|
status = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1198,21 +1196,21 @@ ECPGexecute(struct statement * stmt)
|
|||||||
}
|
}
|
||||||
else if (!INFORMIX_MODE(stmt->compat))
|
else if (!INFORMIX_MODE(stmt->compat))
|
||||||
{
|
{
|
||||||
ECPGraise(stmt->lineno, ECPG_TOO_FEW_ARGUMENTS, NULL, stmt->compat);
|
ECPGraise(stmt->lineno, ECPG_TOO_FEW_ARGUMENTS, ECPG_SQLSTATE_USING_CLAUSE_DOES_NOT_MATCH_TARGETS, NULL);
|
||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status && var != NULL)
|
if (status && var != NULL)
|
||||||
{
|
{
|
||||||
ECPGraise(stmt->lineno, ECPG_TOO_MANY_ARGUMENTS, NULL, stmt->compat);
|
ECPGraise(stmt->lineno, ECPG_TOO_MANY_ARGUMENTS, ECPG_SQLSTATE_USING_CLAUSE_DOES_NOT_MATCH_TARGETS, NULL);
|
||||||
status = false;
|
status = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case PGRES_EMPTY_QUERY:
|
case PGRES_EMPTY_QUERY:
|
||||||
/* do nothing */
|
/* do nothing */
|
||||||
ECPGraise(stmt->lineno, ECPG_EMPTY, NULL, stmt->compat);
|
ECPGraise(stmt->lineno, ECPG_EMPTY, ECPG_SQLSTATE_ECPG_INTERNAL_ERROR, NULL);
|
||||||
break;
|
break;
|
||||||
case PGRES_COMMAND_OK:
|
case PGRES_COMMAND_OK:
|
||||||
status = true;
|
status = true;
|
||||||
@ -1225,13 +1223,13 @@ ECPGexecute(struct statement * stmt)
|
|||||||
( !strncmp(cmdstat, "UPDATE", 6)
|
( !strncmp(cmdstat, "UPDATE", 6)
|
||||||
|| !strncmp(cmdstat, "INSERT", 6)
|
|| !strncmp(cmdstat, "INSERT", 6)
|
||||||
|| !strncmp(cmdstat, "DELETE", 6)))
|
|| !strncmp(cmdstat, "DELETE", 6)))
|
||||||
ECPGraise(stmt->lineno, ECPG_NOT_FOUND, NULL, stmt->compat);
|
ECPGraise(stmt->lineno, ECPG_NOT_FOUND, ECPG_SQLSTATE_NO_DATA, NULL);
|
||||||
break;
|
break;
|
||||||
case PGRES_NONFATAL_ERROR:
|
case PGRES_NONFATAL_ERROR:
|
||||||
case PGRES_FATAL_ERROR:
|
case PGRES_FATAL_ERROR:
|
||||||
case PGRES_BAD_RESPONSE:
|
case PGRES_BAD_RESPONSE:
|
||||||
ECPGlog("ECPGexecute line %d: Error: %s", stmt->lineno, errmsg);
|
ECPGlog("ECPGexecute line %d: Error: %s", stmt->lineno, PQresultErrorMessage(results));
|
||||||
ECPGraise(stmt->lineno, ECPG_PGSQL, errmsg, stmt->compat);
|
ECPGraise_backend(stmt->lineno, results, stmt->connection->connection, stmt->compat);
|
||||||
status = false;
|
status = false;
|
||||||
break;
|
break;
|
||||||
case PGRES_COPY_OUT:
|
case PGRES_COPY_OUT:
|
||||||
@ -1245,7 +1243,7 @@ ECPGexecute(struct statement * stmt)
|
|||||||
default:
|
default:
|
||||||
ECPGlog("ECPGexecute line %d: Got something else, postgres error.\n",
|
ECPGlog("ECPGexecute line %d: Got something else, postgres error.\n",
|
||||||
stmt->lineno);
|
stmt->lineno);
|
||||||
ECPGraise(stmt->lineno, ECPG_PGSQL, errmsg, stmt->compat);
|
ECPGraise_backend(stmt->lineno, results, stmt->connection->connection, stmt->compat);
|
||||||
status = false;
|
status = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1300,7 +1298,7 @@ ECPGdo(int lineno, int compat, int force_indicator, const char *connection_name,
|
|||||||
if (con == NULL || con->connection == NULL)
|
if (con == NULL || con->connection == NULL)
|
||||||
{
|
{
|
||||||
free_statement(stmt);
|
free_statement(stmt);
|
||||||
ECPGraise(lineno, ECPG_NOT_CONN, (con) ? con->name : "<empty>", stmt->compat);
|
ECPGraise(lineno, ECPG_NOT_CONN, ECPG_SQLSTATE_ECPG_INTERNAL_ERROR, (con) ? con->name : "<empty>");
|
||||||
setlocale(LC_NUMERIC, oldlocale);
|
setlocale(LC_NUMERIC, oldlocale);
|
||||||
ECPGfree(oldlocale);
|
ECPGfree(oldlocale);
|
||||||
return false;
|
return false;
|
||||||
|
@ -98,4 +98,30 @@ PGresult **
|
|||||||
bool ECPGstore_result(const PGresult *results, int act_field,
|
bool ECPGstore_result(const PGresult *results, int act_field,
|
||||||
const struct statement * stmt, struct variable * var);
|
const struct statement * stmt, struct variable * var);
|
||||||
|
|
||||||
|
/* SQLSTATE values generated or processed by ecpglib (intentionally
|
||||||
|
* not exported -- users should refer to the codes directly) */
|
||||||
|
|
||||||
|
#define ECPG_SQLSTATE_NO_DATA "02000"
|
||||||
|
#define ECPG_SQLSTATE_USING_CLAUSE_DOES_NOT_MATCH_PARAMETERS "07001"
|
||||||
|
#define ECPG_SQLSTATE_USING_CLAUSE_DOES_NOT_MATCH_TARGETS "07002"
|
||||||
|
#define ECPG_SQLSTATE_RESTRICTED_DATA_TYPE_ATTRIBUTE_VIOLATION "07006"
|
||||||
|
#define ECPG_SQLSTATE_INVALID_DESCRIPTOR_INDEX "07009"
|
||||||
|
#define ECPG_SQLSTATE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION "08001"
|
||||||
|
#define ECPG_SQLSTATE_CONNECTION_DOES_NOT_EXIST "08003"
|
||||||
|
#define ECPG_SQLSTATE_TRANSACTION_RESOLUTION_UNKNOWN "08007"
|
||||||
|
#define ECPG_SQLSTATE_CARDINALITY_VIOLATION "21000"
|
||||||
|
#define ECPG_SQLSTATE_NULL_VALUE_NO_INDICATOR_PARAMETER "22002"
|
||||||
|
#define ECPG_SQLSTATE_ACTIVE_SQL_TRANSACTION "25001"
|
||||||
|
#define ECPG_SQLSTATE_NO_ACTIVE_SQL_TRANSACTION "25P01"
|
||||||
|
#define ECPG_SQLSTATE_INVALID_SQL_STATEMENT_NAME "26000"
|
||||||
|
#define ECPG_SQLSTATE_INVALID_SQL_DESCRIPTOR_NAME "33000"
|
||||||
|
#define ECPG_SQLSTATE_INVALID_CURSOR_NAME "34000"
|
||||||
|
#define ECPG_SQLSTATE_SYNTAX_ERROR "42601"
|
||||||
|
#define ECPG_SQLSTATE_DATATYPE_MISMATCH "42804"
|
||||||
|
#define ECPG_SQLSTATE_DUPLICATE_CURSOR "42P03"
|
||||||
|
|
||||||
|
/* implementation-defined internal errors of ecpg */
|
||||||
|
#define ECPG_SQLSTATE_ECPG_INTERNAL_ERROR "YE000"
|
||||||
|
#define ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY "YE001"
|
||||||
|
|
||||||
#endif /* _ECPG_LIB_EXTERN_H */
|
#endif /* _ECPG_LIB_EXTERN_H */
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/memory.c,v 1.3 2003/08/01 08:21:04 meskes Exp $ */
|
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/memory.c,v 1.4 2003/08/01 13:53:36 petere Exp $ */
|
||||||
|
|
||||||
#define POSTGRES_ECPG_INTERNAL
|
#define POSTGRES_ECPG_INTERNAL
|
||||||
#include "postgres_fe.h"
|
#include "postgres_fe.h"
|
||||||
@ -21,7 +21,7 @@ ECPGalloc(long size, int lineno)
|
|||||||
|
|
||||||
if (!new)
|
if (!new)
|
||||||
{
|
{
|
||||||
ECPGraise(lineno, ECPG_OUT_OF_MEMORY, NULL, ECPG_COMPAT_PGSQL);
|
ECPGraise(lineno, ECPG_OUT_OF_MEMORY, ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ ECPGrealloc(void *ptr, long size, int lineno)
|
|||||||
|
|
||||||
if (!new)
|
if (!new)
|
||||||
{
|
{
|
||||||
ECPGraise(lineno, ECPG_OUT_OF_MEMORY, NULL, ECPG_COMPAT_PGSQL);
|
ECPGraise(lineno, ECPG_OUT_OF_MEMORY, ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ ECPGstrdup(const char *string, int lineno)
|
|||||||
|
|
||||||
if (!new)
|
if (!new)
|
||||||
{
|
{
|
||||||
ECPGraise(lineno, ECPG_OUT_OF_MEMORY, NULL, ECPG_COMPAT_PGSQL);
|
ECPGraise(lineno, ECPG_OUT_OF_MEMORY, ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.11 2003/08/01 08:21:04 meskes Exp $ */
|
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.12 2003/08/01 13:53:36 petere Exp $ */
|
||||||
|
|
||||||
#define POSTGRES_ECPG_INTERNAL
|
#define POSTGRES_ECPG_INTERNAL
|
||||||
#include "postgres_fe.h"
|
#include "postgres_fe.h"
|
||||||
@ -47,7 +47,7 @@ static struct sqlca_t sqlca_init =
|
|||||||
0, 0, 0, 0, 0, 0, 0, 0
|
0, 0, 0, 0, 0, 0, 0, 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
0, 0, 0, 0, 0, 0, 0, 0
|
'0', '0', '0', '0', '0'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ static struct sqlca_t sqlca =
|
|||||||
0, 0, 0, 0, 0, 0, 0, 0
|
0, 0, 0, 0, 0, 0, 0, 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
0, 0, 0, 0, 0, 0, 0, 0
|
'0', '0', '0', '0', '0'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
@ -103,7 +103,8 @@ ECPGinit(const struct connection * con, const char *connection_name, const int l
|
|||||||
ECPGinit_sqlca(sqlca);
|
ECPGinit_sqlca(sqlca);
|
||||||
if (con == NULL)
|
if (con == NULL)
|
||||||
{
|
{
|
||||||
ECPGraise(lineno, ECPG_NO_CONN, connection_name ? connection_name : "NULL", ECPG_COMPAT_PGSQL);
|
ECPGraise(lineno, ECPG_NO_CONN, ECPG_SQLSTATE_CONNECTION_DOES_NOT_EXIST,
|
||||||
|
connection_name ? connection_name : "NULL");
|
||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,7 +151,7 @@ ECPGstatus(int lineno, const char *connection_name)
|
|||||||
/* are we connected? */
|
/* are we connected? */
|
||||||
if (con->connection == NULL)
|
if (con->connection == NULL)
|
||||||
{
|
{
|
||||||
ECPGraise(lineno, ECPG_NOT_CONN, con->name, ECPG_COMPAT_PGSQL);
|
ECPGraise(lineno, ECPG_NOT_CONN, ECPG_SQLSTATE_ECPG_INTERNAL_ERROR, con->name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,7 +180,7 @@ ECPGtrans(int lineno, const char *connection_name, const char *transaction)
|
|||||||
{
|
{
|
||||||
if ((res = PQexec(con->connection, transaction)) == NULL)
|
if ((res = PQexec(con->connection, transaction)) == NULL)
|
||||||
{
|
{
|
||||||
ECPGraise(lineno, ECPG_TRANS, NULL, ECPG_COMPAT_PGSQL);
|
ECPGraise(lineno, ECPG_TRANS, ECPG_SQLSTATE_TRANSACTION_RESOLUTION_UNKNOWN, NULL);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
PQclear(res);
|
PQclear(res);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/prepare.c,v 1.7 2003/08/01 08:21:04 meskes Exp $ */
|
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/prepare.c,v 1.8 2003/08/01 13:53:36 petere Exp $ */
|
||||||
|
|
||||||
#define POSTGRES_ECPG_INTERNAL
|
#define POSTGRES_ECPG_INTERNAL
|
||||||
#include "postgres_fe.h"
|
#include "postgres_fe.h"
|
||||||
@ -120,7 +120,7 @@ ECPGdeallocate(int lineno, int c, char *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
ECPGraise(lineno, ECPG_INVALID_STMT, name, ECPG_COMPAT_PGSQL);
|
ECPGraise(lineno, ECPG_INVALID_STMT, ECPG_SQLSTATE_INVALID_SQL_STATEMENT_NAME, name);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
#ifndef _ECPGLIB_H
|
#ifndef _ECPGLIB_H
|
||||||
#define _ECPGLIB_H
|
#define _ECPGLIB_H
|
||||||
|
|
||||||
#include <stdio.h>
|
#include "postgres_fe.h"
|
||||||
|
#include "libpq-fe.h"
|
||||||
|
|
||||||
#ifndef __BEOS__
|
#ifndef __BEOS__
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
@ -71,7 +72,8 @@ bool ECPGdo_descriptor(int line, const char *connection,
|
|||||||
const char *descriptor, const char *query);
|
const char *descriptor, const char *query);
|
||||||
bool ECPGdeallocate_desc(int line, const char *name);
|
bool ECPGdeallocate_desc(int line, const char *name);
|
||||||
bool ECPGallocate_desc(int line, const char *name);
|
bool ECPGallocate_desc(int line, const char *name);
|
||||||
void ECPGraise(int line, int code, const char *str, int);
|
void ECPGraise(int line, int code, const char *sqlstate, const char *str);
|
||||||
|
void ECPGraise_backend(int line, PGresult *result, PGconn *conn, int compat);
|
||||||
bool ECPGget_desc_header(int, char *, int *);
|
bool ECPGget_desc_header(int, char *, int *);
|
||||||
bool ECPGget_desc(int, char *, int,...);
|
bool ECPGget_desc(int, char *, int,...);
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ struct sqlca_t
|
|||||||
/* 6: empty */
|
/* 6: empty */
|
||||||
/* 7: empty */
|
/* 7: empty */
|
||||||
|
|
||||||
char sqlext[8];
|
char sqlstate[5];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sqlca_t *ECPGget_sqlca(void);
|
struct sqlca_t *ECPGget_sqlca(void);
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/test/Makefile,v 1.38 2003/07/01 12:40:52 meskes Exp $
|
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/test/Makefile,v 1.39 2003/08/01 13:53:36 petere Exp $
|
||||||
|
|
||||||
subdir = src/interfaces/ecpg/test
|
subdir = src/interfaces/ecpg/test
|
||||||
top_builddir = ../../../..
|
top_builddir = ../../../..
|
||||||
include $(top_builddir)/src/Makefile.global
|
include $(top_builddir)/src/Makefile.global
|
||||||
|
|
||||||
override CPPFLAGS := -I$(srcdir)/../include $(CPPFLAGS)
|
override CPPFLAGS := -I$(srcdir)/../include -I$(libpq_srcdir) $(CPPFLAGS)
|
||||||
|
|
||||||
ECPG = ../preproc/ecpg -I$(srcdir)/../include
|
ECPG = ../preproc/ecpg -I$(srcdir)/../include
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user