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
858dc6dc
Commit
858dc6dc
authored
Jan 06, 2010
by
Michael Meskes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed more inttypes.h stuff.
parent
ee0b6024
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
390 additions
and
412 deletions
+390
-412
src/interfaces/ecpg/test/compat_informix/sqlda.pgc
src/interfaces/ecpg/test/compat_informix/sqlda.pgc
+1
-4
src/interfaces/ecpg/test/expected/compat_informix-sqlda.c
src/interfaces/ecpg/test/expected/compat_informix-sqlda.c
+68
-71
src/interfaces/ecpg/test/expected/compat_informix-sqlda.stderr
...nterfaces/ecpg/test/expected/compat_informix-sqlda.stderr
+137
-137
src/interfaces/ecpg/test/expected/sql-sqlda.c
src/interfaces/ecpg/test/expected/sql-sqlda.c
+68
-76
src/interfaces/ecpg/test/expected/sql-sqlda.stderr
src/interfaces/ecpg/test/expected/sql-sqlda.stderr
+116
-116
src/interfaces/ecpg/test/sql/sqlda.pgc
src/interfaces/ecpg/test/sql/sqlda.pgc
+0
-8
No files found.
src/interfaces/ecpg/test/compat_informix/sqlda.pgc
View file @
858dc6dc
#include <stdlib.h>
#include <string.h>
#include <
inttype
s.h>
#include <
limit
s.h>
exec sql include ../regression;
...
...
@@ -36,9 +36,6 @@ dump_sqlda(sqlda_t *sqlda)
case SQLINT:
printf("name sqlda descriptor: '%s' value %d\n", sqlda->sqlvar[i].sqlname, *(int *)sqlda->sqlvar[i].sqldata);
break;
case SQLINT8:
printf("name sqlda descriptor: '%s' value %" PRId64 "\n", sqlda->sqlvar[i].sqlname, *(int64_t *)sqlda->sqlvar[i].sqldata);
break;
case SQLFLOAT:
printf("name sqlda descriptor: '%s' value %lf\n", sqlda->sqlvar[i].sqlname, *(double *)sqlda->sqlvar[i].sqldata);
break;
...
...
src/interfaces/ecpg/test/expected/compat_informix-sqlda.c
View file @
858dc6dc
...
...
@@ -11,7 +11,7 @@
#line 1 "sqlda.pgc"
#include <stdlib.h>
#include <string.h>
#include <
inttype
s.h>
#include <
limit
s.h>
#line 1 "regression.h"
...
...
@@ -141,9 +141,6 @@ dump_sqlda(sqlda_t *sqlda)
case
SQLINT
:
printf
(
"name sqlda descriptor: '%s' value %d
\n
"
,
sqlda
->
sqlvar
[
i
].
sqlname
,
*
(
int
*
)
sqlda
->
sqlvar
[
i
].
sqldata
);
break
;
case
SQLINT8
:
printf
(
"name sqlda descriptor: '%s' value %"
PRId64
"
\n
"
,
sqlda
->
sqlvar
[
i
].
sqlname
,
*
(
int64_t
*
)
sqlda
->
sqlvar
[
i
].
sqldata
);
break
;
case
SQLFLOAT
:
printf
(
"name sqlda descriptor: '%s' value %lf
\n
"
,
sqlda
->
sqlvar
[
i
].
sqlname
,
*
(
double
*
)
sqlda
->
sqlvar
[
i
].
sqldata
);
break
;
...
...
@@ -167,19 +164,19 @@ main (void)
#line
60
"sqlda.pgc"
#line
57
"sqlda.pgc"
char
*
stmt1
=
"SELECT * FROM t1"
;
#line
61
"sqlda.pgc"
#line
58
"sqlda.pgc"
char
*
stmt2
=
"SELECT * FROM t1 WHERE id = ?"
;
#line
62
"sqlda.pgc"
#line
59
"sqlda.pgc"
int
rec
;
#line 6
3
"sqlda.pgc"
#line 6
0
"sqlda.pgc"
int
id
;
/* exec sql end declare section */
#line 6
4
"sqlda.pgc"
#line 6
1
"sqlda.pgc"
char
msg
[
128
];
...
...
@@ -188,42 +185,42 @@ main (void)
strcpy
(
msg
,
"connect"
);
{
ECPGconnect
(
__LINE__
,
1
,
"regress1"
,
NULL
,
NULL
,
"regress1"
,
0
);
#line
71
"sqlda.pgc"
#line
68
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line
71
"sqlda.pgc"
#line
68
"sqlda.pgc"
strcpy
(
msg
,
"set"
);
{
ECPGdo
(
__LINE__
,
1
,
1
,
NULL
,
0
,
ECPGst_normal
,
"set datestyle to iso"
,
ECPGt_EOIT
,
ECPGt_EORT
);
#line 7
4
"sqlda.pgc"
#line 7
1
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 7
4
"sqlda.pgc"
#line 7
1
"sqlda.pgc"
strcpy
(
msg
,
"create"
);
{
ECPGdo
(
__LINE__
,
1
,
1
,
NULL
,
0
,
ECPGst_normal
,
"create table t1 ( id integer , t text , d1 numeric , d2 float8 , c char ( 10 ) )"
,
ECPGt_EOIT
,
ECPGt_EORT
);
#line
82
"sqlda.pgc"
#line
79
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line
82
"sqlda.pgc"
#line
79
"sqlda.pgc"
strcpy
(
msg
,
"insert"
);
{
ECPGdo
(
__LINE__
,
1
,
1
,
NULL
,
0
,
ECPGst_normal
,
"insert into t1 values ( 1 , 'a' , 1.0 , 1 , 'a' ) , ( 2 , null , null , null , null ) , ( 3 , '
\"
c
\"
' , - 3 , 'nan' :: float8 , 'c' ) , ( 4 , 'd' , 4.0 , 4 , 'd' )"
,
ECPGt_EOIT
,
ECPGt_EORT
);
#line 8
9
"sqlda.pgc"
#line 8
6
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 8
9
"sqlda.pgc"
#line 8
6
"sqlda.pgc"
strcpy
(
msg
,
"commit"
);
{
ECPGtrans
(
__LINE__
,
NULL
,
"commit"
);
#line
92
"sqlda.pgc"
#line
89
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line
92
"sqlda.pgc"
#line
89
"sqlda.pgc"
/* SQLDA test for getting all records from a table */
...
...
@@ -232,29 +229,29 @@ if (sqlca.sqlcode < 0) exit (1);}
strcpy
(
msg
,
"prepare"
);
{
ECPGprepare
(
__LINE__
,
NULL
,
0
,
"st_id1"
,
stmt1
);
#line 9
9
"sqlda.pgc"
#line 9
6
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 9
9
"sqlda.pgc"
#line 9
6
"sqlda.pgc"
strcpy
(
msg
,
"declare"
);
ECPG_informix_reset_sqlca
();
/* declare mycur1 cursor for $1 */
#line
102
"sqlda.pgc"
#line
99
"sqlda.pgc"
strcpy
(
msg
,
"open"
);
{
ECPGdo
(
__LINE__
,
1
,
1
,
NULL
,
0
,
ECPGst_normal
,
"declare mycur1 cursor for $1"
,
ECPGt_char_variable
,(
ECPGprepared_statement
(
NULL
,
"st_id1"
,
__LINE__
)),(
long
)
1
,(
long
)
1
,(
1
)
*
sizeof
(
char
),
ECPGt_NO_INDICATOR
,
NULL
,
0L
,
0L
,
0L
,
ECPGt_EOIT
,
ECPGt_EORT
);
#line 10
5
"sqlda.pgc"
#line 10
2
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 10
5
"sqlda.pgc"
#line 10
2
"sqlda.pgc"
/* exec sql whenever not found break ; */
#line 10
7
"sqlda.pgc"
#line 10
4
"sqlda.pgc"
rec
=
0
;
...
...
@@ -264,13 +261,13 @@ if (sqlca.sqlcode < 0) exit (1);}
{
ECPGdo
(
__LINE__
,
1
,
1
,
NULL
,
0
,
ECPGst_normal
,
"fetch 1 from mycur1"
,
ECPGt_EOIT
,
ECPGt_sqlda
,
&
outp_sqlda
,
0L
,
0L
,
0L
,
ECPGt_NO_INDICATOR
,
NULL
,
0L
,
0L
,
0L
,
ECPGt_EORT
);
#line 11
3
"sqlda.pgc"
#line 11
0
"sqlda.pgc"
if
(
sqlca
.
sqlcode
==
ECPG_NOT_FOUND
)
break
;
#line 11
3
"sqlda.pgc"
#line 11
0
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 11
3
"sqlda.pgc"
#line 11
0
"sqlda.pgc"
printf
(
"FETCH RECORD %d
\n
"
,
++
rec
);
...
...
@@ -278,23 +275,23 @@ if (sqlca.sqlcode < 0) exit (1);}
}
/* exec sql whenever not found continue ; */
#line 11
9
"sqlda.pgc"
#line 11
6
"sqlda.pgc"
strcpy
(
msg
,
"close"
);
{
ECPGdo
(
__LINE__
,
1
,
1
,
NULL
,
0
,
ECPGst_normal
,
"close mycur1"
,
ECPGt_EOIT
,
ECPGt_EORT
);
#line 1
22
"sqlda.pgc"
#line 1
19
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 1
22
"sqlda.pgc"
#line 1
19
"sqlda.pgc"
strcpy
(
msg
,
"deallocate"
);
{
ECPGdeallocate
(
__LINE__
,
1
,
NULL
,
"st_id1"
);
#line 12
5
"sqlda.pgc"
#line 12
2
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 12
5
"sqlda.pgc"
#line 12
2
"sqlda.pgc"
free
(
outp_sqlda
);
...
...
@@ -307,29 +304,29 @@ if (sqlca.sqlcode < 0) exit (1);}
strcpy
(
msg
,
"prepare"
);
{
ECPGprepare
(
__LINE__
,
NULL
,
0
,
"st_id2"
,
stmt1
);
#line 13
6
"sqlda.pgc"
#line 13
3
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 13
6
"sqlda.pgc"
#line 13
3
"sqlda.pgc"
strcpy
(
msg
,
"declare"
);
ECPG_informix_reset_sqlca
();
/* declare mycur2 cursor for $1 */
#line 13
9
"sqlda.pgc"
#line 13
6
"sqlda.pgc"
strcpy
(
msg
,
"open"
);
{
ECPGdo
(
__LINE__
,
1
,
1
,
NULL
,
0
,
ECPGst_normal
,
"declare mycur2 cursor for $1"
,
ECPGt_char_variable
,(
ECPGprepared_statement
(
NULL
,
"st_id2"
,
__LINE__
)),(
long
)
1
,(
long
)
1
,(
1
)
*
sizeof
(
char
),
ECPGt_NO_INDICATOR
,
NULL
,
0L
,
0L
,
0L
,
ECPGt_EOIT
,
ECPGt_EORT
);
#line 1
42
"sqlda.pgc"
#line 1
39
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 1
42
"sqlda.pgc"
#line 1
39
"sqlda.pgc"
/* exec sql whenever not found break ; */
#line 14
4
"sqlda.pgc"
#line 14
1
"sqlda.pgc"
rec
=
0
;
...
...
@@ -339,13 +336,13 @@ if (sqlca.sqlcode < 0) exit (1);}
{
ECPGdo
(
__LINE__
,
1
,
1
,
NULL
,
0
,
ECPGst_normal
,
"fetch from mycur2"
,
ECPGt_EOIT
,
ECPGt_sqlda
,
&
outp_sqlda
,
0L
,
0L
,
0L
,
ECPGt_NO_INDICATOR
,
NULL
,
0L
,
0L
,
0L
,
ECPGt_EORT
);
#line 1
50
"sqlda.pgc"
#line 1
47
"sqlda.pgc"
if
(
sqlca
.
sqlcode
==
ECPG_NOT_FOUND
)
break
;
#line 1
50
"sqlda.pgc"
#line 1
47
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 1
50
"sqlda.pgc"
#line 1
47
"sqlda.pgc"
printf
(
"FETCH RECORD %d
\n
"
,
++
rec
);
...
...
@@ -353,23 +350,23 @@ if (sqlca.sqlcode < 0) exit (1);}
}
/* exec sql whenever not found continue ; */
#line 15
6
"sqlda.pgc"
#line 15
3
"sqlda.pgc"
strcpy
(
msg
,
"close"
);
{
ECPGdo
(
__LINE__
,
1
,
1
,
NULL
,
0
,
ECPGst_normal
,
"close mycur2"
,
ECPGt_EOIT
,
ECPGt_EORT
);
#line 15
9
"sqlda.pgc"
#line 15
6
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 15
9
"sqlda.pgc"
#line 15
6
"sqlda.pgc"
strcpy
(
msg
,
"deallocate"
);
{
ECPGdeallocate
(
__LINE__
,
1
,
NULL
,
"st_id2"
);
#line 1
62
"sqlda.pgc"
#line 1
59
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 1
62
"sqlda.pgc"
#line 1
59
"sqlda.pgc"
free
(
outp_sqlda
);
...
...
@@ -394,10 +391,10 @@ if (sqlca.sqlcode < 0) exit (1);}
strcpy
(
msg
,
"prepare"
);
{
ECPGprepare
(
__LINE__
,
NULL
,
0
,
"st_id3"
,
stmt2
);
#line 18
5
"sqlda.pgc"
#line 18
2
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 18
5
"sqlda.pgc"
#line 18
2
"sqlda.pgc"
strcpy
(
msg
,
"execute"
);
...
...
@@ -406,20 +403,20 @@ if (sqlca.sqlcode < 0) exit (1);}
ECPGt_NO_INDICATOR
,
NULL
,
0L
,
0L
,
0L
,
ECPGt_EOIT
,
ECPGt_sqlda
,
&
outp_sqlda
,
0L
,
0L
,
0L
,
ECPGt_NO_INDICATOR
,
NULL
,
0L
,
0L
,
0L
,
ECPGt_EORT
);
#line 18
8
"sqlda.pgc"
#line 18
5
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 18
8
"sqlda.pgc"
#line 18
5
"sqlda.pgc"
dump_sqlda
(
outp_sqlda
);
strcpy
(
msg
,
"deallocate"
);
{
ECPGdeallocate
(
__LINE__
,
1
,
NULL
,
"st_id3"
);
#line 19
3
"sqlda.pgc"
#line 19
0
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 19
3
"sqlda.pgc"
#line 19
0
"sqlda.pgc"
free
(
inp_sqlda
->
sqlvar
);
...
...
@@ -431,10 +428,10 @@ if (sqlca.sqlcode < 0) exit (1);}
*/
{
ECPGconnect
(
__LINE__
,
1
,
"regress1"
,
NULL
,
NULL
,
"con2"
,
0
);
#line 20
3
"sqlda.pgc"
#line 20
0
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 20
3
"sqlda.pgc"
#line 20
0
"sqlda.pgc"
/* Input sqlda has to be built manually */
...
...
@@ -455,10 +452,10 @@ if (sqlca.sqlcode < 0) exit (1);}
strcpy
(
msg
,
"prepare"
);
{
ECPGprepare
(
__LINE__
,
"con2"
,
0
,
"st_id4"
,
stmt2
);
#line 2
22
"sqlda.pgc"
#line 2
19
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 2
22
"sqlda.pgc"
#line 2
19
"sqlda.pgc"
strcpy
(
msg
,
"execute"
);
...
...
@@ -467,28 +464,28 @@ if (sqlca.sqlcode < 0) exit (1);}
ECPGt_NO_INDICATOR
,
NULL
,
0L
,
0L
,
0L
,
ECPGt_EOIT
,
ECPGt_sqlda
,
&
outp_sqlda
,
0L
,
0L
,
0L
,
ECPGt_NO_INDICATOR
,
NULL
,
0L
,
0L
,
0L
,
ECPGt_EORT
);
#line 22
5
"sqlda.pgc"
#line 22
2
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 22
5
"sqlda.pgc"
#line 22
2
"sqlda.pgc"
dump_sqlda
(
outp_sqlda
);
strcpy
(
msg
,
"commit"
);
{
ECPGtrans
(
__LINE__
,
"con2"
,
"commit"
);
#line 2
30
"sqlda.pgc"
#line 2
27
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 2
30
"sqlda.pgc"
#line 2
27
"sqlda.pgc"
strcpy
(
msg
,
"deallocate"
);
{
ECPGdeallocate
(
__LINE__
,
1
,
NULL
,
"st_id4"
);
#line 23
3
"sqlda.pgc"
#line 23
0
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 23
3
"sqlda.pgc"
#line 23
0
"sqlda.pgc"
free
(
inp_sqlda
->
sqlvar
);
...
...
@@ -497,36 +494,36 @@ if (sqlca.sqlcode < 0) exit (1);}
strcpy
(
msg
,
"disconnect"
);
{
ECPGdisconnect
(
__LINE__
,
"con2"
);
#line 2
40
"sqlda.pgc"
#line 2
37
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 2
40
"sqlda.pgc"
#line 2
37
"sqlda.pgc"
/* End test */
strcpy
(
msg
,
"drop"
);
{
ECPGdo
(
__LINE__
,
1
,
1
,
NULL
,
0
,
ECPGst_normal
,
"drop table t1"
,
ECPGt_EOIT
,
ECPGt_EORT
);
#line 24
5
"sqlda.pgc"
#line 24
2
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 24
5
"sqlda.pgc"
#line 24
2
"sqlda.pgc"
strcpy
(
msg
,
"commit"
);
{
ECPGtrans
(
__LINE__
,
NULL
,
"commit"
);
#line 24
8
"sqlda.pgc"
#line 24
5
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 24
8
"sqlda.pgc"
#line 24
5
"sqlda.pgc"
strcpy
(
msg
,
"disconnect"
);
{
ECPGdisconnect
(
__LINE__
,
"CURRENT"
);
#line 2
51
"sqlda.pgc"
#line 2
48
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 2
51
"sqlda.pgc"
#line 2
48
"sqlda.pgc"
return
(
0
);
...
...
src/interfaces/ecpg/test/expected/compat_informix-sqlda.stderr
View file @
858dc6dc
This diff is collapsed.
Click to expand it.
src/interfaces/ecpg/test/expected/sql-sqlda.c
View file @
858dc6dc
...
...
@@ -9,7 +9,6 @@
#line 1 "sqlda.pgc"
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include <limits.h>
...
...
@@ -20,7 +19,7 @@
#line
6
"sqlda.pgc"
#line
5
"sqlda.pgc"
...
...
@@ -44,7 +43,7 @@ typedef struct sqlda_struct sqlda_t;
#endif
/* ECPG_SQLDA_H */
#line
8
"sqlda.pgc"
#line
7
"sqlda.pgc"
#line 1 "pgtypes_numeric.h"
...
...
@@ -115,11 +114,11 @@ int PGTYPESnumeric_from_decimal(decimal *, numeric *);
#endif
/* PGTYPES_NUMERIC */
#line
9
"sqlda.pgc"
#line
8
"sqlda.pgc"
/* exec sql whenever sqlerror stop ; */
#line 1
1
"sqlda.pgc"
#line 1
0
"sqlda.pgc"
/* These shouldn't be under DECLARE SECTION */
...
...
@@ -149,13 +148,6 @@ dump_sqlda(sqlda_t *sqlda)
case
ECPGt_int
:
printf
(
"name sqlda descriptor: '%s' value %d
\n
"
,
sqlda
->
sqlvar
[
i
].
sqlname
.
data
,
*
(
int
*
)
sqlda
->
sqlvar
[
i
].
sqldata
);
break
;
#ifdef HAVE_LONG_LONG_INT_64
case
ECPGt_long_long
:
#else
case
ECPGt_long
:
#endif
printf
(
"name sqlda descriptor: '%s' value "
INT64_FORMAT
"
\n
"
,
sqlda
->
sqlvar
[
i
].
sqlname
.
data
,
*
(
int64_t
*
)
sqlda
->
sqlvar
[
i
].
sqldata
);
break
;
case
ECPGt_double
:
printf
(
"name sqlda descriptor: '%s' value %lf
\n
"
,
sqlda
->
sqlvar
[
i
].
sqlname
.
data
,
*
(
double
*
)
sqlda
->
sqlvar
[
i
].
sqldata
);
break
;
...
...
@@ -181,19 +173,19 @@ main (void)
#line
67
"sqlda.pgc"
#line
59
"sqlda.pgc"
char
*
stmt1
=
"SELECT * FROM t1"
;
#line 6
8
"sqlda.pgc"
#line 6
0
"sqlda.pgc"
char
*
stmt2
=
"SELECT * FROM t1 WHERE id = ?"
;
#line 6
9
"sqlda.pgc"
#line 6
1
"sqlda.pgc"
int
rec
;
#line
70
"sqlda.pgc"
#line
62
"sqlda.pgc"
int
id
;
/* exec sql end declare section */
#line
71
"sqlda.pgc"
#line
63
"sqlda.pgc"
char
msg
[
128
];
...
...
@@ -202,42 +194,42 @@ main (void)
strcpy
(
msg
,
"connect"
);
{
ECPGconnect
(
__LINE__
,
0
,
"regress1"
,
NULL
,
NULL
,
"regress1"
,
0
);
#line 7
8
"sqlda.pgc"
#line 7
0
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 7
8
"sqlda.pgc"
#line 7
0
"sqlda.pgc"
strcpy
(
msg
,
"set"
);
{
ECPGdo
(
__LINE__
,
0
,
1
,
NULL
,
0
,
ECPGst_normal
,
"set datestyle to iso"
,
ECPGt_EOIT
,
ECPGt_EORT
);
#line
81
"sqlda.pgc"
#line
73
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line
81
"sqlda.pgc"
#line
73
"sqlda.pgc"
strcpy
(
msg
,
"create"
);
{
ECPGdo
(
__LINE__
,
0
,
1
,
NULL
,
0
,
ECPGst_normal
,
"create table t1 ( id integer , t text , d1 numeric , d2 float8 , c char ( 10 ) )"
,
ECPGt_EOIT
,
ECPGt_EORT
);
#line 8
9
"sqlda.pgc"
#line 8
1
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 8
9
"sqlda.pgc"
#line 8
1
"sqlda.pgc"
strcpy
(
msg
,
"insert"
);
{
ECPGdo
(
__LINE__
,
0
,
1
,
NULL
,
0
,
ECPGst_normal
,
"insert into t1 values ( 1 , 'a' , 1.0 , 1 , 'a' ) , ( 2 , null , null , null , null ) , ( 3 , '
\"
c
\"
' , - 3 , 'nan' :: float8 , 'c' ) , ( 4 , 'd' , 4.0 , 4 , 'd' )"
,
ECPGt_EOIT
,
ECPGt_EORT
);
#line
96
"sqlda.pgc"
#line
88
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line
96
"sqlda.pgc"
#line
88
"sqlda.pgc"
strcpy
(
msg
,
"commit"
);
{
ECPGtrans
(
__LINE__
,
NULL
,
"commit"
);
#line 9
9
"sqlda.pgc"
#line 9
1
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 9
9
"sqlda.pgc"
#line 9
1
"sqlda.pgc"
/* SQLDA test for getting all records from a table */
...
...
@@ -246,29 +238,29 @@ if (sqlca.sqlcode < 0) exit (1);}
strcpy
(
msg
,
"prepare"
);
{
ECPGprepare
(
__LINE__
,
NULL
,
0
,
"st_id1"
,
stmt1
);
#line
106
"sqlda.pgc"
#line
98
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line
106
"sqlda.pgc"
#line
98
"sqlda.pgc"
strcpy
(
msg
,
"declare"
);
/* declare mycur1 cursor for $1 */
#line 10
9
"sqlda.pgc"
#line 10
1
"sqlda.pgc"
strcpy
(
msg
,
"open"
);
{
ECPGdo
(
__LINE__
,
0
,
1
,
NULL
,
0
,
ECPGst_normal
,
"declare mycur1 cursor for $1"
,
ECPGt_char_variable
,(
ECPGprepared_statement
(
NULL
,
"st_id1"
,
__LINE__
)),(
long
)
1
,(
long
)
1
,(
1
)
*
sizeof
(
char
),
ECPGt_NO_INDICATOR
,
NULL
,
0L
,
0L
,
0L
,
ECPGt_EOIT
,
ECPGt_EORT
);
#line 1
12
"sqlda.pgc"
#line 1
04
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 1
12
"sqlda.pgc"
#line 1
04
"sqlda.pgc"
/* exec sql whenever not found break ; */
#line 1
14
"sqlda.pgc"
#line 1
06
"sqlda.pgc"
rec
=
0
;
...
...
@@ -278,13 +270,13 @@ if (sqlca.sqlcode < 0) exit (1);}
{
ECPGdo
(
__LINE__
,
0
,
1
,
NULL
,
0
,
ECPGst_normal
,
"fetch 1 from mycur1"
,
ECPGt_EOIT
,
ECPGt_sqlda
,
&
outp_sqlda
,
0L
,
0L
,
0L
,
ECPGt_NO_INDICATOR
,
NULL
,
0L
,
0L
,
0L
,
ECPGt_EORT
);
#line 1
20
"sqlda.pgc"
#line 1
12
"sqlda.pgc"
if
(
sqlca
.
sqlcode
==
ECPG_NOT_FOUND
)
break
;
#line 1
20
"sqlda.pgc"
#line 1
12
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 1
20
"sqlda.pgc"
#line 1
12
"sqlda.pgc"
printf
(
"FETCH RECORD %d
\n
"
,
++
rec
);
...
...
@@ -292,23 +284,23 @@ if (sqlca.sqlcode < 0) exit (1);}
}
/* exec sql whenever not found continue ; */
#line 1
26
"sqlda.pgc"
#line 1
18
"sqlda.pgc"
strcpy
(
msg
,
"close"
);
{
ECPGdo
(
__LINE__
,
0
,
1
,
NULL
,
0
,
ECPGst_normal
,
"close mycur1"
,
ECPGt_EOIT
,
ECPGt_EORT
);
#line 12
9
"sqlda.pgc"
#line 12
1
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 12
9
"sqlda.pgc"
#line 12
1
"sqlda.pgc"
strcpy
(
msg
,
"deallocate"
);
{
ECPGdeallocate
(
__LINE__
,
0
,
NULL
,
"st_id1"
);
#line 1
32
"sqlda.pgc"
#line 1
24
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 1
32
"sqlda.pgc"
#line 1
24
"sqlda.pgc"
free
(
outp_sqlda
);
...
...
@@ -319,35 +311,35 @@ if (sqlca.sqlcode < 0) exit (1);}
strcpy
(
msg
,
"prepare"
);
{
ECPGprepare
(
__LINE__
,
NULL
,
0
,
"st_id2"
,
stmt1
);
#line 1
41
"sqlda.pgc"
#line 1
33
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 1
41
"sqlda.pgc"
#line 1
33
"sqlda.pgc"
strcpy
(
msg
,
"declare"
);
/* declare mycur2 cursor for $1 */
#line 1
44
"sqlda.pgc"
#line 1
36
"sqlda.pgc"
strcpy
(
msg
,
"open"
);
{
ECPGdo
(
__LINE__
,
0
,
1
,
NULL
,
0
,
ECPGst_normal
,
"declare mycur2 cursor for $1"
,
ECPGt_char_variable
,(
ECPGprepared_statement
(
NULL
,
"st_id2"
,
__LINE__
)),(
long
)
1
,(
long
)
1
,(
1
)
*
sizeof
(
char
),
ECPGt_NO_INDICATOR
,
NULL
,
0L
,
0L
,
0L
,
ECPGt_EOIT
,
ECPGt_EORT
);
#line 1
47
"sqlda.pgc"
#line 1
39
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 1
47
"sqlda.pgc"
#line 1
39
"sqlda.pgc"
strcpy
(
msg
,
"fetch"
);
{
ECPGdo
(
__LINE__
,
0
,
1
,
NULL
,
0
,
ECPGst_normal
,
"fetch all from mycur2"
,
ECPGt_EOIT
,
ECPGt_sqlda
,
&
outp_sqlda
,
0L
,
0L
,
0L
,
ECPGt_NO_INDICATOR
,
NULL
,
0L
,
0L
,
0L
,
ECPGt_EORT
);
#line 1
50
"sqlda.pgc"
#line 1
42
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 1
50
"sqlda.pgc"
#line 1
42
"sqlda.pgc"
outp_sqlda1
=
outp_sqlda
;
...
...
@@ -365,18 +357,18 @@ if (sqlca.sqlcode < 0) exit (1);}
strcpy
(
msg
,
"close"
);
{
ECPGdo
(
__LINE__
,
0
,
1
,
NULL
,
0
,
ECPGst_normal
,
"close mycur2"
,
ECPGt_EOIT
,
ECPGt_EORT
);
#line 1
66
"sqlda.pgc"
#line 1
58
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 1
66
"sqlda.pgc"
#line 1
58
"sqlda.pgc"
strcpy
(
msg
,
"deallocate"
);
{
ECPGdeallocate
(
__LINE__
,
0
,
NULL
,
"st_id2"
);
#line 16
9
"sqlda.pgc"
#line 16
1
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 16
9
"sqlda.pgc"
#line 16
1
"sqlda.pgc"
/* SQLDA test for getting one record using an input descriptor */
...
...
@@ -400,10 +392,10 @@ if (sqlca.sqlcode < 0) exit (1);}
strcpy
(
msg
,
"prepare"
);
{
ECPGprepare
(
__LINE__
,
NULL
,
0
,
"st_id3"
,
stmt2
);
#line 1
91
"sqlda.pgc"
#line 1
83
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 1
91
"sqlda.pgc"
#line 1
83
"sqlda.pgc"
strcpy
(
msg
,
"execute"
);
...
...
@@ -412,20 +404,20 @@ if (sqlca.sqlcode < 0) exit (1);}
ECPGt_NO_INDICATOR
,
NULL
,
0L
,
0L
,
0L
,
ECPGt_EOIT
,
ECPGt_sqlda
,
&
outp_sqlda
,
0L
,
0L
,
0L
,
ECPGt_NO_INDICATOR
,
NULL
,
0L
,
0L
,
0L
,
ECPGt_EORT
);
#line 1
94
"sqlda.pgc"
#line 1
86
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 1
94
"sqlda.pgc"
#line 1
86
"sqlda.pgc"
dump_sqlda
(
outp_sqlda
);
strcpy
(
msg
,
"deallocate"
);
{
ECPGdeallocate
(
__LINE__
,
0
,
NULL
,
"st_id3"
);
#line 19
9
"sqlda.pgc"
#line 19
1
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 19
9
"sqlda.pgc"
#line 19
1
"sqlda.pgc"
free
(
inp_sqlda
);
...
...
@@ -436,10 +428,10 @@ if (sqlca.sqlcode < 0) exit (1);}
*/
{
ECPGconnect
(
__LINE__
,
0
,
"regress1"
,
NULL
,
NULL
,
"con2"
,
0
);
#line 20
8
"sqlda.pgc"
#line 20
0
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 20
8
"sqlda.pgc"
#line 20
0
"sqlda.pgc"
/*
...
...
@@ -461,10 +453,10 @@ if (sqlca.sqlcode < 0) exit (1);}
strcpy
(
msg
,
"prepare"
);
{
ECPGprepare
(
__LINE__
,
"con2"
,
0
,
"st_id4"
,
stmt2
);
#line 22
8
"sqlda.pgc"
#line 22
0
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 22
8
"sqlda.pgc"
#line 22
0
"sqlda.pgc"
strcpy
(
msg
,
"execute"
);
...
...
@@ -473,28 +465,28 @@ if (sqlca.sqlcode < 0) exit (1);}
ECPGt_NO_INDICATOR
,
NULL
,
0L
,
0L
,
0L
,
ECPGt_EOIT
,
ECPGt_sqlda
,
&
outp_sqlda
,
0L
,
0L
,
0L
,
ECPGt_NO_INDICATOR
,
NULL
,
0L
,
0L
,
0L
,
ECPGt_EORT
);
#line 2
31
"sqlda.pgc"
#line 2
23
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 2
31
"sqlda.pgc"
#line 2
23
"sqlda.pgc"
dump_sqlda
(
outp_sqlda
);
strcpy
(
msg
,
"commit"
);
{
ECPGtrans
(
__LINE__
,
"con2"
,
"commit"
);
#line 2
36
"sqlda.pgc"
#line 2
28
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 2
36
"sqlda.pgc"
#line 2
28
"sqlda.pgc"
strcpy
(
msg
,
"deallocate"
);
{
ECPGdeallocate
(
__LINE__
,
0
,
NULL
,
"st_id4"
);
#line 23
9
"sqlda.pgc"
#line 23
1
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 23
9
"sqlda.pgc"
#line 23
1
"sqlda.pgc"
free
(
inp_sqlda
);
...
...
@@ -502,36 +494,36 @@ if (sqlca.sqlcode < 0) exit (1);}
strcpy
(
msg
,
"disconnect"
);
{
ECPGdisconnect
(
__LINE__
,
"con2"
);
#line 2
45
"sqlda.pgc"
#line 2
37
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 2
45
"sqlda.pgc"
#line 2
37
"sqlda.pgc"
/* End test */
strcpy
(
msg
,
"drop"
);
{
ECPGdo
(
__LINE__
,
0
,
1
,
NULL
,
0
,
ECPGst_normal
,
"drop table t1"
,
ECPGt_EOIT
,
ECPGt_EORT
);
#line 2
50
"sqlda.pgc"
#line 2
42
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 2
50
"sqlda.pgc"
#line 2
42
"sqlda.pgc"
strcpy
(
msg
,
"commit"
);
{
ECPGtrans
(
__LINE__
,
NULL
,
"commit"
);
#line 2
53
"sqlda.pgc"
#line 2
45
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 2
53
"sqlda.pgc"
#line 2
45
"sqlda.pgc"
strcpy
(
msg
,
"disconnect"
);
{
ECPGdisconnect
(
__LINE__
,
"CURRENT"
);
#line 2
56
"sqlda.pgc"
#line 2
48
"sqlda.pgc"
if
(
sqlca
.
sqlcode
<
0
)
exit
(
1
);}
#line 2
56
"sqlda.pgc"
#line 2
48
"sqlda.pgc"
return
(
0
);
...
...
src/interfaces/ecpg/test/expected/sql-sqlda.stderr
View file @
858dc6dc
This diff is collapsed.
Click to expand it.
src/interfaces/ecpg/test/sql/sqlda.pgc
View file @
858dc6dc
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include <limits.h>
exec sql include ../regression;
...
...
@@ -37,13 +36,6 @@ dump_sqlda(sqlda_t *sqlda)
case ECPGt_int:
printf("name sqlda descriptor: '%s' value %d\n", sqlda->sqlvar[i].sqlname.data, *(int *)sqlda->sqlvar[i].sqldata);
break;
#ifdef HAVE_LONG_LONG_INT_64
case ECPGt_long_long:
#else
case ECPGt_long:
#endif
printf("name sqlda descriptor: '%s' value " INT64_FORMAT "\n", sqlda->sqlvar[i].sqlname.data, *(int64_t *)sqlda->sqlvar[i].sqldata);
break;
case ECPGt_double:
printf("name sqlda descriptor: '%s' value %lf\n", sqlda->sqlvar[i].sqlname.data, *(double *)sqlda->sqlvar[i].sqldata);
break;
...
...
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