Skip to content

Commit 08b999f

Browse files
author
Michael Meskes
committed
*** empty log message ***
1 parent 9672d38 commit 08b999f

File tree

6 files changed

+44
-31
lines changed

6 files changed

+44
-31
lines changed

src/interfaces/ecpg/ChangeLog

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,9 @@ Thu Jan 27 08:12:05 CET 2000
790790
- Fixed error messages in pgc.l.
791791
- Improved variable parsing.
792792
- Synced preproc.y with gram.y.
793+
794+
Mon Feb 14 10:35:18 CET 2000
795+
796+
- Synced preproc.y with gram.y.
793797
- Set library version to 3.0.10.
794798
- Set ecpg version to 2.7.0.
795-

src/interfaces/ecpg/lib/ecpglib.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ ECPGexecute(struct statement * stmt)
395395
{
396396
bool status = false;
397397
char *copiedquery;
398-
PGresult *results;
398+
PGresult *results, *query;
399399
PGnotify *notify;
400400
struct variable *var;
401401

@@ -669,7 +669,8 @@ ECPGexecute(struct statement * stmt)
669669
{
670670
char *pval;
671671
char *scan_length;
672-
672+
char *array_query;
673+
673674
if (var == NULL)
674675
{
675676
ECPGlog("ECPGexecute line %d: Too few arguments.\n", stmt->lineno);
@@ -724,10 +725,15 @@ ECPGexecute(struct statement * stmt)
724725
*((void **) var->pointer) = var->value;
725726
add_mem(var->value, stmt->lineno);
726727
}
727-
728-
729-
ECPGlog("ECPGexecute line %d: TYPE db: %d c: %d\n", stmt->lineno, PQftype(results, act_field), var->type);
730-
728+
729+
#if 0
730+
array_query = (char *)ecpg_alloc(strlen("select typelem from pg_type where oid=") + 11, stmt -> lineno);
731+
sprintf(array_query, "select typelem from pg_type where oid=%d", PQftype(results, act_field));
732+
query = PQexec(stmt->connection->connection, array_query);
733+
if (PQresultStatus(query) == PGRES_TUPLES_OK)
734+
ECPGlog("ECPGexecute line %d: TYPE database: %d C: %d array OID: %s\n", stmt->lineno, PQftype(results, act_field), var->type, (char *)PQgetvalue(query, 0, 0));
735+
PQclear(query);
736+
#endif
731737
for (act_tuple = 0; act_tuple < ntuples && status; act_tuple++)
732738
{
733739
pval = (char *)PQgetvalue(results, act_tuple, act_field);

src/interfaces/ecpg/preproc/extern.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ extern void lex_init(void);
3737
extern char *input_filename;
3838
extern int yyparse(void);
3939
extern int yylex(void);
40-
extern void yyerror(const char * error);
40+
extern void yyerror(char *);
4141
extern void *mm_alloc(size_t), *mm_realloc(void *, size_t);
4242
extern char *mm_strdup(const char *);
4343
extern void mmerror(enum errortype, char * );

src/interfaces/ecpg/preproc/preproc.y

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -760,9 +760,9 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
760760
%type <str> opt_collate Datetime datetime opt_timezone opt_interval
761761
%type <str> numeric a_expr_or_null row_expr row_descriptor row_list
762762
%type <str> SelectStmt SubSelect result OptTemp OptTempType OptTempScope
763-
%type <str> opt_table opt_all opt_unique sort_clause sortby_list
763+
%type <str> opt_table opt_all sort_clause sortby_list
764764
%type <str> sortby OptUseOp opt_inh_star relation_name_list name_list
765-
%type <str> group_clause having_clause from_clause
765+
%type <str> group_clause having_clause from_clause opt_distinct
766766
%type <str> table_list join_outer where_clause relation_expr sub_type
767767
%type <str> opt_column_list insert_rest InsertStmt OptimizableStmt
768768
%type <str> columnList DeleteStmt LockStmt UpdateStmt CursorStmt
@@ -1306,35 +1306,35 @@ AlterTableStmt:
13061306
/* ALTER TABLE <name> ADD [COLUMN] <coldef> */
13071307
ALTER TABLE relation_name opt_inh_star ADD opt_column columnDef
13081308
{
1309-
$$ = cat_str(5, make_str("alter table"), $3, $4, make_str("add"), $6, $7);
1309+
$$ = cat_str(6, make_str("alter table"), $3, $4, make_str("add"), $6, $7);
13101310
}
13111311
/* ALTER TABLE <name> ALTER [COLUMN] <colname> {SET DEFAULT <expr>|DROP
13121312
DEFAULT} */
13131313
| ALTER TABLE relation_name opt_inh_star ALTER opt_column ColId
13141314
alter_column_action
13151315
{
1316-
$$ = cat_str(6, make_str("alter table"), $3, $4, make_str("alter"), $6, $7, $8);
1316+
$$ = cat_str(7, make_str("alter table"), $3, $4, make_str("alter"), $6, $7, $8);
13171317
}
13181318
/* ALTER TABLE <name> DROP [COLUMN] <name> {RESTRICT|CASCADE} */
1319-
| ALTER TABLE relation_name opt_inh_star DROP opt_column ColId
1320-
/* drop_behavior */
1319+
| ALTER TABLE relation_name opt_inh_star DROP opt_column ColId drop_behavior
13211320
{
1322-
$$ = cat_str(5, make_str("alter table"), $3, $4, make_str("drop"), $6, $7);
1321+
$$ = cat_str(7, make_str("alter table"), $3, $4, make_str("drop"), $6, $7, $8);
13231322
}
13241323
/* ALTER TABLE <name> ADD CONSTRAINT ... */
13251324
| ALTER TABLE relation_name opt_inh_star ADD TableConstraint
13261325
{
1327-
$$ = cat_str(4, make_str("alter table"), $3, $4, make_str("add"), $6);
1326+
$$ = cat_str(5, make_str("alter table"), $3, $4, make_str("add"), $6);
13281327
}
13291328
/* ALTER TABLE <name> DROP CONSTRAINT ... */
13301329
| ALTER TABLE relation_name opt_inh_star DROP CONSTRAINT name drop_behavior
13311330
{
1332-
$$ = cat_str(5, make_str("alter table"), $3, $4, make_str("drop constraint"), $7, $8);
1331+
$$ = cat_str(6, make_str("alter table"), $3, $4, make_str("drop constraint"), $7, $8);
13331332
}
13341333
;
13351334

13361335
alter_column_action:
1337-
SET DEFAULT a_expr_or_null { $$ = cat2_str(make_str("set default"), $3); }
1336+
SET DEFAULT a_expr { $$ = cat2_str(make_str("set default"), $3); }
1337+
| SET DEFAULT NULL_P { $$ = make_str("set default null"); }
13381338
| DROP DEFAULT { $$ = make_str("drop default"); }
13391339
;
13401340

@@ -1579,7 +1579,6 @@ key_match: MATCH FULL
15791579
}
15801580
| /*EMPTY*/
15811581
{
1582-
mmerror(ET_WARN, "FOREIGN KEY match type UNSPECIFIED not implemented yet");
15831582
$$ = EMPTY;
15841583
}
15851584
;
@@ -1735,7 +1734,7 @@ CreateTrigStmt: CREATE TRIGGER name TriggerActionTime TriggerEvents ON
17351734
{
17361735
$$ = cat_str(12, make_str("create trigger"), $3, $4, $5, make_str("on"), $7, $8, make_str("execute procedure"), $11, make_str("("), $13, make_str(")"));
17371736
}
1738-
| CREATE CONSTRAINT TRIGGER name AFTER TriggerOneEvent ON
1737+
| CREATE CONSTRAINT TRIGGER name AFTER TriggerEvents ON
17391738
relation_name OptConstrFromTable
17401739
ConstraintAttributeSpec
17411740
FOR EACH ROW EXECUTE PROCEDURE
@@ -2507,12 +2506,8 @@ UnlistenStmt: UNLISTEN relation_name
25072506
*
25082507
* Transactions:
25092508
*
2510-
* abort transaction
2511-
* (ABORT)
2512-
* begin transaction
2513-
* (BEGIN)
2514-
* end transaction
2515-
* (END)
2509+
* BEGIN / COMMIT / ROLLBACK
2510+
* (also older versions END / ABORT)
25162511
*
25172512
*****************************************************************************/
25182513
TransactionStmt: ABORT_TRANS opt_trans { $$ = make_str("rollback"); }
@@ -2912,7 +2907,7 @@ select_clause: '(' select_clause ')'
29122907
}
29132908
;
29142909

2915-
SubSelect: SELECT opt_unique target_list
2910+
SubSelect: SELECT opt_distinct target_list
29162911
result from_clause where_clause
29172912
group_clause having_clause
29182913
{
@@ -2937,8 +2932,8 @@ opt_all: ALL { $$ = make_str("all"); }
29372932
| /*EMPTY*/ { $$ = EMPTY; }
29382933
;
29392934

2940-
opt_unique: DISTINCT { $$ = make_str("distinct"); }
2941-
| DISTINCT ON ColId { $$ = cat2_str(make_str("distinct on"), $3); }
2935+
opt_distinct: DISTINCT { $$ = make_str("distinct"); }
2936+
| DISTINCT ON '(' expr_list ')' { $$ = cat_str(3, make_str("distinct on ("), $4, make_str(")")); }
29422937
| ALL { $$ = make_str("all"); }
29432938
| /*EMPTY*/ { $$ = EMPTY; }
29442939
;
@@ -5428,7 +5423,7 @@ blockend : '}' {
54285423

54295424
%%
54305425

5431-
void yyerror(const char * error)
5426+
void yyerror(char * error)
54325427
{
54335428
mmerror(ET_ERROR, error);
54345429
}

src/interfaces/ecpg/test/stp.pgc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,19 @@ int my_fun (void)
55
EXEC SQL BEGIN DECLARE SECTION;
66
int sql_index = 0;
77
EXEC SQL END DECLARE SECTION;
8+
FILE *dbgs;
9+
10+
if ((dbgs = fopen("/tmp/log", "w")) != NULL)
11+
ECPGdebug(1, dbgs);
812

913
EXEC SQL WHENEVER SQLERROR GOTO Error;
14+
15+
EXEC SQL CONNECT TO 'mm';
1016
EXEC SQL SELECT MIN(index) INTO :sql_index FROM tab;
17+
EXEC SQL DISCONNECT;
18+
19+
if (dbgs != NULL)
20+
fclose(dbgs);
1121

1222
return (sql_index);
1323

src/interfaces/ecpg/test/test5.pgc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ int main (void)
1313
EXEC SQL END DECLARE SECTION;
1414
FILE *dbgs;
1515

16-
1716
if ((dbgs = fopen("log", "w")) != NULL)
1817
ECPGdebug(1, dbgs);
1918

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy