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
8cb8da38
Commit
8cb8da38
authored
Mar 01, 2000
by
Michael Meskes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*** empty log message ***
parent
a50aaa72
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
278 additions
and
190 deletions
+278
-190
src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/ChangeLog
+5
-0
src/interfaces/ecpg/TODO
src/interfaces/ecpg/TODO
+0
-5
src/interfaces/ecpg/include/ecpgerrno.h
src/interfaces/ecpg/include/ecpgerrno.h
+23
-21
src/interfaces/ecpg/include/ecpglib.h
src/interfaces/ecpg/include/ecpglib.h
+2
-2
src/interfaces/ecpg/include/sql3types.h
src/interfaces/ecpg/include/sql3types.h
+1
-1
src/interfaces/ecpg/lib/data.c
src/interfaces/ecpg/lib/data.c
+42
-8
src/interfaces/ecpg/lib/descriptor.c
src/interfaces/ecpg/lib/descriptor.c
+1
-24
src/interfaces/ecpg/lib/ecpglib.c
src/interfaces/ecpg/lib/ecpglib.c
+36
-16
src/interfaces/ecpg/lib/error.c
src/interfaces/ecpg/lib/error.c
+10
-0
src/interfaces/ecpg/lib/typename.c
src/interfaces/ecpg/lib/typename.c
+25
-0
src/interfaces/ecpg/preproc/preproc.y
src/interfaces/ecpg/preproc/preproc.y
+133
-113
No files found.
src/interfaces/ecpg/ChangeLog
View file @
8cb8da38
...
@@ -832,5 +832,10 @@ Wed Feb 23 17:08:28 CET 2000
...
@@ -832,5 +832,10 @@ Wed Feb 23 17:08:28 CET 2000
Fri Feb 25 16:13:11 CET 2000
Fri Feb 25 16:13:11 CET 2000
- Fixed some bugs I created when I cleaned up, thanks Christof.
- Fixed some bugs I created when I cleaned up, thanks Christof.
Wed Mar 1 10:49:03 CET 2000
- Synced preproc.y with gram.y.
- Added output of arrays.
- Set library version to 3.1.0.
- Set library version to 3.1.0.
- Set ecpg version to 2.7.0.
- Set ecpg version to 2.7.0.
src/interfaces/ecpg/TODO
View file @
8cb8da38
...
@@ -16,8 +16,6 @@ the parser.
...
@@ -16,8 +16,6 @@ the parser.
it would be nice to be able to use :var[:index] or :var[<integer>] as
it would be nice to be able to use :var[:index] or :var[<integer>] as
cvariable for an array var
cvariable for an array var
How can one insert arrays from c variables?
What happens to the output variable during read if there was an
What happens to the output variable during read if there was an
indicator-error?
indicator-error?
...
@@ -26,10 +24,7 @@ Add a semantic check level, e.g. check if a table really exists.
...
@@ -26,10 +24,7 @@ Add a semantic check level, e.g. check if a table really exists.
It would be nice if there was a alternative library using SPI functions
It would be nice if there was a alternative library using SPI functions
instead of libpq so we can write backend functions using ecpg.
instead of libpq so we can write backend functions using ecpg.
make ECPGnumeric_lvalue more accurate by using something like ECPGdump_a_*
remove space_or_nl and line_end from pgc.l
remove space_or_nl and line_end from pgc.l
Missing statements:
Missing statements:
- exec sql ifdef
- SQLSTATE
- SQLSTATE
src/interfaces/ecpg/include/ecpgerrno.h
View file @
8cb8da38
...
@@ -13,32 +13,34 @@
...
@@ -13,32 +13,34 @@
#define ECPG_OUT_OF_MEMORY -ENOMEM
#define ECPG_OUT_OF_MEMORY -ENOMEM
/* first we have a set of ecpg messages, they start at 200 */
/* first we have a set of ecpg messages, they start at 200 */
#define ECPG_UNSUPPORTED -200
#define ECPG_UNSUPPORTED -200
#define ECPG_TOO_MANY_ARGUMENTS -201
#define ECPG_TOO_MANY_ARGUMENTS -201
#define ECPG_TOO_FEW_ARGUMENTS -202
#define ECPG_TOO_FEW_ARGUMENTS -202
#define ECPG_TOO_MANY_MATCHES -203
#define ECPG_TOO_MANY_MATCHES -203
#define ECPG_INT_FORMAT -204
#define ECPG_INT_FORMAT -204
#define ECPG_UINT_FORMAT -205
#define ECPG_UINT_FORMAT -205
#define ECPG_FLOAT_FORMAT -206
#define ECPG_FLOAT_FORMAT -206
#define ECPG_CONVERT_BOOL -207
#define ECPG_CONVERT_BOOL -207
#define ECPG_EMPTY -208
#define ECPG_EMPTY -208
#define ECPG_MISSING_INDICATOR -209
#define ECPG_MISSING_INDICATOR -209
#define ECPG_NO_ARRAY -210
#define ECPG_NO_CONN -220
#define ECPG_DATA_NOT_ARRAY -211
#define ECPG_NOT_CONN -221
#define ECPG_NO_CONN -220
#define ECPG_INVALID_STMT -230
#define ECPG_NOT_CONN -221
#define ECPG_INVALID_STMT -230
/* dynamic SQL related */
/* dynamic SQL related */
#define ECPG_UNKNOWN_DESCRIPTOR -240
#define ECPG_UNKNOWN_DESCRIPTOR
-240
#define ECPG_INVALID_DESCRIPTOR_INDEX -241
#define ECPG_INVALID_DESCRIPTOR_INDEX -241
#define ECPG_UNKNOWN_DESCRIPTOR_ITEM -242
#define ECPG_UNKNOWN_DESCRIPTOR_ITEM -242
#define ECPG_VAR_NOT_NUMERIC -243
#define ECPG_VAR_NOT_NUMERIC
-243
#define ECPG_VAR_NOT_CHAR -244
#define ECPG_VAR_NOT_CHAR
-244
/* finally the backend error messages, they start at 400 */
/* finally the backend error messages, they start at 400 */
#define ECPG_PGSQL -400
#define ECPG_PGSQL
-400
#define ECPG_TRANS -401
#define ECPG_TRANS
-401
#define ECPG_CONNECT -402
#define ECPG_CONNECT
-402
#endif
/* !_ECPG_ERROR_H */
#endif
/* !_ECPG_ERROR_H */
src/interfaces/ecpg/include/ecpglib.h
View file @
8cb8da38
...
@@ -30,12 +30,12 @@ extern "C"
...
@@ -30,12 +30,12 @@ extern "C"
/* Here are some methods used by the lib. */
/* Here are some methods used by the lib. */
/* Returns a pointer to a string containing a simple type name. */
/* Returns a pointer to a string containing a simple type name. */
const
char
*
ECPGtype_name
(
enum
ECPGttype
);
bool
get_data
(
PGresult
*
,
int
,
int
,
int
,
enum
ECPGttype
type
,
bool
get_data
(
PGresult
*
,
int
,
int
,
int
,
enum
ECPGttype
type
,
enum
ECPGttype
,
void
*
,
void
*
,
long
,
long
);
enum
ECPGttype
,
void
*
,
void
*
,
long
,
long
,
bool
);
char
*
ecpg_alloc
(
long
,
int
);
char
*
ecpg_alloc
(
long
,
int
);
char
*
ecpg_strdup
(
const
char
*
,
int
);
char
*
ecpg_strdup
(
const
char
*
,
int
);
const
char
*
ECPGtype_name
(
enum
ECPGttype
);
const
char
*
ECPGtype_name
(
enum
ECPGttype
);
unsigned
int
ECPGDynamicType
(
Oid
);
/* and some vars */
/* and some vars */
extern
struct
auto_mem
*
auto_allocs
;
extern
struct
auto_mem
*
auto_allocs
;
...
...
src/interfaces/ecpg/include/sql3types.h
View file @
8cb8da38
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
*
*
* Copyright (c) 2000, Christof Petig <christof.petig@wtal.de>
* Copyright (c) 2000, Christof Petig <christof.petig@wtal.de>
*
*
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/include/sql3types.h,v 1.
1 2000/02/16 16:18:03
meskes Exp $
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/include/sql3types.h,v 1.
2 2000/03/01 12:49:41
meskes Exp $
*/
*/
/* chapter 13.1 table 2: Codes used for SQL data types in Dynamic SQL */
/* chapter 13.1 table 2: Codes used for SQL data types in Dynamic SQL */
...
...
src/interfaces/ecpg/lib/data.c
View file @
8cb8da38
...
@@ -8,13 +8,26 @@
...
@@ -8,13 +8,26 @@
bool
bool
get_data
(
PGresult
*
results
,
int
act_tuple
,
int
act_field
,
int
lineno
,
get_data
(
PGresult
*
results
,
int
act_tuple
,
int
act_field
,
int
lineno
,
enum
ECPGttype
type
,
enum
ECPGttype
ind_type
,
enum
ECPGttype
type
,
enum
ECPGttype
ind_type
,
void
*
var
,
void
*
ind
,
long
varcharsize
,
long
offset
)
void
*
var
,
void
*
ind
,
long
varcharsize
,
long
offset
,
bool
isarray
)
{
{
char
*
pval
=
(
char
*
)
PQgetvalue
(
results
,
act_tuple
,
act_field
);
char
*
pval
=
(
char
*
)
PQgetvalue
(
results
,
act_tuple
,
act_field
);
ECPGlog
(
"get_data line %d: RESULT: %s
\n
"
,
lineno
,
pval
?
pval
:
""
);
ECPGlog
(
"get_data line %d: RESULT: %s
\n
"
,
lineno
,
pval
?
pval
:
""
);
/* Now the pval is a pointer to the value. */
/* Now the pval is a pointer to the value. */
/* let's check is it really is an array if it should be */
if
(
isarray
)
{
if
(
*
pval
!=
'{'
)
{
ECPGlog
(
"get_data data entry does not look like an array in line %d
\n
"
,
lineno
);
ECPGraise
(
lineno
,
ECPG_DATA_NOT_ARRAY
,
NULL
);
return
(
false
);
}
else
++
pval
;
}
/* We will have to decode the value */
/* We will have to decode the value */
/*
/*
...
@@ -48,8 +61,10 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno,
...
@@ -48,8 +61,10 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno,
break
;
break
;
}
}
switch
(
type
)
do
{
{
switch
(
type
)
{
long
res
;
long
res
;
unsigned
long
ures
;
unsigned
long
ures
;
double
dres
;
double
dres
;
...
@@ -61,7 +76,8 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno,
...
@@ -61,7 +76,8 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno,
if
(
pval
)
if
(
pval
)
{
{
res
=
strtol
(
pval
,
&
scan_length
,
10
);
res
=
strtol
(
pval
,
&
scan_length
,
10
);
if
(
*
scan_length
!=
'\0'
)
/* Garbage left */
if
((
isarray
&&
*
scan_length
!=
','
&&
*
scan_length
!=
'}'
)
||
(
!
isarray
&&
*
scan_length
!=
'\0'
))
/* Garbage left */
{
{
ECPGraise
(
lineno
,
ECPG_INT_FORMAT
,
pval
);
ECPGraise
(
lineno
,
ECPG_INT_FORMAT
,
pval
);
return
(
false
);
return
(
false
);
...
@@ -94,7 +110,8 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno,
...
@@ -94,7 +110,8 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno,
if
(
pval
)
if
(
pval
)
{
{
ures
=
strtoul
(
pval
,
&
scan_length
,
10
);
ures
=
strtoul
(
pval
,
&
scan_length
,
10
);
if
(
*
scan_length
!=
'\0'
)
/* Garbage left */
if
((
isarray
&&
*
scan_length
!=
','
&&
*
scan_length
!=
'}'
)
||
(
!
isarray
&&
*
scan_length
!=
'\0'
))
/* Garbage left */
{
{
ECPGraise
(
lineno
,
ECPG_UINT_FORMAT
,
pval
);
ECPGraise
(
lineno
,
ECPG_UINT_FORMAT
,
pval
);
return
(
false
);
return
(
false
);
...
@@ -127,7 +144,8 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno,
...
@@ -127,7 +144,8 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno,
if
(
pval
)
if
(
pval
)
{
{
dres
=
strtod
(
pval
,
&
scan_length
);
dres
=
strtod
(
pval
,
&
scan_length
);
if
(
*
scan_length
!=
'\0'
)
/* Garbage left */
if
((
isarray
&&
*
scan_length
!=
','
&&
*
scan_length
!=
'}'
)
||
(
!
isarray
&&
*
scan_length
!=
'\0'
))
/* Garbage left */
{
{
ECPGraise
(
lineno
,
ECPG_FLOAT_FORMAT
,
pval
);
ECPGraise
(
lineno
,
ECPG_FLOAT_FORMAT
,
pval
);
return
(
false
);
return
(
false
);
...
@@ -246,7 +264,23 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno,
...
@@ -246,7 +264,23 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno,
ECPGraise
(
lineno
,
ECPG_UNSUPPORTED
,
ECPGtype_name
(
type
));
ECPGraise
(
lineno
,
ECPG_UNSUPPORTED
,
ECPGtype_name
(
type
));
return
(
false
);
return
(
false
);
break
;
break
;
}
}
if
(
isarray
)
{
bool
string
=
false
;
/* set array to next entry */
++
act_tuple
;
/* set pval to the next entry */
for
(;
string
||
(
*
pval
!=
','
&&
*
pval
!=
'}'
);
++
pval
)
if
(
*
pval
==
'"'
)
string
=
string
?
false
:
true
;
if
(
*
pval
==
','
)
++
pval
;
}
}
while
(
isarray
&&
*
pval
!=
'}'
);
return
(
true
);
return
(
true
);
}
}
src/interfaces/ecpg/lib/descriptor.c
View file @
8cb8da38
...
@@ -25,28 +25,6 @@ static PGresult
...
@@ -25,28 +25,6 @@ static PGresult
return
NULL
;
return
NULL
;
}
}
static
unsigned
int
ECPGDynamicType
(
Oid
type
)
{
switch
(
type
)
{
case
16
:
return
SQL3_BOOLEAN
;
/* bool */
case
21
:
return
SQL3_SMALLINT
;
/* int2 */
case
23
:
return
SQL3_INTEGER
;
/* int4 */
case
25
:
return
SQL3_CHARACTER
;
/* text */
case
700
:
return
SQL3_REAL
;
/* float4 */
case
701
:
return
SQL3_DOUBLE_PRECISION
;
/* float8 */
case
1042
:
return
SQL3_CHARACTER
;
/* bpchar */
case
1043
:
return
SQL3_CHARACTER_VARYING
;
/* varchar */
case
1082
:
return
SQL3_DATE_TIME_TIMESTAMP
;
/* date */
case
1083
:
return
SQL3_DATE_TIME_TIMESTAMP
;
/* time */
case
1184
:
return
SQL3_DATE_TIME_TIMESTAMP
;
/* datetime */
case
1296
:
return
SQL3_DATE_TIME_TIMESTAMP
;
/* timestamp */
case
1700
:
return
SQL3_NUMERIC
;
/* numeric */
default:
return
-
type
;
}
}
static
unsigned
int
static
unsigned
int
ECPGDynamicType_DDT
(
Oid
type
)
ECPGDynamicType_DDT
(
Oid
type
)
{
{
...
@@ -61,7 +39,6 @@ ECPGDynamicType_DDT(Oid type)
...
@@ -61,7 +39,6 @@ ECPGDynamicType_DDT(Oid type)
}
}
}
}
bool
bool
ECPGget_desc_header
(
int
lineno
,
char
*
desc_name
,
int
*
count
)
ECPGget_desc_header
(
int
lineno
,
char
*
desc_name
,
int
*
count
)
{
{
...
@@ -266,7 +243,7 @@ ECPGget_desc(int lineno, char *desc_name, int index, ...)
...
@@ -266,7 +243,7 @@ ECPGget_desc(int lineno, char *desc_name, int index, ...)
ECPGlog
(
"ECPGget_desc: TYPE = %d
\n
"
,
ECPGDynamicType_DDT
(
PQftype
(
ECPGresult
,
index
)));
ECPGlog
(
"ECPGget_desc: TYPE = %d
\n
"
,
ECPGDynamicType_DDT
(
PQftype
(
ECPGresult
,
index
)));
break
;
break
;
case
ECPGd_data
:
case
ECPGd_data
:
if
(
!
get_data
(
ECPGresult
,
0
,
index
,
lineno
,
vartype
,
ECPGt_NO_INDICATOR
,
var
,
NULL
,
varcharsize
,
offset
))
if
(
!
get_data
(
ECPGresult
,
0
,
index
,
lineno
,
vartype
,
ECPGt_NO_INDICATOR
,
var
,
NULL
,
varcharsize
,
offset
,
false
))
return
(
false
);
return
(
false
);
break
;
break
;
...
...
src/interfaces/ecpg/lib/ecpglib.c
View file @
8cb8da38
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#include <ecpgtype.h>
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpglib.h>
#include <sqlca.h>
#include <sqlca.h>
#include <sql3types.h>
/* variables visible to the programs */
/* variables visible to the programs */
static
struct
sqlca
sqlca_init
=
static
struct
sqlca
sqlca_init
=
...
@@ -689,23 +690,46 @@ ECPGexecute(struct statement * stmt)
...
@@ -689,23 +690,46 @@ ECPGexecute(struct statement * stmt)
isarray
=
0
;
isarray
=
0
;
if
(
PQresultStatus
(
query
)
==
PGRES_TUPLES_OK
)
{
if
(
PQresultStatus
(
query
)
==
PGRES_TUPLES_OK
)
{
isarray
=
atol
((
char
*
)
PQgetvalue
(
query
,
0
,
0
));
isarray
=
atol
((
char
*
)
PQgetvalue
(
query
,
0
,
0
));
if
(
ECPGDynamicType
(
PQftype
(
results
,
act_field
))
==
SQL3_CHARACTER
||
(
PQftype
(
results
,
act_field
))
==
SQL3_CHARACTER_VARYING
)
{
/* arrays of character strings are not yet implemented */
isarray
=
false
;
}
ECPGlog
(
"ECPGexecute line %d: TYPE database: %d C: %d array: %s
\n
"
,
stmt
->
lineno
,
PQftype
(
results
,
act_field
),
var
->
type
,
isarray
?
"yes"
:
"no"
);
ECPGlog
(
"ECPGexecute line %d: TYPE database: %d C: %d array: %s
\n
"
,
stmt
->
lineno
,
PQftype
(
results
,
act_field
),
var
->
type
,
isarray
?
"yes"
:
"no"
);
}
}
PQclear
(
query
);
PQclear
(
query
);
/*
if
(
!
isarray
)
* if we don't have enough space, we cannot read all
* tuples
*/
if
((
var
->
arrsize
>
0
&&
ntuples
>
var
->
arrsize
)
||
(
var
->
ind_arrsize
>
0
&&
ntuples
>
var
->
ind_arrsize
))
{
{
ECPGlog
(
"ECPGexecute line %d: Incorrect number of matches: %d don't fit into array of %d
\n
"
,
/*
* if we don't have enough space, we cannot read all
* tuples
*/
if
((
var
->
arrsize
>
0
&&
ntuples
>
var
->
arrsize
)
||
(
var
->
ind_arrsize
>
0
&&
ntuples
>
var
->
ind_arrsize
))
{
ECPGlog
(
"ECPGexecute line %d: Incorrect number of matches: %d don't fit into array of %d
\n
"
,
stmt
->
lineno
,
ntuples
,
var
->
arrsize
);
stmt
->
lineno
,
ntuples
,
var
->
arrsize
);
ECPGraise
(
stmt
->
lineno
,
ECPG_TOO_MANY_MATCHES
,
NULL
);
ECPGraise
(
stmt
->
lineno
,
ECPG_TOO_MANY_MATCHES
,
NULL
);
status
=
false
;
status
=
false
;
break
;
break
;
}
}
}
else
{
/*
* since we read an array, the variable has to be
* an array too
*/
if
(
var
->
arrsize
==
0
)
{
ECPGlog
(
"ECPGexecute line %d: variable is not an array
\n
"
);
ECPGraise
(
stmt
->
lineno
,
ECPG_NO_ARRAY
,
NULL
);
status
=
false
;
break
;
}
}
/*
/*
* allocate memory for NULL pointers
* allocate memory for NULL pointers
*/
*/
...
@@ -745,7 +769,7 @@ ECPGexecute(struct statement * stmt)
...
@@ -745,7 +769,7 @@ ECPGexecute(struct statement * stmt)
{
{
if
(
!
get_data
(
results
,
act_tuple
,
act_field
,
stmt
->
lineno
,
if
(
!
get_data
(
results
,
act_tuple
,
act_field
,
stmt
->
lineno
,
var
->
type
,
var
->
ind_type
,
var
->
value
,
var
->
type
,
var
->
ind_type
,
var
->
value
,
var
->
ind_value
,
var
->
varcharsize
,
var
->
offset
))
var
->
ind_value
,
var
->
varcharsize
,
var
->
offset
,
isarray
))
status
=
false
;
status
=
false
;
}
}
var
=
var
->
next
;
var
=
var
->
next
;
...
@@ -1067,13 +1091,9 @@ ECPGlog(const char *format,...)
...
@@ -1067,13 +1091,9 @@ ECPGlog(const char *format,...)
*
*
* Copyright (c) 2000, Christof Petig <christof.petig@wtal.de>
* Copyright (c) 2000, Christof Petig <christof.petig@wtal.de>
*
*
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/ecpglib.c,v 1.6
0 2000/02/23 19:25:43
meskes Exp $
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/ecpglib.c,v 1.6
1 2000/03/01 12:49:42
meskes Exp $
*/
*/
/* I borrowed the include files from ecpglib.c, maybe we don't need all of them */
#include <sql3types.h>
PGconn
*
ECPG_internal_get_connection
(
char
*
name
);
PGconn
*
ECPG_internal_get_connection
(
char
*
name
);
extern
struct
descriptor
extern
struct
descriptor
...
...
src/interfaces/ecpg/lib/error.c
View file @
8cb8da38
...
@@ -67,6 +67,16 @@ ECPGraise(int line, int code, const char *str)
...
@@ -67,6 +67,16 @@ ECPGraise(int line, int code, const char *str)
snprintf
(
sqlca
.
sqlerrm
.
sqlerrmc
,
sizeof
(
sqlca
.
sqlerrm
.
sqlerrmc
),
snprintf
(
sqlca
.
sqlerrm
.
sqlerrmc
,
sizeof
(
sqlca
.
sqlerrm
.
sqlerrmc
),
"NULL value without indicator in line %d."
,
line
);
"NULL value without indicator in line %d."
,
line
);
break
;
break
;
case
ECPG_NO_ARRAY
:
snprintf
(
sqlca
.
sqlerrm
.
sqlerrmc
,
sizeof
(
sqlca
.
sqlerrm
.
sqlerrmc
),
"variable is not an array in line %d."
,
line
);
break
;
case
ECPG_DATA_NOT_ARRAY
:
snprintf
(
sqlca
.
sqlerrm
.
sqlerrmc
,
sizeof
(
sqlca
.
sqlerrm
.
sqlerrmc
),
"data read from backend is not an array in line %d."
,
line
);
break
;
case
ECPG_NO_CONN
:
case
ECPG_NO_CONN
:
snprintf
(
sqlca
.
sqlerrm
.
sqlerrmc
,
sizeof
(
sqlca
.
sqlerrm
.
sqlerrmc
),
snprintf
(
sqlca
.
sqlerrm
.
sqlerrmc
,
sizeof
(
sqlca
.
sqlerrm
.
sqlerrmc
),
...
...
src/interfaces/ecpg/lib/typename.c
View file @
8cb8da38
#include <stdlib.h>
#include <stdlib.h>
#include <ecpgtype.h>
#include <ecpgtype.h>
#include <ecpglib.h>
#include <sql3types.h>
/*
/*
* This function is used to generate the correct type names.
* This function is used to generate the correct type names.
*/
*/
...
@@ -39,3 +42,25 @@ ECPGtype_name(enum ECPGttype typ)
...
@@ -39,3 +42,25 @@ ECPGtype_name(enum ECPGttype typ)
}
}
return
NULL
;
return
NULL
;
}
}
unsigned
int
ECPGDynamicType
(
Oid
type
)
{
switch
(
type
)
{
case
16
:
return
SQL3_BOOLEAN
;
/* bool */
case
21
:
return
SQL3_SMALLINT
;
/* int2 */
case
23
:
return
SQL3_INTEGER
;
/* int4 */
case
25
:
return
SQL3_CHARACTER
;
/* text */
case
700
:
return
SQL3_REAL
;
/* float4 */
case
701
:
return
SQL3_DOUBLE_PRECISION
;
/* float8 */
case
1042
:
return
SQL3_CHARACTER
;
/* bpchar */
case
1043
:
return
SQL3_CHARACTER_VARYING
;
/* varchar */
case
1082
:
return
SQL3_DATE_TIME_TIMESTAMP
;
/* date */
case
1083
:
return
SQL3_DATE_TIME_TIMESTAMP
;
/* time */
case
1184
:
return
SQL3_DATE_TIME_TIMESTAMP
;
/* datetime */
case
1296
:
return
SQL3_DATE_TIME_TIMESTAMP
;
/* timestamp */
case
1700
:
return
SQL3_NUMERIC
;
/* numeric */
default:
return
-
type
;
}
}
src/interfaces/ecpg/preproc/preproc.y
View file @
8cb8da38
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