Skip to content

Commit e9c3f02

Browse files
author
Michael Meskes
committed
*** empty log message ***
1 parent a5a290c commit e9c3f02

File tree

16 files changed

+587
-336
lines changed

16 files changed

+587
-336
lines changed

src/interfaces/ecpg/ChangeLog

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -925,3 +925,13 @@ Wed May 17 07:52:59 CEST 2000
925925
handling.
926926
- Set library version to 3.1.1.
927927

928+
Mon Sep 4 14:10:38 PDT 2000
929+
930+
- Synced preproc.y with gram.y.
931+
- Synced keyword.c.
932+
933+
Mon Sep 18 13:55:11 PDT 2000
934+
935+
- Added int8 support based on a patch by Martijn Schoemaker <martijn@osp.nl>
936+
- Set ecpg version to 2.8.0.
937+
- Set library version to 3.2.0.

src/interfaces/ecpg/TODO

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@ instead of libpq so we can write backend functions using ecpg.
2626

2727
remove space_or_nl and line_end from pgc.l
2828

29-
Missing statements:
29+
Missing features:
3030
- SQLSTATE
31+
- LONG LONG datatype

src/interfaces/ecpg/include/ecpgtype.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,14 @@ extern "C"
4747
ECPGt_char_variable,
4848
ECPGt_EOIT, /* End of insert types. */
4949
ECPGt_EORT, /* End of result types. */
50-
ECPGt_NO_INDICATOR /* no indicator */
50+
ECPGt_NO_INDICATOR, /* no indicator */
51+
ECPGt_long_long, ECPGt_unsigned_long_long
5152
};
5253

5354
/* descriptor items */
5455
enum ECPGdtype
5556
{
56-
ECPGd_count,
57+
ECPGd_count = 1,
5758
ECPGd_data,
5859
ECPGd_di_code,
5960
ECPGd_di_precision,

src/interfaces/ecpg/lib/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# Copyright (c) 1994, Regents of the University of California
66
#
7-
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/Makefile,v 1.8 2000/09/17 13:02:46 petere Exp $
7+
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/Makefile,v 1.9 2000/09/19 11:47:13 meskes Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -14,7 +14,7 @@ include $(top_builddir)/src/Makefile.global
1414

1515
NAME= ecpg
1616
SO_MAJOR_VERSION= 3
17-
SO_MINOR_VERSION= 1.1
17+
SO_MINOR_VERSION= 2.0
1818

1919
CPPFLAGS += -I$(top_srcdir)/src/interfaces/ecpg/include -I$(libpq_srcdir)
2020

src/interfaces/ecpg/lib/data.c

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno,
6060
case ECPGt_unsigned_long:
6161
((long *) ind)[act_tuple] = -PQgetisnull(results, act_tuple, act_field);
6262
break;
63+
case ECPGt_long_long:
64+
((long long int*) ind)[act_tuple] = -PQgetisnull(results, act_tuple, act_field);
65+
break;
66+
case ECPGt_unsigned_long_long:
67+
((unsigned long long int*) ind)[act_tuple] = -PQgetisnull(results, act_tuple, act_field);
68+
break;
6369
case ECPGt_NO_INDICATOR:
6470
if (PQgetisnull(results, act_tuple, act_field))
6571
{
@@ -93,7 +99,6 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno,
9399
{
94100
ECPGraise(lineno, ECPG_INT_FORMAT, pval);
95101
return (false);
96-
res = 0L;
97102
}
98103
}
99104
else
@@ -127,7 +132,6 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno,
127132
{
128133
ECPGraise(lineno, ECPG_UINT_FORMAT, pval);
129134
return (false);
130-
ures = 0L;
131135
}
132136
}
133137
else
@@ -150,7 +154,38 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno,
150154
}
151155
break;
152156

157+
case ECPGt_long_long:
158+
if (pval)
159+
{
160+
((long long int *) var)[act_tuple] = strtoull(pval, &scan_length, 10);
161+
if ((isarray && *scan_length != ',' && *scan_length != '}')
162+
|| (!isarray && *scan_length != '\0')) /* Garbage left */
163+
{
164+
ECPGraise(lineno, ECPG_INT_FORMAT, pval);
165+
return (false);
166+
}
167+
}
168+
else
169+
((long long int *) var)[act_tuple] = 0LL;
170+
171+
break;
153172

173+
case ECPGt_unsigned_long_long:
174+
if (pval)
175+
{
176+
((unsigned long long int *) var)[act_tuple] = strtoull(pval, &scan_length, 10);
177+
if ((isarray && *scan_length != ',' && *scan_length != '}')
178+
|| (!isarray && *scan_length != '\0')) /* Garbage left */
179+
{
180+
ECPGraise(lineno, ECPG_UINT_FORMAT, pval);
181+
return (false);
182+
}
183+
}
184+
else
185+
((unsigned long long int *) var)[act_tuple] = 0LL;
186+
187+
break;
188+
154189
case ECPGt_float:
155190
case ECPGt_double:
156191
if (pval)

src/interfaces/ecpg/lib/descriptor.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,29 +63,35 @@ get_int_item(int lineno, void *var, enum ECPGdtype vartype, int value)
6363
{
6464
switch (vartype)
6565
{
66-
case ECPGt_short:
67-
*(short *) var = value;
66+
case ECPGt_short:
67+
*(short *) var = (short) value;
6868
break;
6969
case ECPGt_int:
70-
*(int *) var = value;
70+
*(int *) var = (int) value;
7171
break;
7272
case ECPGt_long:
73-
*(long *) var = value;
73+
*(long *) var = (long) value;
7474
break;
7575
case ECPGt_unsigned_short:
76-
*(unsigned short *) var = value;
76+
*(unsigned short *) var = (unsigned short) value;
7777
break;
7878
case ECPGt_unsigned_int:
79-
*(unsigned int *) var = value;
79+
*(unsigned int *) var = (unsigned int) value;
8080
break;
8181
case ECPGt_unsigned_long:
82-
*(unsigned long *) var = value;
82+
*(unsigned long *) var = (unsigned long) value;
83+
break;
84+
case ECPGt_long_long:
85+
*(long long int *) var = (long long int) value;
86+
break;
87+
case ECPGt_unsigned_long_long:
88+
*(unsigned long long int *) var = (unsigned long long int) value;
8389
break;
8490
case ECPGt_float:
85-
*(float *) var = value;
91+
*(float *) var = (float) value;
8692
break;
8793
case ECPGt_double:
88-
*(double *) var = value;
94+
*(double *) var = (double) value;
8995
break;
9096
default:
9197
ECPGraise(lineno, ECPG_VAR_NOT_NUMERIC, NULL);

src/interfaces/ecpg/lib/execute.c

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,11 @@ ECPGexecute(struct statement * stmt)
305305
if (*(long *) var->ind_value < 0L)
306306
strcpy(buff, "null");
307307
break;
308+
case ECPGt_long_long:
309+
case ECPGt_unsigned_long_long:
310+
if (*(long long int*) var->ind_value < 0LL)
311+
strcpy(buff, "null");
312+
break;
308313
default:
309314
break;
310315
}
@@ -428,6 +433,44 @@ ECPGexecute(struct statement * stmt)
428433

429434
tobeinserted = mallocedval;
430435
break;
436+
437+
case ECPGt_long_long:
438+
if (!(mallocedval = ecpg_alloc(var->arrsize * 25, stmt->lineno)))
439+
return false;
440+
441+
if (var->arrsize > 1)
442+
{
443+
strncpy(mallocedval, "'{", sizeof("'{"));
444+
445+
for (element = 0; element < var->arrsize; element++)
446+
sprintf(mallocedval + strlen(mallocedval), "%lld,", ((long long *) var->value)[element]);
447+
448+
strncpy(mallocedval + strlen(mallocedval) - 1, "}'", sizeof("}'"));
449+
}
450+
else
451+
sprintf(mallocedval, "%lld", *((long long *) var->value));
452+
453+
tobeinserted = mallocedval;
454+
break;
455+
456+
case ECPGt_unsigned_long_long:
457+
if (!(mallocedval = ecpg_alloc(var->arrsize * 25, stmt->lineno)))
458+
return false;
459+
460+
if (var->arrsize > 1)
461+
{
462+
strncpy(mallocedval, "'{", sizeof("'{"));
463+
464+
for (element = 0; element < var->arrsize; element++)
465+
sprintf(mallocedval + strlen(mallocedval), "%llu,", ((unsigned long long *) var->value)[element]);
466+
467+
strncpy(mallocedval + strlen(mallocedval) - 1, "}'", sizeof("}'"));
468+
}
469+
else
470+
sprintf(mallocedval, "%llu", *((unsigned long long*) var->value));
471+
472+
tobeinserted = mallocedval;
473+
break;
431474

432475
case ECPGt_float:
433476
if (!(mallocedval = ecpg_alloc(var->arrsize * 20, stmt->lineno)))
@@ -868,7 +911,7 @@ ECPGdo(int lineno, const char *connection_name, char *query,...)
868911
*
869912
* Copyright (c) 2000, Christof Petig <christof.petig@wtal.de>
870913
*
871-
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.7 2000/05/29 21:25:00 momjian Exp $
914+
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.8 2000/09/19 11:47:13 meskes Exp $
872915
*/
873916

874917
PGconn *ECPG_internal_get_connection(char *name);

src/interfaces/ecpg/lib/typename.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ ECPGtype_name(enum ECPGttype typ)
2828
return "long";
2929
case ECPGt_unsigned_long:
3030
return "unsigned long";
31+
case ECPGt_long_long:
32+
return "long long";
33+
case ECPGt_unsigned_long_long:
34+
return "unsigned long long";
3135
case ECPGt_float:
3236
return "float";
3337
case ECPGt_double:

src/interfaces/ecpg/preproc/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ top_builddir = ../../../..
33
include $(top_builddir)/src/Makefile.global
44

55
MAJOR_VERSION=2
6-
MINOR_VERSION=7
7-
PATCHLEVEL=1
6+
MINOR_VERSION=8
7+
PATCHLEVEL=0
88

99
CPPFLAGS+=-I../include -DMAJOR_VERSION=$(MAJOR_VERSION) \
1010
-DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \

src/interfaces/ecpg/preproc/descriptor.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,11 @@ ECPGnumeric_lvalue(FILE *f, char *name)
4646
case ECPGt_short:
4747
case ECPGt_int:
4848
case ECPGt_long:
49+
case ECPGt_long_long:
4950
case ECPGt_unsigned_short:
5051
case ECPGt_unsigned_int:
5152
case ECPGt_unsigned_long:
53+
case ECPGt_unsigned_long_long:
5254
fputs(name, yyout);
5355
break;
5456
default:

src/interfaces/ecpg/preproc/ecpg_keywords.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ static ScanKeyword ScanKeywords[] = {
5050
{"name", SQL_NAME},
5151
{"nullable", SQL_NULLABLE},
5252
{"octet_length", SQL_OCTET_LENGTH},
53-
{"off", SQL_OFF},
5453
{"open", SQL_OPEN},
5554
{"prepare", SQL_PREPARE},
5655
{"reference", SQL_REFERENCE},

src/interfaces/ecpg/preproc/keywords.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.28 2000/06/12 19:40:55 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.29 2000/09/19 11:47:14 meskes Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -55,8 +55,10 @@ static ScanKeyword ScanKeywords[] = {
5555
{"cascade", CASCADE},
5656
{"case", CASE},
5757
{"cast", CAST},
58+
{"chain", CHAIN},
5859
{"char", CHAR},
5960
{"character", CHARACTER},
61+
{"characteristics", CHARACTERISTICS},
6062
{"check", CHECK},
6163
{"close", CLOSE},
6264
{"cluster", CLUSTER},
@@ -100,6 +102,7 @@ static ScanKeyword ScanKeywords[] = {
100102
{"else", ELSE},
101103
{"encoding", ENCODING},
102104
{"end", END_TRANS},
105+
{"escape", ESCAPE},
103106
{"except", EXCEPT},
104107
{"exclusive", EXCLUSIVE},
105108
{"execute", EXECUTE},
@@ -123,13 +126,15 @@ static ScanKeyword ScanKeywords[] = {
123126
{"handler", HANDLER},
124127
{"having", HAVING},
125128
{"hour", HOUR_P},
129+
{"ilike", ILIKE},
126130
{"immediate", IMMEDIATE},
127131
{"in", IN},
128132
{"increment", INCREMENT},
129133
{"index", INDEX},
130134
{"inherits", INHERITS},
131135
{"initially", INITIALLY},
132136
{"inner", INNER_P},
137+
{"inout", INOUT},
133138
{"insensitive", INSENSITIVE},
134139
{"insert", INSERT},
135140
{"instead", INSTEAD},
@@ -178,6 +183,7 @@ static ScanKeyword ScanKeywords[] = {
178183
{"nullif", NULLIF},
179184
{"numeric", NUMERIC},
180185
{"of", OF},
186+
{"off", OFF},
181187
{"offset", OFFSET},
182188
{"oids", OIDS},
183189
{"old", OLD},
@@ -188,9 +194,11 @@ static ScanKeyword ScanKeywords[] = {
188194
{"overlaps", OVERLAPS},
189195
{"or", OR},
190196
{"order", ORDER},
197+
{"out", OUT},
191198
{"outer", OUTER_P},
192199
{"partial", PARTIAL},
193200
{"password", PASSWORD},
201+
{"path", PATH_P},
194202
{"pendant", PENDANT},
195203
{"position", POSITION},
196204
{"precision", PRECISION},
@@ -213,12 +221,14 @@ static ScanKeyword ScanKeywords[] = {
213221
{"rollback", ROLLBACK},
214222
{"row", ROW},
215223
{"rule", RULE},
224+
{"schema", SCHEMA},
216225
{"scroll", SCROLL},
217226
{"second", SECOND_P},
218227
{"select", SELECT},
219228
{"sequence", SEQUENCE},
220229
{"serial", SERIAL},
221230
{"serializable", SERIALIZABLE},
231+
{"session", SESSION},
222232
{"session_user", SESSION_USER},
223233
{"set", SET},
224234
{"setof", SETOF},
@@ -240,6 +250,7 @@ static ScanKeyword ScanKeywords[] = {
240250
{"timezone_hour", TIMEZONE_HOUR},
241251
{"timezone_minute", TIMEZONE_MINUTE},
242252
{"to", TO},
253+
{"toast", TOAST},
243254
{"trailing", TRAILING},
244255
{"transaction", TRANSACTION},
245256
{"trigger", TRIGGER},
@@ -267,6 +278,7 @@ static ScanKeyword ScanKeywords[] = {
267278
{"when", WHEN},
268279
{"where", WHERE},
269280
{"with", WITH},
281+
{"without", WITHOUT},
270282
{"work", WORK},
271283
{"year", YEAR_P},
272284
{"zone", ZONE},

0 commit comments

Comments
 (0)