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
956cbeb7
Commit
956cbeb7
authored
Jul 05, 2006
by
Michael Meskes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed remaining Coverity bugs.
parent
2d0c1d31
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
10 deletions
+30
-10
src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/ChangeLog
+4
-0
src/interfaces/ecpg/ecpglib/descriptor.c
src/interfaces/ecpg/ecpglib/descriptor.c
+7
-4
src/interfaces/ecpg/ecpglib/execute.c
src/interfaces/ecpg/ecpglib/execute.c
+19
-6
No files found.
src/interfaces/ecpg/ChangeLog
View file @
956cbeb7
...
@@ -2040,5 +2040,9 @@ Mo Jun 26 16:08:23 CEST 2006
...
@@ -2040,5 +2040,9 @@ Mo Jun 26 16:08:23 CEST 2006
- Added missing braces to prevent a segfault after usage of an
- Added missing braces to prevent a segfault after usage of an
undeclared cursor.
undeclared cursor.
We Jul 5 12:17:28 CEST 2006
- Fixed remaining Coverity bugs.
- Set ecpg library version to 5.2.
- Set ecpg library version to 5.2.
- Set ecpg version to 4.2.1.
- Set ecpg version to 4.2.1.
src/interfaces/ecpg/ecpglib/descriptor.c
View file @
956cbeb7
/* dynamic SQL support routines
/* dynamic SQL support routines
*
*
* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/descriptor.c,v 1.1
6 2006/06/25 09:38:39
meskes Exp $
* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/descriptor.c,v 1.1
7 2006/07/05 10:49:56
meskes Exp $
*/
*/
#define POSTGRES_ECPG_INTERNAL
#define POSTGRES_ECPG_INTERNAL
...
@@ -249,7 +249,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...)
...
@@ -249,7 +249,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...)
data_var
.
ind_varcharsize
=
varcharsize
;
data_var
.
ind_varcharsize
=
varcharsize
;
data_var
.
ind_arrsize
=
arrsize
;
data_var
.
ind_arrsize
=
arrsize
;
data_var
.
ind_offset
=
offset
;
data_var
.
ind_offset
=
offset
;
if
(
data_var
.
ind_arrsize
==
0
||
data_var
.
ind_varcharsize
==
0
)
if
(
(
data_var
.
ind_arrsize
==
0
||
data_var
.
ind_varcharsize
==
0
)
&&
data_var
.
ind_pointer
!=
NULL
)
data_var
.
ind_value
=
*
((
void
**
)
(
data_var
.
ind_pointer
));
data_var
.
ind_value
=
*
((
void
**
)
(
data_var
.
ind_pointer
));
else
else
data_var
.
ind_value
=
data_var
.
ind_pointer
;
data_var
.
ind_value
=
data_var
.
ind_pointer
;
...
@@ -397,7 +397,8 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...)
...
@@ -397,7 +397,8 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...)
setlocale
(
LC_NUMERIC
,
oldlocale
);
setlocale
(
LC_NUMERIC
,
oldlocale
);
ECPGfree
(
oldlocale
);
ECPGfree
(
oldlocale
);
}
}
else
if
(
data_var
.
ind_type
!=
ECPGt_NO_INDICATOR
)
else
if
(
data_var
.
ind_type
!=
ECPGt_NO_INDICATOR
&&
data_var
.
ind_pointer
!=
NULL
)
/* ind_type != NO_INDICATOR should always have ind_pointer != NULL but since this might be changed manually in the .c file let's play it safe */
{
{
/*
/*
* this is like ECPGstore_result but since we don't have a data
* this is like ECPGstore_result but since we don't have a data
...
@@ -410,8 +411,9 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...)
...
@@ -410,8 +411,9 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...)
ECPGraise
(
lineno
,
ECPG_TOO_MANY_MATCHES
,
ECPG_SQLSTATE_CARDINALITY_VIOLATION
,
NULL
);
ECPGraise
(
lineno
,
ECPG_TOO_MANY_MATCHES
,
ECPG_SQLSTATE_CARDINALITY_VIOLATION
,
NULL
);
return
false
;
return
false
;
}
}
/* allocate storage if needed */
/* allocate storage if needed */
if
(
data_var
.
ind_arrsize
==
0
&&
data_var
.
ind_
pointer
!=
NULL
&&
data_var
.
ind_
value
==
NULL
)
if
(
data_var
.
ind_arrsize
==
0
&&
data_var
.
ind_value
==
NULL
)
{
{
void
*
mem
=
(
void
*
)
ECPGalloc
(
data_var
.
ind_offset
*
ntuples
,
lineno
);
void
*
mem
=
(
void
*
)
ECPGalloc
(
data_var
.
ind_offset
*
ntuples
,
lineno
);
if
(
!
mem
)
if
(
!
mem
)
...
@@ -420,6 +422,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...)
...
@@ -420,6 +422,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...)
ECPGadd_mem
(
mem
,
lineno
);
ECPGadd_mem
(
mem
,
lineno
);
data_var
.
ind_value
=
mem
;
data_var
.
ind_value
=
mem
;
}
}
for
(
act_tuple
=
0
;
act_tuple
<
ntuples
;
act_tuple
++
)
for
(
act_tuple
=
0
;
act_tuple
<
ntuples
;
act_tuple
++
)
{
{
if
(
!
get_int_item
(
lineno
,
data_var
.
ind_value
,
data_var
.
ind_type
,
-
PQgetisnull
(
ECPGresult
,
act_tuple
,
index
)))
if
(
!
get_int_item
(
lineno
,
data_var
.
ind_value
,
data_var
.
ind_type
,
-
PQgetisnull
(
ECPGresult
,
act_tuple
,
index
)))
...
...
src/interfaces/ecpg/ecpglib/execute.c
View file @
956cbeb7
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.5
0 2006/06/26 09:20:09
meskes Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.5
1 2006/07/05 10:49:56
meskes Exp $ */
/*
/*
* The aim is to get a simpler inteface to the database routines.
* The aim is to get a simpler inteface to the database routines.
...
@@ -876,12 +876,13 @@ ECPGstore_input(const int lineno, const bool force_indicator, const struct varia
...
@@ -876,12 +876,13 @@ ECPGstore_input(const int lineno, const bool force_indicator, const struct varia
{
{
char
*
str
=
NULL
;
char
*
str
=
NULL
;
int
slen
;
int
slen
;
numeric
*
nval
=
PGTYPESnumeric_new
()
;
numeric
*
nval
;
if
(
var
->
arrsize
>
1
)
if
(
var
->
arrsize
>
1
)
{
{
for
(
element
=
0
;
element
<
var
->
arrsize
;
element
++
,
nval
=
PGTYPESnumeric_new
()
)
for
(
element
=
0
;
element
<
var
->
arrsize
;
element
++
)
{
{
nval
=
PGTYPESnumeric_new
();
if
(
!
nval
)
if
(
!
nval
)
return
false
;
return
false
;
...
@@ -911,6 +912,7 @@ ECPGstore_input(const int lineno, const bool force_indicator, const struct varia
...
@@ -911,6 +912,7 @@ ECPGstore_input(const int lineno, const bool force_indicator, const struct varia
}
}
else
else
{
{
nval
=
PGTYPESnumeric_new
();
if
(
!
nval
)
if
(
!
nval
)
return
false
;
return
false
;
...
@@ -1048,16 +1050,22 @@ ECPGstore_input(const int lineno, const bool force_indicator, const struct varia
...
@@ -1048,16 +1050,22 @@ ECPGstore_input(const int lineno, const bool force_indicator, const struct varia
case
ECPGt_timestamp
:
case
ECPGt_timestamp
:
{
{
char
*
str
=
NULL
;
char
*
str
=
NULL
,
*
asc
=
NULL
;
int
slen
;
int
slen
;
if
(
var
->
arrsize
>
1
)
if
(
var
->
arrsize
>
1
)
{
{
for
(
element
=
0
;
element
<
var
->
arrsize
;
element
++
)
for
(
element
=
0
;
element
<
var
->
arrsize
;
element
++
)
{
{
str
=
quote_postgres
(
PGTYPEStimestamp_to_asc
(
*
(
timestamp
*
)
((
var
+
var
->
offset
*
element
)
->
value
)),
lineno
);
asc
=
PGTYPEStimestamp_to_asc
(
*
(
timestamp
*
)
((
var
+
var
->
offset
*
element
)
->
value
));
if
(
!
asc
)
return
false
;
str
=
quote_postgres
(
asc
,
lineno
);
ECPGfree
(
asc
);
/* we don't need this anymore so free it asap. */
if
(
!
str
)
if
(
!
str
)
return
false
;
return
false
;
slen
=
strlen
(
str
);
slen
=
strlen
(
str
);
if
(
!
(
mallocedval
=
ECPGrealloc
(
mallocedval
,
strlen
(
mallocedval
)
+
slen
+
sizeof
(
"array [], timestamp "
),
lineno
)))
if
(
!
(
mallocedval
=
ECPGrealloc
(
mallocedval
,
strlen
(
mallocedval
)
+
slen
+
sizeof
(
"array [], timestamp "
),
lineno
)))
...
@@ -1077,7 +1085,12 @@ ECPGstore_input(const int lineno, const bool force_indicator, const struct varia
...
@@ -1077,7 +1085,12 @@ ECPGstore_input(const int lineno, const bool force_indicator, const struct varia
}
}
else
else
{
{
str
=
quote_postgres
(
PGTYPEStimestamp_to_asc
(
*
(
timestamp
*
)
(
var
->
value
)),
lineno
);
asc
=
PGTYPEStimestamp_to_asc
(
*
(
timestamp
*
)
(
var
->
value
));
if
(
!
asc
)
return
false
;
str
=
quote_postgres
(
asc
,
lineno
);
ECPGfree
(
asc
);
/* we don't need this anymore so free it asap. */
if
(
!
str
)
if
(
!
str
)
return
false
;
return
false
;
slen
=
strlen
(
str
);
slen
=
strlen
(
str
);
...
...
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