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
423abf4d
Commit
423abf4d
authored
Feb 14, 2008
by
Michael Meskes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- EXECUTE can return NOT FOUND so it should be checked here too.
- Changed regression test accordingly.
parent
a3a648ec
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
110 additions
and
12 deletions
+110
-12
src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/ChangeLog
+2
-0
src/interfaces/ecpg/preproc/preproc.y
src/interfaces/ecpg/preproc/preproc.y
+2
-2
src/interfaces/ecpg/test/expected/sql-execute.c
src/interfaces/ecpg/test/expected/sql-execute.c
+60
-5
src/interfaces/ecpg/test/expected/sql-execute.stderr
src/interfaces/ecpg/test/expected/sql-execute.stderr
+23
-5
src/interfaces/ecpg/test/expected/sql-execute.stdout
src/interfaces/ecpg/test/expected/sql-execute.stdout
+1
-0
src/interfaces/ecpg/test/expected/thread-prep.c
src/interfaces/ecpg/test/expected/thread-prep.c
+3
-0
src/interfaces/ecpg/test/sql/execute.pgc
src/interfaces/ecpg/test/sql/execute.pgc
+19
-0
No files found.
src/interfaces/ecpg/ChangeLog
View file @
423abf4d
...
...
@@ -2310,4 +2310,6 @@ Wed, 06 Feb 2008 09:04:48 +0100
Thu, 14 Feb 2008 13:11:34 +0100
- Added SQLSTATE macro closing bug #3961.
- EXECUTE can return NOT FOUND so it should be checked here too.
- Changed regression test accordingly.
src/interfaces/ecpg/preproc/preproc.y
View file @
423abf4d
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.3
59 2008/01/15 10:31:47
meskes Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.3
60 2008/02/14 14:54:48
meskes Exp $ */
/* Copyright comment */
%{
...
...
@@ -807,7 +807,7 @@ stmt: AlterDatabaseStmt { output_statement($1, 0, ECPGst_normal); }
| DropUserStmt { output_statement($1, 0, ECPGst_normal); }
| DropdbStmt { output_statement($1, 0, ECPGst_normal); }
| ExplainStmt { output_statement($1, 0, ECPGst_normal); }
| ExecuteStmt { output_statement($1,
0
, ECPGst_execute); }
| ExecuteStmt { output_statement($1,
1
, ECPGst_execute); }
| FetchStmt { output_statement($1, 1, ECPGst_normal); }
| GrantStmt { output_statement($1, 0, ECPGst_normal); }
| GrantRoleStmt { output_statement($1, 0, ECPGst_normal); }
...
...
src/interfaces/ecpg/test/expected/sql-execute.c
View file @
423abf4d
...
...
@@ -254,23 +254,78 @@ if (sqlca.sqlcode < 0) sqlprint();}
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 88 "execute.pgc"
{
ECPGd
o
(
__LINE__
,
0
,
1
,
NULL
,
0
,
ECPGst_normal
,
"drop table test "
,
ECPGt_EOIT
,
ECPGt_EORT
);
{
ECPGd
eallocate
(
__LINE__
,
0
,
NULL
,
"f"
);
#line 89 "execute.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 89 "execute.pgc"
sprintf
(
command
,
"select * from test where amount = $1"
);
{
ECPGprepare
(
__LINE__
,
NULL
,
0
,
"f"
,
command
);
#line 93 "execute.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 93 "execute.pgc"
{
ECPGdo
(
__LINE__
,
0
,
1
,
NULL
,
0
,
1
,
"f"
,
ECPGt_const
,
"2"
,(
long
)
1
,(
long
)
1
,
strlen
(
"2"
),
ECPGt_NO_INDICATOR
,
NULL
,
0L
,
0L
,
0L
,
ECPGt_EOIT
,
ECPGt_char
,(
name
),(
long
)
8
,(
long
)
8
,(
8
)
*
sizeof
(
char
),
ECPGt_NO_INDICATOR
,
NULL
,
0L
,
0L
,
0L
,
ECPGt_int
,(
amount
),(
long
)
1
,(
long
)
8
,
sizeof
(
int
),
ECPGt_NO_INDICATOR
,
NULL
,
0L
,
0L
,
0L
,
ECPGt_char
,(
letter
),(
long
)
1
,(
long
)
8
,(
1
)
*
sizeof
(
char
),
ECPGt_NO_INDICATOR
,
NULL
,
0L
,
0L
,
0L
,
ECPGt_EORT
);
#line 94 "execute.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 94 "execute.pgc"
for
(
i
=
0
,
j
=
sqlca
.
sqlerrd
[
2
];
i
<
j
;
i
++
)
{
/* exec sql begin declare section */
#line 99 "execute.pgc"
char
n
[
8
]
,
l
=
letter
[
i
]
[
0
]
;
#line 100 "execute.pgc"
int
a
=
amount
[
i
]
;
/* exec sql end declare section */
#line 101 "execute.pgc"
strncpy
(
n
,
name
[
i
],
8
);
printf
(
"name[%d]=%8.8s
\t
amount[%d]=%d
\t
letter[%d]=%c
\n
"
,
i
,
n
,
i
,
a
,
i
,
l
);
}
{
ECPGdeallocate
(
__LINE__
,
0
,
NULL
,
"f"
);
#line 107 "execute.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 107 "execute.pgc"
{
ECPGdo
(
__LINE__
,
0
,
1
,
NULL
,
0
,
ECPGst_normal
,
"drop table test "
,
ECPGt_EOIT
,
ECPGt_EORT
);
#line 108 "execute.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 108 "execute.pgc"
{
ECPGtrans
(
__LINE__
,
NULL
,
"commit"
);
#line
90
"execute.pgc"
#line
109
"execute.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line
90
"execute.pgc"
#line
109
"execute.pgc"
{
ECPGdisconnect
(
__LINE__
,
"CURRENT"
);
#line
91
"execute.pgc"
#line
110
"execute.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line
91
"execute.pgc"
#line
110
"execute.pgc"
return
(
0
);
...
...
src/interfaces/ecpg/test/expected/sql-execute.stderr
View file @
423abf4d
...
...
@@ -138,15 +138,33 @@
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute line 88 Ok: CLOSE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]:
ecpg_execute line 89: QUERY: drop table test with 0 parameter on connection main
[NO_PID]:
ECPGdeallocate line 89: NAME: f
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]:
ecpg_execute line 89: using PQexec
[NO_PID]:
ECPGprepare line 93: NAME: f QUERY: select * from test where amount = $1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute line
89 Ok: DROP TABLE
[NO_PID]: ecpg_execute line
94: QUERY: select * from test where amount = $1 with 1 parameter on connection main
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]:
ECPGtrans line 90 action = commit connection = main
[NO_PID]:
ecpg_execute line 94: using PQexecPrepared for select * from test where amount = $1
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGdeallocate line 0: NAME: f
[NO_PID]: free_params line 94: parameter 1 = 2
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute line 94: Correctly got 1 tuples with 3 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data line 94: RESULT: db: 'r1' offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data line 94: RESULT: 2 offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data line 94: RESULT: t offset: -1 array: Yes
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGdeallocate line 107: NAME: f
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute line 108: QUERY: drop table test with 0 parameter on connection main
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute line 108: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute line 108 Ok: DROP TABLE
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans line 109 action = commit connection = main
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGdeallocate line 0: NAME: i
[NO_PID]: sqlca: code: 0, state: 00000
...
...
src/interfaces/ecpg/test/expected/sql-execute.stdout
View file @
423abf4d
...
...
@@ -9,3 +9,4 @@ name[5]=db: 'r1' amount[5]=102 letter[5]=t
name[6]=db: 'r1' amount[6]=111 letter[6]=f
name[7]=db: 'r1' amount[7]=112 letter[7]=t
name[0]=db: 'r1' amount[0]=1 letter[0]=f
name[0]=db: 'r1' amount[0]=2 letter[0]=t
src/interfaces/ecpg/test/expected/thread-prep.c
View file @
423abf4d
...
...
@@ -173,6 +173,9 @@ if (sqlca.sqlcode < 0) sqlprint();}
ECPGt_NO_INDICATOR
,
NULL
,
0L
,
0L
,
0L
,
ECPGt_EOIT
,
ECPGt_EORT
);
#line 52 "prep.pgc"
if
(
sqlca
.
sqlcode
==
ECPG_NOT_FOUND
)
sqlprint
();
#line 52 "prep.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 52 "prep.pgc"
...
...
src/interfaces/ecpg/test/sql/execute.pgc
View file @
423abf4d
...
...
@@ -86,6 +86,25 @@ exec sql end declare section;
}
exec sql close CUR2;
exec sql deallocate f;
sprintf (command, "select * from test where amount = $1");
exec sql prepare f from :command;
exec sql execute f using 2 into :name, :amount, :letter;
for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
{
exec sql begin declare section;
char n[8], l = letter[i][0];
int a = amount[i];
exec sql end declare section;
strncpy(n, name[i], 8);
printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, n, i, a, i, l);
}
exec sql deallocate f;
exec sql drop table test;
exec sql commit;
exec sql disconnect;
...
...
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