*** empty log message ***

This commit is contained in:
Michael Meskes 2000-09-19 11:47:16 +00:00
parent a5a290cab9
commit e9c3f0255f
16 changed files with 585 additions and 334 deletions

View File

@ -925,3 +925,13 @@ Wed May 17 07:52:59 CEST 2000
handling.
- Set library version to 3.1.1.
Mon Sep 4 14:10:38 PDT 2000
- Synced preproc.y with gram.y.
- Synced keyword.c.
Mon Sep 18 13:55:11 PDT 2000
- Added int8 support based on a patch by Martijn Schoemaker <martijn@osp.nl>
- Set ecpg version to 2.8.0.
- Set library version to 3.2.0.

View File

@ -26,5 +26,6 @@ instead of libpq so we can write backend functions using ecpg.
remove space_or_nl and line_end from pgc.l
Missing statements:
Missing features:
- SQLSTATE
- LONG LONG datatype

View File

@ -47,13 +47,14 @@ extern "C"
ECPGt_char_variable,
ECPGt_EOIT, /* End of insert types. */
ECPGt_EORT, /* End of result types. */
ECPGt_NO_INDICATOR /* no indicator */
ECPGt_NO_INDICATOR, /* no indicator */
ECPGt_long_long, ECPGt_unsigned_long_long
};
/* descriptor items */
enum ECPGdtype
{
ECPGd_count,
ECPGd_count = 1,
ECPGd_data,
ECPGd_di_code,
ECPGd_di_precision,

View File

@ -4,7 +4,7 @@
#
# Copyright (c) 1994, Regents of the University of California
#
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/Makefile,v 1.8 2000/09/17 13:02:46 petere Exp $
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/Makefile,v 1.9 2000/09/19 11:47:13 meskes Exp $
#
#-------------------------------------------------------------------------
@ -14,7 +14,7 @@ include $(top_builddir)/src/Makefile.global
NAME= ecpg
SO_MAJOR_VERSION= 3
SO_MINOR_VERSION= 1.1
SO_MINOR_VERSION= 2.0
CPPFLAGS += -I$(top_srcdir)/src/interfaces/ecpg/include -I$(libpq_srcdir)

View File

@ -60,6 +60,12 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno,
case ECPGt_unsigned_long:
((long *) ind)[act_tuple] = -PQgetisnull(results, act_tuple, act_field);
break;
case ECPGt_long_long:
((long long int*) ind)[act_tuple] = -PQgetisnull(results, act_tuple, act_field);
break;
case ECPGt_unsigned_long_long:
((unsigned long long int*) ind)[act_tuple] = -PQgetisnull(results, act_tuple, act_field);
break;
case ECPGt_NO_INDICATOR:
if (PQgetisnull(results, act_tuple, act_field))
{
@ -93,7 +99,6 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno,
{
ECPGraise(lineno, ECPG_INT_FORMAT, pval);
return (false);
res = 0L;
}
}
else
@ -127,7 +132,6 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno,
{
ECPGraise(lineno, ECPG_UINT_FORMAT, pval);
return (false);
ures = 0L;
}
}
else
@ -150,7 +154,38 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno,
}
break;
case ECPGt_long_long:
if (pval)
{
((long long int *) var)[act_tuple] = strtoull(pval, &scan_length, 10);
if ((isarray && *scan_length != ',' && *scan_length != '}')
|| (!isarray && *scan_length != '\0')) /* Garbage left */
{
ECPGraise(lineno, ECPG_INT_FORMAT, pval);
return (false);
}
}
else
((long long int *) var)[act_tuple] = 0LL;
break;
case ECPGt_unsigned_long_long:
if (pval)
{
((unsigned long long int *) var)[act_tuple] = strtoull(pval, &scan_length, 10);
if ((isarray && *scan_length != ',' && *scan_length != '}')
|| (!isarray && *scan_length != '\0')) /* Garbage left */
{
ECPGraise(lineno, ECPG_UINT_FORMAT, pval);
return (false);
}
}
else
((unsigned long long int *) var)[act_tuple] = 0LL;
break;
case ECPGt_float:
case ECPGt_double:
if (pval)

View File

@ -63,29 +63,35 @@ get_int_item(int lineno, void *var, enum ECPGdtype vartype, int value)
{
switch (vartype)
{
case ECPGt_short:
*(short *) var = value;
case ECPGt_short:
*(short *) var = (short) value;
break;
case ECPGt_int:
*(int *) var = value;
*(int *) var = (int) value;
break;
case ECPGt_long:
*(long *) var = value;
*(long *) var = (long) value;
break;
case ECPGt_unsigned_short:
*(unsigned short *) var = value;
*(unsigned short *) var = (unsigned short) value;
break;
case ECPGt_unsigned_int:
*(unsigned int *) var = value;
*(unsigned int *) var = (unsigned int) value;
break;
case ECPGt_unsigned_long:
*(unsigned long *) var = value;
*(unsigned long *) var = (unsigned long) value;
break;
case ECPGt_long_long:
*(long long int *) var = (long long int) value;
break;
case ECPGt_unsigned_long_long:
*(unsigned long long int *) var = (unsigned long long int) value;
break;
case ECPGt_float:
*(float *) var = value;
*(float *) var = (float) value;
break;
case ECPGt_double:
*(double *) var = value;
*(double *) var = (double) value;
break;
default:
ECPGraise(lineno, ECPG_VAR_NOT_NUMERIC, NULL);

View File

@ -305,6 +305,11 @@ ECPGexecute(struct statement * stmt)
if (*(long *) var->ind_value < 0L)
strcpy(buff, "null");
break;
case ECPGt_long_long:
case ECPGt_unsigned_long_long:
if (*(long long int*) var->ind_value < 0LL)
strcpy(buff, "null");
break;
default:
break;
}
@ -428,6 +433,44 @@ ECPGexecute(struct statement * stmt)
tobeinserted = mallocedval;
break;
case ECPGt_long_long:
if (!(mallocedval = ecpg_alloc(var->arrsize * 25, stmt->lineno)))
return false;
if (var->arrsize > 1)
{
strncpy(mallocedval, "'{", sizeof("'{"));
for (element = 0; element < var->arrsize; element++)
sprintf(mallocedval + strlen(mallocedval), "%lld,", ((long long *) var->value)[element]);
strncpy(mallocedval + strlen(mallocedval) - 1, "}'", sizeof("}'"));
}
else
sprintf(mallocedval, "%lld", *((long long *) var->value));
tobeinserted = mallocedval;
break;
case ECPGt_unsigned_long_long:
if (!(mallocedval = ecpg_alloc(var->arrsize * 25, stmt->lineno)))
return false;
if (var->arrsize > 1)
{
strncpy(mallocedval, "'{", sizeof("'{"));
for (element = 0; element < var->arrsize; element++)
sprintf(mallocedval + strlen(mallocedval), "%llu,", ((unsigned long long *) var->value)[element]);
strncpy(mallocedval + strlen(mallocedval) - 1, "}'", sizeof("}'"));
}
else
sprintf(mallocedval, "%llu", *((unsigned long long*) var->value));
tobeinserted = mallocedval;
break;
case ECPGt_float:
if (!(mallocedval = ecpg_alloc(var->arrsize * 20, stmt->lineno)))
@ -868,7 +911,7 @@ ECPGdo(int lineno, const char *connection_name, char *query,...)
*
* Copyright (c) 2000, Christof Petig <christof.petig@wtal.de>
*
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.7 2000/05/29 21:25:00 momjian Exp $
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.8 2000/09/19 11:47:13 meskes Exp $
*/
PGconn *ECPG_internal_get_connection(char *name);

View File

@ -28,6 +28,10 @@ ECPGtype_name(enum ECPGttype typ)
return "long";
case ECPGt_unsigned_long:
return "unsigned long";
case ECPGt_long_long:
return "long long";
case ECPGt_unsigned_long_long:
return "unsigned long long";
case ECPGt_float:
return "float";
case ECPGt_double:

View File

@ -3,8 +3,8 @@ top_builddir = ../../../..
include $(top_builddir)/src/Makefile.global
MAJOR_VERSION=2
MINOR_VERSION=7
PATCHLEVEL=1
MINOR_VERSION=8
PATCHLEVEL=0
CPPFLAGS+=-I../include -DMAJOR_VERSION=$(MAJOR_VERSION) \
-DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \

View File

@ -46,9 +46,11 @@ ECPGnumeric_lvalue(FILE *f, char *name)
case ECPGt_short:
case ECPGt_int:
case ECPGt_long:
case ECPGt_long_long:
case ECPGt_unsigned_short:
case ECPGt_unsigned_int:
case ECPGt_unsigned_long:
case ECPGt_unsigned_long_long:
fputs(name, yyout);
break;
default:

View File

@ -50,7 +50,6 @@ static ScanKeyword ScanKeywords[] = {
{"name", SQL_NAME},
{"nullable", SQL_NULLABLE},
{"octet_length", SQL_OCTET_LENGTH},
{"off", SQL_OFF},
{"open", SQL_OPEN},
{"prepare", SQL_PREPARE},
{"reference", SQL_REFERENCE},

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.28 2000/06/12 19:40:55 momjian Exp $
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.29 2000/09/19 11:47:14 meskes Exp $
*
*-------------------------------------------------------------------------
*/
@ -55,8 +55,10 @@ static ScanKeyword ScanKeywords[] = {
{"cascade", CASCADE},
{"case", CASE},
{"cast", CAST},
{"chain", CHAIN},
{"char", CHAR},
{"character", CHARACTER},
{"characteristics", CHARACTERISTICS},
{"check", CHECK},
{"close", CLOSE},
{"cluster", CLUSTER},
@ -100,6 +102,7 @@ static ScanKeyword ScanKeywords[] = {
{"else", ELSE},
{"encoding", ENCODING},
{"end", END_TRANS},
{"escape", ESCAPE},
{"except", EXCEPT},
{"exclusive", EXCLUSIVE},
{"execute", EXECUTE},
@ -123,6 +126,7 @@ static ScanKeyword ScanKeywords[] = {
{"handler", HANDLER},
{"having", HAVING},
{"hour", HOUR_P},
{"ilike", ILIKE},
{"immediate", IMMEDIATE},
{"in", IN},
{"increment", INCREMENT},
@ -130,6 +134,7 @@ static ScanKeyword ScanKeywords[] = {
{"inherits", INHERITS},
{"initially", INITIALLY},
{"inner", INNER_P},
{"inout", INOUT},
{"insensitive", INSENSITIVE},
{"insert", INSERT},
{"instead", INSTEAD},
@ -178,6 +183,7 @@ static ScanKeyword ScanKeywords[] = {
{"nullif", NULLIF},
{"numeric", NUMERIC},
{"of", OF},
{"off", OFF},
{"offset", OFFSET},
{"oids", OIDS},
{"old", OLD},
@ -188,9 +194,11 @@ static ScanKeyword ScanKeywords[] = {
{"overlaps", OVERLAPS},
{"or", OR},
{"order", ORDER},
{"out", OUT},
{"outer", OUTER_P},
{"partial", PARTIAL},
{"password", PASSWORD},
{"path", PATH_P},
{"pendant", PENDANT},
{"position", POSITION},
{"precision", PRECISION},
@ -213,12 +221,14 @@ static ScanKeyword ScanKeywords[] = {
{"rollback", ROLLBACK},
{"row", ROW},
{"rule", RULE},
{"schema", SCHEMA},
{"scroll", SCROLL},
{"second", SECOND_P},
{"select", SELECT},
{"sequence", SEQUENCE},
{"serial", SERIAL},
{"serializable", SERIALIZABLE},
{"session", SESSION},
{"session_user", SESSION_USER},
{"set", SET},
{"setof", SETOF},
@ -240,6 +250,7 @@ static ScanKeyword ScanKeywords[] = {
{"timezone_hour", TIMEZONE_HOUR},
{"timezone_minute", TIMEZONE_MINUTE},
{"to", TO},
{"toast", TOAST},
{"trailing", TRAILING},
{"transaction", TRANSACTION},
{"trigger", TRIGGER},
@ -267,6 +278,7 @@ static ScanKeyword ScanKeywords[] = {
{"when", WHEN},
{"where", WHERE},
{"with", WITH},
{"without", WITHOUT},
{"work", WORK},
{"year", YEAR_P},
{"zone", ZONE},

View File

@ -12,7 +12,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.60 2000/06/28 18:29:40 petere Exp $
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.61 2000/09/19 11:47:14 meskes Exp $
*
*-------------------------------------------------------------------------
*/
@ -50,6 +50,8 @@ static char *literalbuf = NULL; /* expandable buffer */
static int literallen; /* actual current length */
static int literalalloc; /* current allocated buffer size */
static int xcdepth = 0;
#define startlit() (literalbuf[0] = '\0', literallen = 0)
static void addlit(char *ytext, int yleng);
@ -140,6 +142,7 @@ xqcat {quote}{whitespace_with_newline}{quote}
dquote \"
xdstart {dquote}
xdstop {dquote}
xddouble {dquote}{dquote}
xdinside [^"]+
/* special stuff for C strings */
@ -169,7 +172,7 @@ xdcinside ({xdcqq}|{xdcqdq}|{xdcother})
*/
xcstart \/\*{op_chars}*
xcstop \*+\/
xcinside ([^*]+)|(\*+[^/])
xcinside [^*/]+
digit [0-9]
letter [\200-\377_A-Za-z]
@ -190,7 +193,7 @@ typecast "::"
* rule for "operator"!
*/
self [,()\[\].;$\:\+\-\*\/\%\^\<\>\=\|]
op_chars [\~\!\@\#\^\&\|\`\?\$\:\+\-\*\/\%\<\>\=]
op_chars [\~\!\@\#\^\&\|\`\?\$\+\-\*\/\%\<\>\=]
operator {op_chars}+
/* we no longer allow unary minus in numbers.
@ -281,15 +284,30 @@ cppline {space}*#(.*\\{line_end})*.*
{xcstart} {
state_before = YYSTATE;
xcdepth = 0;
BEGIN(xc);
/* Put back any characters past slash-star; see above */
yyless(2);
fputs("/*", yyout);
}
<xc>{xcstop} { ECHO; BEGIN(state_before); }
<xc>{xcstart} {
xcdepth++;
/* Put back any characters past slash-star; see above */
yyless(2);
fputs("/*", yyout);
}
<xc>{xcstop} {
ECHO;
if (xcdepth <= 0)
BEGIN(state_before);
else
xcdepth--;
}
<xc>{xcinside} { ECHO; }
<xc>{op_chars} { ECHO; }
<xc><<EOF>> { mmerror(ET_ERROR, "Unterminated /* comment"); }
@ -361,11 +379,36 @@ cppline {space}*#(.*\\{line_end})*.*
BEGIN(xd);
startlit();
}
<xd,xdc>{xdstop} {
<xd>{xdstop} {
BEGIN(state_before);
if (strlen(literalbuf) >= NAMEDATALEN)
{
#ifdef MULTIBYTE
int len;
len = pg_mbcliplen(literalbuf,strlen(literalbuf),NAMEDATALEN-1);
sprintf(errortext, "identifier \"%s\" will be truncated to \"%.*s\"",
literalbuf, len, literalbuf);
literalbuf[len] = '\0';
#else
sprintf(errortext, "identifier \"%s\" will be truncated to \"%.*s\"",
literalbuf, NAMEDATALEN-1, literalbuf);
literalbuf[NAMEDATALEN-1] = '\0';
#endif
mmerror(ET_WARN, errortext);
}
yylval.str = mm_strdup(literalbuf);
return CSTRING;
}
<xdc>{xdstop} {
BEGIN(state_before);
yylval.str = mm_strdup(literalbuf);
return CSTRING;
}
<xd>{xddouble} {
addlit(yytext, yyleng-1);
}
<xd>{xdinside} {
addlit(yytext, yyleng);
}
@ -426,7 +469,7 @@ cppline {space}*#(.*\\{line_end})*.*
for (ic = nchars-2; ic >= 0; ic--)
{
if (strchr("~!@#&`?$:%^|", yytext[ic]))
if (strchr("~!@#^&|`?$%", yytext[ic]))
break;
}
if (ic >= 0)
@ -498,8 +541,19 @@ cppline {space}*#(.*\\{line_end})*.*
if (i >= NAMEDATALEN)
{
sprintf(errortext, "Identifier \"%s\" will be truncated to \"%.*s\"", yytext, NAMEDATALEN-1, yytext);
mmerror (ET_WARN, errortext);
#ifdef MULTIBYTE
int len;
len = pg_mbcliplen(lower_text,strlen(lower_text),NAMEDATALEN-1);
sprintf(errortext, "identifier \"%s\" will be truncated to \"%.*s\"",
lower_text, len, lower_text);
lower_text[len] = '\0';
#else
sprintf(errortext, "identifier \"%s\" will be truncated to \"%.*s\"",
lower_text, NAMEDATALEN-1, lower_text);
lower_text[NAMEDATALEN-1] = '\0';
#endif
mmerror(ET_WARN, errortext);
yytext[NAMEDATALEN-1] = '\0';
}

File diff suppressed because it is too large Load Diff

View File

@ -146,7 +146,13 @@ get_type(enum ECPGttype typ)
return ("ECPGt_long");
break;
case ECPGt_unsigned_long:
return ("ECPGt_unsigned_int");
return ("ECPGt_unsigned_long");
break;
case ECPGt_long_long:
return ("ECPGt_long_long");
break;
case ECPGt_unsigned_long_long:
return ("ECPGt_unsigned_long_long");
break;
case ECPGt_float:
return ("ECPGt_float");

View File

@ -260,9 +260,11 @@ check_indicator(struct ECPGtype * var)
case ECPGt_short:
case ECPGt_int:
case ECPGt_long:
case ECPGt_long_long:
case ECPGt_unsigned_short:
case ECPGt_unsigned_int:
case ECPGt_unsigned_long:
case ECPGt_unsigned_long_long:
break;
case ECPGt_struct: