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
f207718b
Commit
f207718b
authored
Jul 08, 2003
by
Michael Meskes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More informix fixes.
parent
fee6fd7f
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
78 additions
and
37 deletions
+78
-37
src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/ChangeLog
+5
-0
src/interfaces/ecpg/compatlib/informix.c
src/interfaces/ecpg/compatlib/informix.c
+14
-2
src/interfaces/ecpg/ecpglib/data.c
src/interfaces/ecpg/ecpglib/data.c
+33
-28
src/interfaces/ecpg/ecpglib/execute.c
src/interfaces/ecpg/ecpglib/execute.c
+8
-2
src/interfaces/ecpg/preproc/preproc.y
src/interfaces/ecpg/preproc/preproc.y
+11
-3
src/interfaces/ecpg/preproc/type.c
src/interfaces/ecpg/preproc/type.c
+6
-2
src/interfaces/ecpg/test/test2.pgc
src/interfaces/ecpg/test/test2.pgc
+1
-0
No files found.
src/interfaces/ecpg/ChangeLog
View file @
f207718b
...
...
@@ -1558,6 +1558,11 @@ Mon Jul 7 14:13:43 CEST 2003
Tue Jul 8 09:04:31 CEST 2003
- Fixed segfault in ECPGconnect in Informix mode.
Tue Jul 8 12:34:00 CEST 2003
- Made Informix decimal-ascii conversion honor Informix NULLs.
- Informix variable handling didn't cope well with arrays.
- Set ecpg version to 3.0.0
- Set ecpg library to 4.0.0
- Set pgtypes library to 1.0.0
...
...
src/interfaces/ecpg/compatlib/informix.c
View file @
f207718b
...
...
@@ -8,6 +8,7 @@
#include <ecpg_informix.h>
#include <pgtypes_error.h>
#include <pgtypes_date.h>
#include <sqltypes.h>
char
*
ECPGalloc
(
long
,
int
);
...
...
@@ -148,6 +149,11 @@ deccvasc(char *cp, int len, Decimal *np)
int
ret
=
0
;
Numeric
*
result
;
if
(
risnull
(
CSTRINGTYPE
,
cp
))
{
rsetnull
(
CDECIMALTYPE
,
(
char
*
)
np
);
return
0
;
}
if
(
!
str
)
ret
=
-
1201
;
...
...
@@ -292,6 +298,12 @@ dectoasc(Decimal *np, char *cp, int len, int right)
if
(
nres
==
NULL
)
return
-
1211
;
if
(
risnull
(
CDECIMALTYPE
,
(
char
*
)
np
))
{
rsetnull
(
CSTRINGTYPE
,
(
char
*
)
cp
);
return
0
;
}
if
(
PGTYPESnumeric_from_decimal
(
np
,
nres
)
!=
0
)
return
-
1211
;
...
...
src/interfaces/ecpg/ecpglib/data.c
View file @
f207718b
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.1
0 2003/07/01 12:40:51
meskes Exp $ */
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.1
1 2003/07/08 12:11:28
meskes Exp $ */
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
...
...
@@ -24,6 +24,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
{
struct
sqlca_t
*
sqlca
=
ECPGget_sqlca
();
char
*
pval
=
(
char
*
)
PQgetvalue
(
results
,
act_tuple
,
act_field
);
int
value_for_indicator
=
0
;
ECPGlog
(
"ECPGget_data line %d: RESULT: %s offset: %ld
\n
"
,
lineno
,
pval
?
pval
:
""
,
offset
);
...
...
@@ -53,31 +54,34 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
/* We will have to decode the value */
/*
* check for null value and set indicator accordingly
* check for null value and set indicator accordingly
, i.e. -1 if NULL and 0 if not
*/
if
(
PQgetisnull
(
results
,
act_tuple
,
act_field
))
{
value_for_indicator
=
-
1
;
switch
(
ind_type
)
{
case
ECPGt_short
:
case
ECPGt_unsigned_short
:
*
((
short
*
)
(
ind
+
ind_offset
*
act_tuple
))
=
-
1
;
*
((
short
*
)
(
ind
+
ind_offset
*
act_tuple
))
=
value_for_indicator
;
break
;
case
ECPGt_int
:
case
ECPGt_unsigned_int
:
*
((
int
*
)
(
ind
+
ind_offset
*
act_tuple
))
=
-
1
;
*
((
int
*
)
(
ind
+
ind_offset
*
act_tuple
))
=
value_for_indicator
;
break
;
case
ECPGt_long
:
case
ECPGt_unsigned_long
:
*
((
long
*
)
(
ind
+
ind_offset
*
act_tuple
))
=
-
1
;
*
((
long
*
)
(
ind
+
ind_offset
*
act_tuple
))
=
value_for_indicator
;
break
;
#ifdef HAVE_LONG_LONG_INT_64
case
ECPGt_long_long
:
case
ECPGt_unsigned_long_long
:
*
((
long
long
int
*
)
(
ind
+
ind_offset
*
act_tuple
))
=
-
1
;
*
((
long
long
int
*
)
(
ind
+
ind_offset
*
act_tuple
))
=
value_for_indicator
;
break
;
#endif
/* HAVE_LONG_LONG_INT_64 */
case
ECPGt_NO_INDICATOR
:
if
(
value_for_indicator
==
-
1
)
{
if
(
force_indicator
==
false
)
{
/* Informix has an additional way to specify NULLs
...
...
@@ -89,6 +93,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
ECPGraise
(
lineno
,
ECPG_MISSING_INDICATOR
,
NULL
);
return
(
false
);
}
}
break
;
default:
ECPGraise
(
lineno
,
ECPG_UNSUPPORTED
,
ECPGtype_name
(
ind_type
));
...
...
@@ -96,8 +101,8 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
break
;
}
if
(
value_for_indicator
==
-
1
)
return
(
true
);
}
do
{
...
...
src/interfaces/ecpg/ecpglib/execute.c
View file @
f207718b
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.1
7 2003/07/07 12:15:33
meskes Exp $ */
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.1
8 2003/07/08 12:11:29
meskes Exp $ */
/*
* The aim is to get a simpler inteface to the database routines.
...
...
@@ -145,7 +145,6 @@ create_statement(int lineno, int compat, int force_indicator, struct connection
if
(
var
->
varcharsize
<
0
)
var
->
varcharsize
=
0
;
var
->
ind_type
=
va_arg
(
ap
,
enum
ECPGttype
);
var
->
ind_pointer
=
va_arg
(
ap
,
char
*
);
var
->
ind_varcharsize
=
va_arg
(
ap
,
long
);
...
...
@@ -159,6 +158,13 @@ create_statement(int lineno, int compat, int force_indicator, struct connection
else
var
->
ind_value
=
var
->
ind_pointer
;
/* negative values are used to indicate an array without given bounds */
/* reset to zero for us */
if
(
var
->
ind_arrsize
<
0
)
var
->
ind_arrsize
=
0
;
if
(
var
->
ind_varcharsize
<
0
)
var
->
ind_varcharsize
=
0
;
for
(
ptr
=
*
list
;
ptr
&&
ptr
->
next
;
ptr
=
ptr
->
next
);
if
(
ptr
==
NULL
)
...
...
src/interfaces/ecpg/preproc/preproc.y
View file @
f207718b
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.24
4 2003/07/01 12:40:51
meskes Exp $ */
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.24
5 2003/07/08 12:11:32
meskes Exp $ */
/* Copyright comment */
%{
...
...
@@ -208,10 +208,18 @@ adjust_informix(struct arguments *list)
/* change variable name to "ECPG_informix_get_var(<counter>)" */
original_var = ptr->variable->name;
sprintf(temp, "%d))", ecpg_informix_var);
ptr->variable = new_variable(cat_str(4, make_str("*("), mm_strdup(ECPGtype_name(ptr->variable->type->type)), make_str(" *)(ECPG_informix_get_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->variable->type->type, ptr->variable->type->size), 0);
/* create call to "ECPG_informix_set_var(<counter>, <pointer>. <linen number>)" */
if (atoi(ptr->variable->type->size) > 1)
{
ptr->variable = new_variable(cat_str(4, make_str("("), mm_strdup(ECPGtype_name(ptr->variable->type->type)), make_str(" *)(ECPG_informix_get_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->variable->type->type, ptr->variable->type->size), 0);
sprintf(temp, "%d, (", ecpg_informix_var++);
}
else
{
ptr->variable = new_variable(cat_str(4, make_str("*("), mm_strdup(ECPGtype_name(ptr->variable->type->type)), make_str(" *)(ECPG_informix_get_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->variable->type->type, ptr->variable->type->size), 0);
sprintf(temp, "%d, &(", ecpg_informix_var++);
}
result = cat_str(5, result, make_str("ECPG_informix_set_var("), mm_strdup(temp), mm_strdup(original_var), make_str("), __LINE__);\n"));
}
...
...
src/interfaces/ecpg/preproc/type.c
View file @
f207718b
...
...
@@ -321,6 +321,10 @@ ECPGdump_a_simple(FILE *o, const char *name, enum ECPGttype type,
switch
(
type
)
{
/*
* we have to use the & operator except for arrays and pointers
*/
case
ECPGt_varchar
:
/*
...
...
@@ -342,7 +346,7 @@ ECPGdump_a_simple(FILE *o, const char *name, enum ECPGttype type,
/*
* we have to use the pointer except for arrays with given
* bounds
* bounds
, ecpglib will distinguish between * and []
*/
if
((
atoi
(
varcharsize
)
>
1
||
(
atoi
(
arrsize
)
>
0
)
||
...
...
src/interfaces/ecpg/test/test2.pgc
View file @
f207718b
...
...
@@ -65,6 +65,7 @@ exec sql end declare section;
p=&personal;
i=&ind_personal;
memset(i, 0, sizeof(ind_personal));
while (1) {
strcpy(msg, "fetch");
exec sql fetch cur into :p:i, :married:ind_married, :children.integer:ind_children.smallint;
...
...
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