From a0fed291dcf39cd2191dfb49e1b30262e050de5f Mon Sep 17 00:00:00 2001 From: Michael Meskes <meskes@postgresql.org> Date: Fri, 30 May 2003 08:39:01 +0000 Subject: [PATCH] Sync and some minor cleanup/fixing work plus an EXEC SQL DESCRIBE prototype. --- src/interfaces/ecpg/ChangeLog | 7 + src/interfaces/ecpg/preproc/ecpg.c | 3 +- src/interfaces/ecpg/preproc/ecpg_keywords.c | 4 +- src/interfaces/ecpg/preproc/pgc.l | 53 +++---- src/interfaces/ecpg/preproc/preproc.y | 152 ++++++++++++-------- src/interfaces/ecpg/test/dt_test.pgc | 58 ++++---- 6 files changed, 163 insertions(+), 114 deletions(-) diff --git a/src/interfaces/ecpg/ChangeLog b/src/interfaces/ecpg/ChangeLog index 9c5c187a27a..a601ee1eb8c 100644 --- a/src/interfaces/ecpg/ChangeLog +++ b/src/interfaces/ecpg/ChangeLog @@ -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 diff --git a/src/interfaces/ecpg/preproc/ecpg.c b/src/interfaces/ecpg/preproc/ecpg.c index 740703faf6e..d219047df7d 100644 --- a/src/interfaces/ecpg/preproc/ecpg.c +++ b/src/interfaces/ecpg/preproc/ecpg.c @@ -1,4 +1,4 @@ -/* $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 { diff --git a/src/interfaces/ecpg/preproc/ecpg_keywords.c b/src/interfaces/ecpg/preproc/ecpg_keywords.c index fecf892cfc0..2a02c08503d 100644 --- a/src/interfaces/ecpg/preproc/ecpg_keywords.c +++ b/src/interfaces/ecpg/preproc/ecpg_keywords.c @@ -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}, diff --git a/src/interfaces/ecpg/preproc/pgc.l b/src/interfaces/ecpg/preproc/pgc.l index 923ca5b3ab3..ce390f7461b 100644 --- a/src/interfaces/ecpg/preproc/pgc.l +++ b/src/interfaces/ecpg/preproc/pgc.l @@ -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]; } diff --git a/src/interfaces/ecpg/preproc/preproc.y b/src/interfaces/ecpg/preproc/preproc.y index f001454b2b7..cb24adbb5db 100644 --- a/src/interfaces/ecpg/preproc/preproc.y +++ b/src/interfaces/ecpg/preproc/preproc.y @@ -1,4 +1,4 @@ -/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.225 2003/05/29 13:59:26 meskes Exp $ */ +/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.226 2003/05/30 08:39:01 meskes Exp $ */ /* Copyright comment */ %{ @@ -207,12 +207,12 @@ create_questionmarks(char *name, bool array) SQL_CALL SQL_CARDINALITY SQL_CONNECT SQL_CONNECTION SQL_CONTINUE SQL_COUNT SQL_CURRENT SQL_DATA SQL_DATETIME_INTERVAL_CODE - SQL_DATETIME_INTERVAL_PRECISION + SQL_DATETIME_INTERVAL_PRECISION SQL_DESCRIBE SQL_DESCRIPTOR SQL_DISCONNECT SQL_ENUM SQL_FOUND SQL_FREE SQL_GO SQL_GOTO SQL_IDENTIFIED SQL_INDICATOR SQL_KEY_MEMBER SQL_LENGTH SQL_LONG SQL_NAME SQL_NULLABLE SQL_OCTET_LENGTH - SQL_OPEN SQL_RELEASE SQL_REFERENCE + SQL_OPEN SQL_OUTPUT SQL_RELEASE SQL_REFERENCE SQL_RETURNED_LENGTH SQL_RETURNED_OCTET_LENGTH SQL_SCALE SQL_SECTION SQL_SHORT SQL_SIGNED SQL_SQL SQL_SQLERROR SQL_SQLPRINT SQL_SQLWARNING SQL_START SQL_STOP @@ -369,7 +369,7 @@ create_questionmarks(char *name, bool array) %type <str> ClosePortalStmt DropStmt VacuumStmt AnalyzeStmt opt_verbose %type <str> opt_full func_arg OptWithOids opt_freeze opt_ecpg_into %type <str> analyze_keyword opt_name_list ExplainStmt index_params -%type <str> index_list func_index index_elem opt_class access_method_clause +%type <str> index_elem opt_class access_method_clause %type <str> index_opt_unique IndexStmt func_return ConstInterval %type <str> func_args_list func_args opt_with def_arg overlay_placing %type <str> def_elem def_list definition DefineStmt select_with_parens @@ -439,12 +439,13 @@ create_questionmarks(char *name, bool array) %type <str> struct_union_type s_struct_union vt_declarations %type <str> var_declaration type_declaration single_vt_declaration %type <str> ECPGSetAutocommit on_off variable_declarations -%type <str> ECPGAllocateDescr ECPGDeallocateDescr symbol +%type <str> ECPGAllocateDescr ECPGDeallocateDescr symbol opt_output %type <str> ECPGGetDescriptorHeader ECPGColLabel single_var_declaration %type <str> reserved_keyword unreserved_keyword ecpg_interval %type <str> col_name_keyword func_name_keyword precision opt_scale %type <str> ECPGTypeName variablelist ECPGColLabelCommon c_variable -%type <str> inf_val_list inf_col_list +%type <str> inf_val_list inf_col_list using_descriptor ECPGDescribe +%type <str> into_descriptor %type <struct_union> s_struct_union_symbol @@ -614,6 +615,15 @@ stmt: AlterDatabaseSetStmt { output_statement($1, 0, connection); } { output_simple_statement($1); } + | ECPGDescribe + { + if (connection) + mmerror(PARSE_ERROR, ET_ERROR, "no at option for describe statement.\n"); + + fprintf(yyout, "{ /* ECPGdescribe(__LINE__, %s) */;", $1); + /* whenever_action(2); */ + free($1); + } | ECPGDisconnect { if (connection) @@ -679,7 +689,7 @@ stmt: AlterDatabaseSetStmt { output_statement($1, 0, connection); } | ECPGPrepare { if (connection) - mmerror(PARSE_ERROR, ET_ERROR, "no at option for set connection statement.\n"); + mmerror(PARSE_ERROR, ET_ERROR, "no at option for prepare statement.\n"); fprintf(yyout, "{ ECPGprepare(__LINE__, %s);", $1); whenever_action(2); @@ -1890,7 +1900,7 @@ function_with_argtypes: func_name func_args { $$ = cat2_str($1, $2); }; * * QUERY: * create index <indexname> on <relname> - * [ using <access> ] "(" (<col> with <op>)+ ")" + * [ using <access> ] "(" ( <col> | using <opclass> ] )+ ")" * [ where <predicate> ] * *****************************************************************************/ @@ -1910,23 +1920,17 @@ access_method_clause: USING access_method { $$ = EMPTY; } ; -index_params: index_list { $$ = $1; } - | func_index { $$ = $1; } - ; - -index_list: index_list ',' index_elem - { $$ = cat_str(3, $1, make_str(","), $3); } - | index_elem - { $$ = $1; } - ; - -func_index: func_name '(' name_list ')' opt_class - { $$ = cat_str(5, $1, make_str("("), $3, ")", $5); } +index_params: index_elem { $$ = $1; } + | index_params ',' index_elem { $$ = $1; } ; index_elem: attr_name opt_class - { $$ = cat2_str($1, $2); } - ; + { $$ = cat2_str($1, $2); } + | func_name '(' expr_list ')' opt_class + { $$ = cat_str(5, $1, make_str("("), $3, ")", $5); } + | '(' a_expr ')' opt_class + { $$ = cat_str(4, make_str("("), $2, make_str(")"), $4); } + ; opt_class: any_name { $$ = $1; } | USING any_name { $$ = cat2_str(make_str("using"), $2); } @@ -3873,7 +3877,7 @@ name_list: name ; -name: ColId { $$ = $1; }; +name: ColId { $$ = $1; }; database_name: ColId { $$ = $1; }; access_method: ColId { $$ = $1; }; attr_name: ColId { $$ = $1; }; @@ -5135,28 +5139,33 @@ ECPGFree: SQL_FREE name { $$ = $2; }; ECPGOpen: SQL_OPEN name opt_ecpg_using { $$ = $2; }; opt_ecpg_using: /*EMPTY*/ { $$ = EMPTY; } - | USING variablelist - { - /* mmerror ("open cursor with variables not implemented yet"); */ - $$ = EMPTY; - } + | USING variablelist { $$ = EMPTY; } ; -opt_sql: /*EMPTY*/ | SQL_SQL; - -ecpg_into: INTO into_list +using_descriptor: USING opt_sql SQL_DESCRIPTOR quoted_ident_stringvar { + add_variable(&argsresult, descriptor_variable($4,0), &no_indicator); $$ = EMPTY; } - | INTO opt_sql SQL_DESCRIPTOR quoted_ident_stringvar + ; + +into_descriptor: INTO opt_sql SQL_DESCRIPTOR quoted_ident_stringvar { add_variable(&argsresult, descriptor_variable($4,0), &no_indicator); $$ = EMPTY; } ; + +opt_sql: /*EMPTY*/ | SQL_SQL; + +ecpg_into: INTO into_list { $$ = EMPTY; } + | into_descriptor { $$ = $1; } + | using_descriptor { $$ = $1; } + ; -opt_ecpg_into: /*EMPTY*/ { $$ = EMPTY; } - | ecpg_into { $$ = $1; } +opt_ecpg_into: /*EMPTY*/ { $$ = EMPTY; } + | INTO into_list { $$ = EMPTY; } + | into_descriptor { $$ = $1; } ; c_variable: civarind | civar; @@ -5166,11 +5175,36 @@ variablelist: c_variable | c_variable ',' variablelist; /* * As long as the prepare statement is not supported by the backend, we will * try to simulate it here so we get dynamic SQL + * + * It is supported now but not usable yet by ecpg. */ ECPGPrepare: PREPARE name FROM execstring { $$ = cat2_str(make3_str(make_str("\""), $2, make_str("\",")), $4); } ; +/* + * We accept descibe but do nothing with it so far. + */ +ECPGDescribe: SQL_DESCRIBE INPUT_P name using_descriptor + { + mmerror(PARSE_ERROR, ET_ERROR, "using unsupported describe statement.\n"); + $$ = cat_str(3, make_str("input"), $3, $4); + } + | SQL_DESCRIBE opt_output name using_descriptor + { + mmerror(PARSE_ERROR, ET_ERROR, "using unsupported describe statement.\n"); + $$ = cat_str(3, $2, $3, $4); + } + | SQL_DESCRIBE opt_output name into_descriptor + { + mmerror(PARSE_ERROR, ET_ERROR, "using unsupported describe statement.\n"); + $$ = cat_str(3, $2, $3, $4); + } + ; +opt_output: SQL_OUTPUT { $$ = make_str("output"); } + | /* EMPTY */ { $$ = EMPTY; } + ; + /* * dynamic SQL: descriptor based access * written by Christof Petig <christof.petig@wtal.de> @@ -5509,44 +5543,46 @@ ECPGKeywords: ECPGKeywords_vanames { $$ = $1; } ; ECPGKeywords_vanames: SQL_BREAK { $$ = make_str("break"); } - | SQL_CALL { $$ = make_str("call"); } + | SQL_CALL { $$ = make_str("call"); } | SQL_CARDINALITY { $$ = make_str("cardinality"); } | SQL_CONTINUE { $$ = make_str("continue"); } - | SQL_COUNT { $$ = make_str("count"); } - | SQL_DATA { $$ = make_str("data"); } + | SQL_COUNT { $$ = make_str("count"); } + | SQL_DATA { $$ = make_str("data"); } | SQL_DATETIME_INTERVAL_CODE { $$ = make_str("datetime_interval_code"); } | SQL_DATETIME_INTERVAL_PRECISION { $$ = make_str("datetime_interval_precision"); } - | SQL_FOUND { $$ = make_str("found"); } - | SQL_GO { $$ = make_str("go"); } - | SQL_GOTO { $$ = make_str("goto"); } + | SQL_FOUND { $$ = make_str("found"); } + | SQL_GO { $$ = make_str("go"); } + | SQL_GOTO { $$ = make_str("goto"); } | SQL_IDENTIFIED { $$ = make_str("identified"); } | SQL_INDICATOR { $$ = make_str("indicator"); } | SQL_KEY_MEMBER { $$ = make_str("key_member"); } | SQL_LENGTH { $$ = make_str("length"); } - | SQL_NAME { $$ = make_str("name"); } + | SQL_NAME { $$ = make_str("name"); } | SQL_NULLABLE { $$ = make_str("nullable"); } | SQL_OCTET_LENGTH { $$ = make_str("octet_length"); } | SQL_RELEASE { $$ = make_str("release"); } | SQL_RETURNED_LENGTH { $$ = make_str("returned_length"); } - | SQL_RETURNED_OCTET_LENGTH { $$ = make_str("returned_octet_length"); } - | SQL_SCALE { $$ = make_str("scale"); } + | SQL_RETURNED_OCTET_LENGTH { $$ = make_str("returned_octet_length"); } + | SQL_SCALE { $$ = make_str("scale"); } | SQL_SECTION { $$ = make_str("section"); } | SQL_SQLERROR { $$ = make_str("sqlerror"); } | SQL_SQLPRINT { $$ = make_str("sqlprint"); } | SQL_SQLWARNING { $$ = make_str("sqlwarning"); } - | SQL_STOP { $$ = make_str("stop"); } + | SQL_STOP { $$ = make_str("stop"); } ; ECPGKeywords_rest: SQL_CONNECT { $$ = make_str("connect"); } + | SQL_DESCRIBE { $$ = make_str("describe"); } | SQL_DISCONNECT { $$ = make_str("disconnect"); } - | SQL_OPEN { $$ = make_str("open"); } - | SQL_VAR { $$ = make_str("var"); } + | SQL_OPEN { $$ = make_str("open"); } + | SQL_VAR { $$ = make_str("var"); } | SQL_WHENEVER { $$ = make_str("whenever"); } ; /* additional keywords that can be SQL type names (but not ECPGColLabels) */ ECPGTypeName: SQL_BOOL { $$ = make_str("bool"); } | SQL_LONG { $$ = make_str("long"); } + | SQL_OUTPUT { $$ = make_str("output"); } | SQL_SHORT { $$ = make_str("short"); } | SQL_STRUCT { $$ = make_str("struct"); } | SQL_SIGNED { $$ = make_str("signed"); } @@ -5578,28 +5614,29 @@ ColId: ident { $$ = $1; } /* Type identifier --- names that can be type names. */ -type_name: ident { $$ = $1; } +type_name: ident { $$ = $1; } | unreserved_keyword { $$ = $1; } - | ECPGKeywords { $$ = $1; } - | ECPGTypeName { $$ = $1; } + | ECPGKeywords { $$ = $1; } + | ECPGTypeName { $$ = $1; } ; /* Function identifier --- names that can be function names. */ -function_name: ident { $$ = $1; } +function_name: ident { $$ = $1; } | unreserved_keyword { $$ = $1; } - | func_name_keyword { $$ = $1; } - | ECPGKeywords { $$ = $1; } + | func_name_keyword { $$ = $1; } + | ECPGKeywords { $$ = $1; } ; /* Column label --- allowed labels in "AS" clauses. * This presently includes *all* Postgres keywords. */ -ColLabel: ECPGColLabel { $$ = $1; } - | ECPGTypeName { $$ = $1; } - | CHAR_P { $$ = make_str("char"); } - | INT_P { $$ = make_str("int"); } - | UNION { $$ = make_str("union"); } +ColLabel: ECPGColLabel { $$ = $1; } + | ECPGTypeName { $$ = $1; } + | CHAR_P { $$ = make_str("char"); } + | INPUT_P { $$ = make_str("input"); } + | INT_P { $$ = make_str("int"); } + | UNION { $$ = make_str("union"); } ; ECPGColLabelCommon: ident { $$ = $1; } @@ -5693,7 +5730,6 @@ unreserved_keyword: | INDEX { $$ = make_str("index"); } | INHERITS { $$ = make_str("inherits"); } | INOUT { $$ = make_str("inout"); } - | INPUT_P { $$ = make_str("input"); } | INSENSITIVE { $$ = make_str("insensitive"); } | INSERT { $$ = make_str("insert"); } | INSTEAD { $$ = make_str("instead"); } diff --git a/src/interfaces/ecpg/test/dt_test.pgc b/src/interfaces/ecpg/test/dt_test.pgc index 68d099136ec..a5eb7cce9bb 100644 --- a/src/interfaces/ecpg/test/dt_test.pgc +++ b/src/interfaces/ecpg/test/dt_test.pgc @@ -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; -- GitLab