Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit efac279

Browse files
author
Michael Meskes
committed
Changed the way symbols are defined in C in INFORMIX mode.
1 parent df1e965 commit efac279

File tree

5 files changed

+19
-41
lines changed

5 files changed

+19
-41
lines changed

src/interfaces/ecpg/ChangeLog

+4
Original file line numberDiff line numberDiff line change
@@ -2313,3 +2313,7 @@ Thu, 14 Feb 2008 13:11:34 +0100
23132313
- EXECUTE can return NOT FOUND so it should be checked here too.
23142314
- Changed regression test accordingly.
23152315

2316+
Fri, 15 Feb 2008 12:01:13 +0100
2317+
2318+
- Changed the way symbols are defined in C in INFORMIX mode.
2319+
+4-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/include/datetime.h,v 1.14 2008/02/14 12:27:26 meskes Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/include/datetime.h,v 1.15 2008/02/15 11:20:21 meskes Exp $ */
22

33
#ifndef _ECPG_DATETIME_H
44
#define _ECPG_DATETIME_H
55

66
#include <ecpg_informix.h>
77

8-
typedef timestamp dtime_t;
9-
typedef interval intrvl_t;
8+
/* brought in by ecpg_informix.h nowadays
9+
* typedef timestamp dtime_t;
10+
* typedef interval intrvl_t; */
1011

1112
#endif /* ndef _ECPG_DATETIME_H */

src/interfaces/ecpg/include/decimal.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/include/decimal.h,v 1.16 2008/02/14 12:27:26 meskes Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/include/decimal.h,v 1.17 2008/02/15 11:20:21 meskes Exp $ */
22

33
#ifndef _ECPG_DECIMAL_H
44
#define _ECPG_DECIMAL_H
55

66
#include <ecpg_informix.h>
77

8-
typedef decimal dec_t;
8+
/* brought in by ecpg_informix.h nowadays
9+
* typedef decimal dec_t; */
910

1011
#endif /* ndef _ECPG_DECIMAL_H */

src/interfaces/ecpg/include/ecpg_informix.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* This file contains stuff needed to be as compatible to Informix as possible.
3-
* $PostgreSQL: pgsql/src/interfaces/ecpg/include/ecpg_informix.h,v 1.20 2008/02/14 12:27:26 meskes Exp $
3+
* $PostgreSQL: pgsql/src/interfaces/ecpg/include/ecpg_informix.h,v 1.21 2008/02/15 11:20:21 meskes Exp $
44
*/
55
#ifndef _ECPG_INFORMIX_H
66
#define _ECPG_INFORMIX_H
@@ -82,6 +82,11 @@ extern int dttofmtasc(timestamp *, char *, int, char *);
8282
extern int intoasc(interval *, char *);
8383
extern int dtcvfmtasc(char *, char *, timestamp *);
8484

85+
/* we also define Informix datatypes here */
86+
typedef timestamp dtime_t;
87+
typedef interval intrvl_t;
88+
typedef decimal dec_t;
89+
8590
#ifdef __cplusplus
8691
}
8792
#endif

src/interfaces/ecpg/preproc/pgc.l

+2-35
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
*
1414
* IDENTIFICATION
15-
* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.161 2008/02/14 12:27:26 meskes Exp $
15+
* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.162 2008/02/15 11:20:21 meskes Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -47,7 +47,6 @@ static void addlitchar (unsigned char);
4747
static void parse_include (void);
4848
static bool ecpg_isspace(char ch);
4949
static bool isdefine(void);
50-
static bool isinformixdefine(void);
5150

5251
char *token_start;
5352
int state_before;
@@ -744,9 +743,7 @@ cppline {space}*#(.*\\{space})*.*{newline}
744743
<C>{identifier} {
745744
const ScanKeyword *keyword;
746745

747-
/* Informix uses SQL defines only in SQL space */
748-
/* however, some defines have to be taken care of for compatibility */
749-
if ((!INFORMIX_MODE || !isinformixdefine()) && !isdefine())
746+
if (!isdefine())
750747
{
751748
keyword = ScanCKeywordLookup(yytext);
752749
if (keyword != NULL)
@@ -1318,36 +1315,6 @@ static bool isdefine(void)
13181315
return false;
13191316
}
13201317

1321-
static bool isinformixdefine(void)
1322-
{
1323-
const char *new = NULL;
1324-
1325-
if (strcmp(yytext, "dec_t") == 0)
1326-
new = "decimal";
1327-
else if (strcmp(yytext, "intrvl_t") == 0)
1328-
new = "interval";
1329-
else if (strcmp(yytext, "dtime_t") == 0)
1330-
new = "timestamp";
1331-
1332-
if (new)
1333-
{
1334-
struct _yy_buffer *yb;
1335-
1336-
yb = mm_alloc(sizeof(struct _yy_buffer));
1337-
1338-
yb->buffer = YY_CURRENT_BUFFER;
1339-
yb->lineno = yylineno;
1340-
yb->filename = mm_strdup(input_filename);
1341-
yb->next = yy_buffer;
1342-
yy_buffer = yb;
1343-
1344-
yy_scan_string(new);
1345-
return true;
1346-
}
1347-
1348-
return false;
1349-
}
1350-
13511318
/*
13521319
* Called before any actual parsing is done
13531320
*/

0 commit comments

Comments
 (0)