Commit a0fed291 authored by Michael Meskes's avatar Michael Meskes

Sync and some minor cleanup/fixing work plus an EXEC SQL DESCRIBE prototype.

parent 5666462f
......@@ -1458,6 +1458,13 @@ Thu May 29 15:45:57 CEST 2003
- Changed parsing of variables to be able to reference one attribute
of the n-th entry in an array of structs.
Fri May 30 10:29:49 CEST 2003
- Synced parser.
- Added a dummy rule for EXEC SQL DESCRIBE that throws an error
message.
- Some minor cleanup/bug fixing.
- Set ecpg version to 2.12.0.
- Set ecpg library to 3.4.2.
- Set pgtypes library to 1.0.0
......
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.71 2003/05/27 14:36:00 meskes Exp $ */
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.72 2003/05/30 08:39:00 meskes Exp $ */
/* New main for ecpg, the PostgreSQL embedded SQL precompiler. */
/* (C) Michael Meskes <meskes@postgresql.org> Feb 5th, 1998 */
......@@ -169,6 +169,7 @@ main(int argc, char *const argv[])
/* system_includes = true; */
add_preprocessor_define("dec_t=Numeric");
add_preprocessor_define("intrvl_t=Interval");
add_preprocessor_define("dtime_t=Timestamp");
}
else
{
......
......@@ -4,7 +4,7 @@
* lexical token lookup for reserved words in postgres embedded SQL
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/ecpg_keywords.c,v 1.27 2002/10/21 13:09:31 meskes Exp $
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/ecpg_keywords.c,v 1.28 2003/05/30 08:39:00 meskes Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -38,6 +38,7 @@ static ScanKeyword ScanKeywords[] = {
{"data", SQL_DATA},
{"datetime_interval_code", SQL_DATETIME_INTERVAL_CODE},
{"datetime_interval_precision", SQL_DATETIME_INTERVAL_PRECISION},
{"describe", SQL_DESCRIBE},
{"descriptor", SQL_DESCRIPTOR},
{"disconnect", SQL_DISCONNECT},
{"enum", SQL_ENUM},
......@@ -54,6 +55,7 @@ static ScanKeyword ScanKeywords[] = {
{"nullable", SQL_NULLABLE},
{"octet_length", SQL_OCTET_LENGTH},
{"open", SQL_OPEN},
{"output", SQL_OUTPUT},
{"reference", SQL_REFERENCE},
{"release", SQL_RELEASE},
{"returned_length", SQL_RETURNED_LENGTH},
......
......@@ -12,7 +12,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.113 2003/05/29 13:59:26 meskes Exp $
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.114 2003/05/30 08:39:01 meskes Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -569,33 +569,36 @@ cppline {space}*#(.*\\{space})+.*
}
}
/* Is it an SQL keyword? */
keyword = ScanKeywordLookup(yytext);
if (keyword != NULL)
return keyword->value;
if (ptr == NULL)
{
/* Is it an SQL keyword? */
keyword = ScanKeywordLookup(yytext);
if (keyword != NULL)
return keyword->value;
/* Is it an ECPG keyword? */
keyword = ScanECPGKeywordLookup( yytext);
if (keyword != NULL)
return keyword->value;
/* Is it an ECPG keyword? */
keyword = ScanECPGKeywordLookup( yytext);
if (keyword != NULL)
return keyword->value;
/* Is it a C keyword? */
keyword = ScanCKeywordLookup(yytext);
if (keyword != NULL)
return keyword->value;
/* Is it a C keyword? */
keyword = ScanCKeywordLookup(yytext);
if (keyword != NULL)
return keyword->value;
/*
* None of the above. Return it as an identifier.
*
* The backend would attempt to truncate and case-fold
* the identifier, but I see no good reason for ecpg
* to do so; that's just another way that ecpg could get
* out of step with the backend.
*/
if (ptr == NULL)
{
yylval.str = mm_strdup(yytext);
return IDENT;
/*
* None of the above. Return it as an identifier.
*
* The backend would attempt to truncate and case-fold
* the identifier, but I see no good reason for ecpg
* to do so; that's just another way that ecpg could get
* out of step with the backend.
*/
if (ptr == NULL)
{
yylval.str = mm_strdup(yytext);
return IDENT;
}
}
}
<SQL>{other} { return yytext[0]; }
......
This diff is collapsed.
......@@ -30,13 +30,13 @@ main()
exec sql select * into :date1, :ts1 , :iv1 from date_test;
text = PGTYPESdate_dtoa(date1);
text = PGTYPESdate_to_asc(date1);
printf ("Date: %s\n", text);
text = PGTYPEStimestamp_ttoa(ts1);
text = PGTYPEStimestamp_to_asc(ts1);
printf ("timestamp: %s\n", text);
text = PGTYPESinterval_itoa(&iv1);
text = PGTYPESinterval_to_asc(&iv1);
printf ("interval: %s\n", text);
PGTYPESdate_mdyjul(mdy, &date2);
......@@ -49,19 +49,19 @@ main()
PGTYPESdate_julmdy(date2, mdy);
printf("m: %d, d: %d, y: %d\n", mdy[0], mdy[1], mdy[2]);
ts1 = PGTYPEStimestamp_atot("2003-12-04 17:34:29", NULL);
text = PGTYPEStimestamp_ttoa(ts1);
ts1 = PGTYPEStimestamp_from_asc("2003-12-04 17:34:29", NULL);
text = PGTYPEStimestamp_to_asc(ts1);
printf("date_day of %s is %d\n", text, PGTYPESdate_dayofweek(ts1));
PGTYPESdate_today(&date1);
text = PGTYPESdate_dtoa(date1);
text = PGTYPESdate_to_asc(date1);
printf("today is %s\n", text);
fmt = "(ddd), mmm. dd, yyyy, repeat: (ddd), mmm. dd, yyyy. end";
out = (char*) malloc(strlen(fmt) + 1);
PGTYPESdate_fmtdate(date1, fmt, out);
PGTYPESdate_fmt_asc(date1, fmt, out);
printf("Today in format \"%s\" is \"%s\"\n", fmt, out);
free(out);
......@@ -73,78 +73,78 @@ main()
/* 0123456789012345678901234567890123456789012345678901234567890
* 0 1 2 3 4 5 6
*/
PGTYPESdate_defmtdate(&date1, fmt, in);
text = PGTYPESdate_dtoa(date1);
PGTYPESdate_defmt_asc(&date1, fmt, in);
text = PGTYPESdate_to_asc(date1);
printf("defmtdate1: %s\n", text);
date1 = 0; text = "";
fmt = "mmmm. dd. yyyy";
in = "12/25/95";
PGTYPESdate_defmtdate(&date1, fmt, in);
text = PGTYPESdate_dtoa(date1);
PGTYPESdate_defmt_asc(&date1, fmt, in);
text = PGTYPESdate_to_asc(date1);
printf("defmtdate2: %s\n", text);
date1 = 0; text = "";
fmt = "yy/mm/dd";
in = "95/12/25";
PGTYPESdate_defmtdate(&date1, fmt, in);
text = PGTYPESdate_dtoa(date1);
PGTYPESdate_defmt_asc(&date1, fmt, in);
text = PGTYPESdate_to_asc(date1);
printf("defmtdate3: %s\n", text);
date1 = 0; text = "";
fmt = "yy/mm/dd";
in = "1995, December 25th";
PGTYPESdate_defmtdate(&date1, fmt, in);
text = PGTYPESdate_dtoa(date1);
PGTYPESdate_defmt_asc(&date1, fmt, in);
text = PGTYPESdate_to_asc(date1);
printf("defmtdate4: %s\n", text);
date1 = 0; text = "";
fmt = "dd-mm-yy";
in = "This is 25th day of December, 1995";
PGTYPESdate_defmtdate(&date1, fmt, in);
text = PGTYPESdate_dtoa(date1);
PGTYPESdate_defmt_asc(&date1, fmt, in);
text = PGTYPESdate_to_asc(date1);
printf("defmtdate5: %s\n", text);
date1 = 0; text = "";
fmt = "mmddyy";
in = "Dec. 25th, 1995";
PGTYPESdate_defmtdate(&date1, fmt, in);
text = PGTYPESdate_dtoa(date1);
PGTYPESdate_defmt_asc(&date1, fmt, in);
text = PGTYPESdate_to_asc(date1);
printf("defmtdate6: %s\n", text);
date1 = 0; text = "";
fmt = "mmm. dd. yyyy";
in = "dec 25th 1995";
PGTYPESdate_defmtdate(&date1, fmt, in);
text = PGTYPESdate_dtoa(date1);
PGTYPESdate_defmt_asc(&date1, fmt, in);
text = PGTYPESdate_to_asc(date1);
printf("defmtdate7: %s\n", text);
date1 = 0; text = "";
fmt = "mmm. dd. yyyy";
in = "DEC-25-1995";
PGTYPESdate_defmtdate(&date1, fmt, in);
text = PGTYPESdate_dtoa(date1);
PGTYPESdate_defmt_asc(&date1, fmt, in);
text = PGTYPESdate_to_asc(date1);
printf("defmtdate8: %s\n", text);
date1 = 0; text = "";
fmt = "mm yy dd.";
in = "12199525";
PGTYPESdate_defmtdate(&date1, fmt, in);
text = PGTYPESdate_dtoa(date1);
PGTYPESdate_defmt_asc(&date1, fmt, in);
text = PGTYPESdate_to_asc(date1);
printf("defmtdate9: %s\n", text);
date1 = 0; text = "";
fmt = "yyyy fierj mm dd.";
in = "19951225";
PGTYPESdate_defmtdate(&date1, fmt, in);
text = PGTYPESdate_dtoa(date1);
PGTYPESdate_defmt_asc(&date1, fmt, in);
text = PGTYPESdate_to_asc(date1);
printf("defmtdate10: %s\n", text);
date1 = 0; text = "";
fmt = "mm/dd/yy";
in = "122595";
PGTYPESdate_defmtdate(&date1, fmt, in);
text = PGTYPESdate_dtoa(date1);
PGTYPESdate_defmt_asc(&date1, fmt, in);
text = PGTYPESdate_to_asc(date1);
printf("defmtdate12: %s\n", text);
exec sql rollback;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment