Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
69f9fab1
Commit
69f9fab1
authored
19 years ago
by
Michael Meskes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Synced parser and keyword list.
- Added another test case.
parent
7ccaf13a
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
185 additions
and
12 deletions
+185
-12
src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/ChangeLog
+5
-0
src/interfaces/ecpg/preproc/keywords.c
src/interfaces/ecpg/preproc/keywords.c
+4
-1
src/interfaces/ecpg/preproc/preproc.y
src/interfaces/ecpg/preproc/preproc.y
+45
-9
src/interfaces/ecpg/test/Makefile
src/interfaces/ecpg/test/Makefile
+8
-2
src/interfaces/ecpg/test/test_informix2.pgc
src/interfaces/ecpg/test/test_informix2.pgc
+123
-0
No files found.
src/interfaces/ecpg/ChangeLog
View file @
69f9fab1
...
...
@@ -1971,6 +1971,11 @@ Fr Jan 13 17:29:30 CET 2006
Tu Jan 17 18:53:03 CET 2006
- Data transferred binary is now put into the variables verbatim.
Tu Jan 24 10:59:21 CET 2006
- Synced parser and keyword list.
- Added another test case.
- Set ecpg library version to 5.2.
- Set ecpg version to 4.2.1.
This diff is collapsed.
Click to expand it.
src/interfaces/ecpg/preproc/keywords.c
View file @
69f9fab1
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.7
1 2005/12/27 04:00:08 momjian
Exp $
* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.7
2 2006/01/24 11:01:37 meskes
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -158,6 +158,7 @@ static ScanKeyword ScanKeywords[] = {
{
"header"
,
HEADER_P
},
{
"hold"
,
HOLD
},
{
"hour"
,
HOUR_P
},
{
"if"
,
IF_P
},
{
"ilike"
,
ILIKE
},
{
"immediate"
,
IMMEDIATE
},
{
"immutable"
,
IMMUTABLE
},
...
...
@@ -246,6 +247,7 @@ static ScanKeyword ScanKeywords[] = {
{
"out"
,
OUT_P
},
{
"outer"
,
OUTER_P
},
{
"overlaps"
,
OVERLAPS
},
{
"owned"
,
OWNED
},
{
"owner"
,
OWNER
},
{
"partial"
,
PARTIAL
},
{
"password"
,
PASSWORD
},
...
...
@@ -262,6 +264,7 @@ static ScanKeyword ScanKeywords[] = {
{
"quote"
,
QUOTE
},
{
"read"
,
READ
},
{
"real"
,
REAL
},
{
"reassign"
,
REASSIGN
},
{
"recheck"
,
RECHECK
},
{
"references"
,
REFERENCES
},
{
"reindex"
,
REINDEX
},
...
...
This diff is collapsed.
Click to expand it.
src/interfaces/ecpg/preproc/preproc.y
View file @
69f9fab1
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.31
5 2005/12/29 04:53:18 neilc
Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.31
6 2006/01/24 11:01:37 meskes
Exp $ */
/* Copyright comment */
%{
...
...
@@ -377,7 +377,7 @@ add_additional_variables(char *name, bool insert)
HANDLER HAVING HEADER_P HOLD HOUR_P
ILIKE IMMEDIATE IMMUTABLE IMPLICIT_P IN_P INCLUDING INCREMENT
I
F_P I
LIKE IMMEDIATE IMMUTABLE IMPLICIT_P IN_P INCLUDING INCREMENT
INDEX INHERIT INHERITS INITIALLY INNER_P INOUT INPUT_P
INSENSITIVE INSERT INSTEAD INT_P INTEGER INTERSECT
INTERVAL INTO INVOKER IS ISNULL ISOLATION
...
...
@@ -397,7 +397,7 @@ add_additional_variables(char *name, bool insert)
NOT NOTHING NOTIFY NOTNULL NOWAIT NULL_P NULLIF NUMERIC
OBJECT_P OF OFF OFFSET OIDS OLD ON ONLY OPERATOR OPTION OR ORDER
OUT_P OUTER_P OVERLAPS OVERLAY OWNER
OUT_P OUTER_P OVERLAPS OVERLAY OWNE
D OWNE
R
PARTIAL PASSWORD PLACING POSITION
PRECISION PRESERVE PREPARE PREPARED PRIMARY
...
...
@@ -405,7 +405,7 @@ add_additional_variables(char *name, bool insert)
QUOTE
READ REAL RECHECK REFERENCES REINDEX RELATIVE_P RELEASE RENAME
READ REAL RE
ASSIGN RE
CHECK REFERENCES REINDEX RELATIVE_P RELEASE RENAME
REPEATABLE REPLACE RESET RESTART RESTRICT RETURNS REVOKE RIGHT
ROLE ROLLBACK ROW ROWS RULE
...
...
@@ -520,7 +520,7 @@ add_additional_variables(char *name, bool insert)
%type <str> ViewStmt LoadStmt CreatedbStmt createdb_opt_item ExplainableStmt
%type <str> createdb_opt_list opt_encoding OptInherit opt_equal
%type <str> privilege_list privilege privilege_target
%type <str> opt_grant_grant_option cursor_options
%type <str> opt_grant_grant_option cursor_options
DropOwnedStmt
%type <str> transaction_mode_list_or_empty transaction_mode_list
%type <str> function_with_argtypes_list function_with_argtypes IntConstVar
%type <str> DropdbStmt ClusterStmt grantee RevokeStmt Bit DropOpClassStmt
...
...
@@ -531,7 +531,7 @@ add_additional_variables(char *name, bool insert)
%type <str> ConstraintTimeSpec AlterDatabaseSetStmt DropAssertStmt
%type <str> select_offset_value ReindexStmt join_type opt_boolean
%type <str> join_qual joined_table opclass_item
%type <str> lock_type array_expr_list
%type <str> lock_type array_expr_list
ReassignOwnedStmt
%type <str> OptConstrFromTable OptTempTableName StringConst array_expr
%type <str> constraints_set_mode comment_type
%type <str> CreateGroupStmt AlterGroupStmt DropGroupStmt key_delete
...
...
@@ -698,6 +698,7 @@ stmt: AlterDatabaseStmt { output_statement($1, 0, connection); }
| DropCastStmt { output_statement($1, 0, connection); }
| DropGroupStmt { output_statement($1, 0, connection); }
| DropOpClassStmt { output_statement($1, 0, connection); }
| DropOwnedStmt { output_statement($1, 0, connection); }
| DropPLangStmt { output_statement($1, 0, connection); }
| DropRoleStmt { output_statement($1, 0, connection); }
| DropRuleStmt { output_statement($1, 0, connection); }
...
...
@@ -718,6 +719,7 @@ stmt: AlterDatabaseStmt { output_statement($1, 0, connection); }
| LockStmt { output_statement($1, 0, connection); }
| NotifyStmt { output_statement($1, 0, connection); }
/* | PrepareStmt { output_statement($1, 0, connection); }*/
| ReassignOwnedStmt { output_statement($1, 0, connection); }
| ReindexStmt { output_statement($1, 0, connection); }
| RemoveAggrStmt { output_statement($1, 0, connection); }
| RemoveOperStmt { output_statement($1, 0, connection); }
...
...
@@ -924,6 +926,7 @@ opt_with: WITH { $$ = make_str("with"); }
*/
OptRoleList:
PASSWORD Sconst { $$ = cat2_str(make_str("password"), $2); }
| PASSWORD NULL_P { $$ = make_str("password null"); }
| ENCRYPTED PASSWORD Sconst { $$ = cat2_str(make_str("encrypted password"), $3); }
| UNENCRYPTED PASSWORD Sconst { $$ = cat2_str(make_str("unencrypted password"), $3); }
| SUPERUSER_P { $$ = make_str("superuser"); }
...
...
@@ -1995,11 +1998,35 @@ DropOpClassStmt: DROP OPERATOR CLASS any_name USING access_method opt_drop_behav
*
* QUERY:
*
* DROP itemtype itemname [, itemname ...]
* DROP OWNED BY username [, username ...] [ RESTRICT | CASCADE ]
* REASSIGN OWNED BY username [, username ...] TO username
*
*****************************************************************************/
DropOwnedStmt:
DROP OWNED BY name_list opt_drop_behavior
{
$$ = cat_str(3, make_str("drop owned by"), $4, $5);
}
;
ReassignOwnedStmt:
REASSIGN OWNED BY name_list TO name
{
$$ = cat_str(4, make_str("reassign owned by"), $4, make_str("to"), $6);
}
;
/*****************************************************************************
*
* QUERY:
*
* DROP itemtype [ IF EXISTS ] itemname [, itemname ...] [ RESTRICT | CASCADE ]
*
*****************************************************************************/
DropStmt: DROP drop_type any_name_list opt_drop_behavior
DropStmt: DROP drop_type IF_P EXISTS any_name_list opt_drop_behavior
{ $$ = cat_str(5, make_str("drop"), $2, make_str("if exists"), $5, $6); }
| DROP drop_type any_name_list opt_drop_behavior
{ $$ = cat_str(4, make_str("drop"), $2, $3, $4); }
;
...
...
@@ -2818,13 +2845,15 @@ alterdb_opt_item:
/*****************************************************************************
*
* DROP DATABASE
* DROP DATABASE
[ IF EXISTS ]
*
*
*****************************************************************************/
DropdbStmt: DROP DATABASE database_name
{ $$ = cat2_str(make_str("drop database"), $3); }
| DROP DATABASE IF_P EXISTS database_name
{ $$ = cat2_str(make_str("drop database if exists"), $5); }
;
...
...
@@ -3806,6 +3835,8 @@ a_expr: c_expr
{ $$ = cat2_str($1, make_str("is not unknown")); }
| a_expr IS DISTINCT FROM a_expr %prec IS
{ $$ = cat_str(3, $1, make_str("is distinct from"), $5); }
| a_expr IS NOT DISTINCT FROM a_expr %prec IS
{ $$ = cat_str(3, $1, make_str("is not distinct from"), $6); }
| a_expr IS OF '(' type_list ')' %prec IS
{ $$ = cat_str(4, $1, make_str("is of ("), $5, make_str(")")); }
| a_expr IS NOT OF '(' type_list ')' %prec IS
...
...
@@ -3870,6 +3901,8 @@ b_expr: c_expr
{ $$ = cat2_str($1, $2); }
| b_expr IS DISTINCT FROM b_expr %prec IS
{ $$ = cat_str(3, $1, make_str("is distinct from"), $5); }
| b_expr IS NOT DISTINCT FROM b_expr %prec IS
{ $$ = cat_str(3, $1, make_str("is not distinct from"), $6); }
| b_expr IS OF '(' b_expr ')' %prec IS
{ $$ = cat_str(4, $1, make_str("is of ("), $5, make_str(")")); }
| b_expr IS NOT OF '(' b_expr ')' %prec IS
...
...
@@ -6111,6 +6144,7 @@ ECPGunreserved_con: ABORT_P { $$ = make_str("abort"); }
| HEADER_P { $$ = make_str("header"); }
| HOLD { $$ = make_str("hold"); }
/* | HOUR_P { $$ = make_str("hour"); }*/
| IF_P { $$ = make_str("if"); }
| IMMEDIATE { $$ = make_str("immediate"); }
| IMMUTABLE { $$ = make_str("immutable"); }
| IMPLICIT_P { $$ = make_str("implicit"); }
...
...
@@ -6159,6 +6193,7 @@ ECPGunreserved_con: ABORT_P { $$ = make_str("abort"); }
| OIDS { $$ = make_str("oids"); }
| OPERATOR { $$ = make_str("operator"); }
| OPTION { $$ = make_str("option"); }
| OWNED { $$ = make_str("owned"); }
| OWNER { $$ = make_str("owner"); }
| PARTIAL { $$ = make_str("partial"); }
| PASSWORD { $$ = make_str("password"); }
...
...
@@ -6171,6 +6206,7 @@ ECPGunreserved_con: ABORT_P { $$ = make_str("abort"); }
| PROCEDURE { $$ = make_str("procedure"); }
| QUOTE { $$ = make_str("quote"); }
| READ { $$ = make_str("read"); }
| REASSIGN { $$ = make_str("reassign"); }
| RECHECK { $$ = make_str("recheck"); }
| REINDEX { $$ = make_str("reindex"); }
| RELATIVE_P { $$ = make_str("relative"); }
...
...
This diff is collapsed.
Click to expand it.
src/interfaces/ecpg/test/Makefile
View file @
69f9fab1
# $PostgreSQL: pgsql/src/interfaces/ecpg/test/Makefile,v 1.5
0 2005/06/30 07:01:57 neilc
Exp $
# $PostgreSQL: pgsql/src/interfaces/ecpg/test/Makefile,v 1.5
1 2006/01/24 11:01:38 meskes
Exp $
subdir
=
src/interfaces/ecpg/test
top_builddir
=
../../../..
...
...
@@ -11,7 +11,7 @@ ECPG = ../preproc/ecpg -I$(srcdir)/../include
TESTS
=
test1 test2 test3 test4 test5 perftest dyntest dyntest2 test_notice
\
test_code100 test_init testdynalloc num_test dt_test test_informix
\
test_desc
test_
informix2 test_
desc
ifeq
($(enable_thread_safety), yes)
TESTS
+=
test_thread test_thread_implicit
endif
...
...
@@ -24,11 +24,17 @@ all: $(TESTS)
test_informix
:
test_informix.o
$(CC)
$(CFLAGS)
$(LDFLAGS)
-L
../compatlib
-L
../ecpglib
-L
../pgtypeslib
-L
../../libpq
$^
$(LIBS)
-lpgtypes
-lecpg
-lecpg_compat
-lpq
$(PTHREAD_LIBS)
-o
$@
test_informix2
:
test_informix2.o
$(CC)
$(CFLAGS)
$(LDFLAGS)
-L
../compatlib
-L
../ecpglib
-L
../pgtypeslib
-L
../../libpq
$^
$(LIBS)
-lpgtypes
-lecpg
-lecpg_compat
-lpq
$(PTHREAD_LIBS)
-o
$@
%.c
:
%.pgc
$(ECPG)
-o
$@
-I
$(srcdir)
$<
test_informix.c
:
test_informix.pgc
$(ECPG)
-o
$@
-C
INFORMIX
-r
no_indicator
$<
test_informix2.c
:
test_informix2.pgc
$(ECPG)
-o
$@
-C
INFORMIX
$<
clean
:
rm
-f
$(TESTS)
$(TESTS:%=%.o)
$(TESTS:%=%.c)
log
This diff is collapsed.
Click to expand it.
src/interfaces/ecpg/test/test_informix2.pgc
0 → 100644
View file @
69f9fab1
#include <stdio.h>
#include <stdlib.h>
#include "sqltypes.h"
EXEC SQL include sqlca.h;
/* Check SQLCODE, and produce a "standard error" if it's wrong! */
static void sql_check(char *fn, char *caller, int ignore)
{
char errorstring[255];
if (SQLCODE == ignore)
return;
else
{
if (SQLCODE != 0)
{
sprintf(errorstring, "**SQL error %ld doing '%s' in function '%s'. [%s]",
SQLCODE, caller, fn, sqlca.sqlerrm.sqlerrmc);
fprintf(stderr, "%s", errorstring);
printf("%s\n", errorstring);
/* attempt a ROLLBACK */
EXEC SQL rollback;
if (SQLCODE == 0)
{
sprintf(errorstring, "Rollback successful.\n");
} else {
sprintf(errorstring, "Rollback failed with code %ld.\n", SQLCODE);
}
fprintf(stderr, "%s", errorstring);
printf("%s\n", errorstring);
exit(1);
}
}
}
int main(void)
{
EXEC SQL BEGIN DECLARE SECTION;
int c;
timestamp d;
timestamp maxd;
char dbname[30];
EXEC SQL END DECLARE SECTION;
EXEC SQL whenever sqlerror sqlprint;
strcpy(dbname, "mm");
EXEC SQL connect to :dbname;
sql_check("main", "connect", 0);
EXEC SQL create table history (customerid integer, timestamp timestamp without time zone, action_taken char(5), narrative varchar(100));
sql_check("main", "create", 0);
EXEC SQL insert into history
(customerid, timestamp, action_taken, narrative)
values(1, now(), 'test', 'test');
sql_check("main", "insert", 0);
EXEC SQL select max(timestamp)
into :maxd
from history;
sql_check("main", "select max", 100);
if (risnull(CDTIMETYPE, (char *) &maxd))
{
printf("Nothing on the history table\n\n");
exit(0);
}
EXEC SQL select customerid, timestamp
into :c, :d
from history
where timestamp = :maxd
limit 1;
sql_check("main", "select", 0);
printf("Read in customer %d\n", c);
/* Adding 1 to d adds 1 second. So:
60 1 minute
3600 1 hour
86400 1 day */
d=d+86400;
c++;
EXEC SQL insert into history
(customerid, timestamp, action_taken, narrative)
values(:c, :d, 'test', 'test');
sql_check("main", "update", 0);
EXEC SQL commit;
EXEC SQL drop table history;
sql_check("main", "drop", 0);
EXEC SQL commit;
EXEC SQL disconnect;
sql_check("main", "disconnect", 0);
printf("All OK!\n");
exit(0);
/*
Table "public.history"
Column | Type | Modifiers
--------------+-----------------------------+-----------
customerid | integer | not null
timestamp | timestamp without time zone | not null
action_taken | character(5) | not null
narrative | character varying(100) |
*/
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment