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
f2ae9f9c
Commit
f2ae9f9c
authored
Dec 03, 2011
by
Michael Meskes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Applied another patch by Zoltan to fix memory alignement issues in ecpg's sqlda
code.
parent
5b406779
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
12 deletions
+19
-12
src/interfaces/ecpg/ecpglib/sqlda.c
src/interfaces/ecpg/ecpglib/sqlda.c
+19
-12
No files found.
src/interfaces/ecpg/ecpglib/sqlda.c
View file @
f2ae9f9c
...
@@ -110,7 +110,7 @@ sqlda_common_total_size(const PGresult *res, int row, enum COMPAT_MODE compat, l
...
@@ -110,7 +110,7 @@ sqlda_common_total_size(const PGresult *res, int row, enum COMPAT_MODE compat, l
* int Unfortunately we need to do double work here to compute
* int Unfortunately we need to do double work here to compute
* the size of the space needed for the numeric structure.
* the size of the space needed for the numeric structure.
*/
*/
ecpg_sqlda_align_add_size
(
offset
,
sizeof
(
int
),
sizeof
(
numeric
),
&
offset
,
&
next_offset
);
ecpg_sqlda_align_add_size
(
offset
,
sizeof
(
NumericDigit
*
),
sizeof
(
numeric
),
&
offset
,
&
next_offset
);
if
(
!
PQgetisnull
(
res
,
row
,
i
))
if
(
!
PQgetisnull
(
res
,
row
,
i
))
{
{
char
*
val
=
PQgetvalue
(
res
,
row
,
i
);
char
*
val
=
PQgetvalue
(
res
,
row
,
i
);
...
@@ -119,7 +119,8 @@ sqlda_common_total_size(const PGresult *res, int row, enum COMPAT_MODE compat, l
...
@@ -119,7 +119,8 @@ sqlda_common_total_size(const PGresult *res, int row, enum COMPAT_MODE compat, l
num
=
PGTYPESnumeric_from_asc
(
val
,
NULL
);
num
=
PGTYPESnumeric_from_asc
(
val
,
NULL
);
if
(
!
num
)
if
(
!
num
)
break
;
break
;
ecpg_sqlda_align_add_size
(
next_offset
,
sizeof
(
int
),
num
->
ndigits
+
1
,
&
offset
,
&
next_offset
);
if
(
num
->
ndigits
)
ecpg_sqlda_align_add_size
(
next_offset
,
sizeof
(
int
),
num
->
ndigits
+
1
,
&
offset
,
&
next_offset
);
PGTYPESnumeric_free
(
num
);
PGTYPESnumeric_free
(
num
);
}
}
break
;
break
;
...
@@ -323,7 +324,7 @@ ecpg_set_compat_sqlda(int lineno, struct sqlda_compat ** _sqlda, const PGresult
...
@@ -323,7 +324,7 @@ ecpg_set_compat_sqlda(int lineno, struct sqlda_compat ** _sqlda, const PGresult
set_data
=
false
;
set_data
=
false
;
ecpg_sqlda_align_add_size
(
offset
,
sizeof
(
int
),
sizeof
(
numeric
),
&
offset
,
&
next_offset
);
ecpg_sqlda_align_add_size
(
offset
,
sizeof
(
NumericDigit
*
),
sizeof
(
numeric
),
&
offset
,
&
next_offset
);
sqlda
->
sqlvar
[
i
].
sqldata
=
(
char
*
)
sqlda
+
offset
;
sqlda
->
sqlvar
[
i
].
sqldata
=
(
char
*
)
sqlda
+
offset
;
sqlda
->
sqlvar
[
i
].
sqllen
=
sizeof
(
numeric
);
sqlda
->
sqlvar
[
i
].
sqllen
=
sizeof
(
numeric
);
...
@@ -343,11 +344,14 @@ ecpg_set_compat_sqlda(int lineno, struct sqlda_compat ** _sqlda, const PGresult
...
@@ -343,11 +344,14 @@ ecpg_set_compat_sqlda(int lineno, struct sqlda_compat ** _sqlda, const PGresult
memcpy
(
sqlda
->
sqlvar
[
i
].
sqldata
,
num
,
sizeof
(
numeric
));
memcpy
(
sqlda
->
sqlvar
[
i
].
sqldata
,
num
,
sizeof
(
numeric
));
ecpg_sqlda_align_add_size
(
next_offset
,
sizeof
(
int
),
num
->
ndigits
+
1
,
&
offset
,
&
next_offset
);
if
(
num
->
ndigits
)
memcpy
((
char
*
)
sqlda
+
offset
,
num
->
buf
,
num
->
ndigits
+
1
);
{
ecpg_sqlda_align_add_size
(
next_offset
,
sizeof
(
int
),
num
->
ndigits
+
1
,
&
offset
,
&
next_offset
);
memcpy
((
char
*
)
sqlda
+
offset
,
num
->
buf
,
num
->
ndigits
+
1
);
((
numeric
*
)
sqlda
->
sqlvar
[
i
].
sqldata
)
->
buf
=
(
NumericDigit
*
)
sqlda
+
offset
;
((
numeric
*
)
sqlda
->
sqlvar
[
i
].
sqldata
)
->
buf
=
(
NumericDigit
*
)
sqlda
+
offset
;
((
numeric
*
)
sqlda
->
sqlvar
[
i
].
sqldata
)
->
digits
=
(
NumericDigit
*
)
sqlda
+
offset
+
(
num
->
digits
-
num
->
buf
);
((
numeric
*
)
sqlda
->
sqlvar
[
i
].
sqldata
)
->
digits
=
(
NumericDigit
*
)
sqlda
+
offset
+
(
num
->
digits
-
num
->
buf
);
}
PGTYPESnumeric_free
(
num
);
PGTYPESnumeric_free
(
num
);
...
@@ -509,7 +513,7 @@ ecpg_set_native_sqlda(int lineno, struct sqlda_struct ** _sqlda, const PGresult
...
@@ -509,7 +513,7 @@ ecpg_set_native_sqlda(int lineno, struct sqlda_struct ** _sqlda, const PGresult
set_data
=
false
;
set_data
=
false
;
ecpg_sqlda_align_add_size
(
offset
,
sizeof
(
int
),
sizeof
(
numeric
),
&
offset
,
&
next_offset
);
ecpg_sqlda_align_add_size
(
offset
,
sizeof
(
NumericDigit
*
),
sizeof
(
numeric
),
&
offset
,
&
next_offset
);
sqlda
->
sqlvar
[
i
].
sqldata
=
(
char
*
)
sqlda
+
offset
;
sqlda
->
sqlvar
[
i
].
sqldata
=
(
char
*
)
sqlda
+
offset
;
sqlda
->
sqlvar
[
i
].
sqllen
=
sizeof
(
numeric
);
sqlda
->
sqlvar
[
i
].
sqllen
=
sizeof
(
numeric
);
...
@@ -529,11 +533,14 @@ ecpg_set_native_sqlda(int lineno, struct sqlda_struct ** _sqlda, const PGresult
...
@@ -529,11 +533,14 @@ ecpg_set_native_sqlda(int lineno, struct sqlda_struct ** _sqlda, const PGresult
memcpy
(
sqlda
->
sqlvar
[
i
].
sqldata
,
num
,
sizeof
(
numeric
));
memcpy
(
sqlda
->
sqlvar
[
i
].
sqldata
,
num
,
sizeof
(
numeric
));
ecpg_sqlda_align_add_size
(
next_offset
,
sizeof
(
int
),
num
->
ndigits
+
1
,
&
offset
,
&
next_offset
);
if
(
num
->
ndigits
)
memcpy
((
char
*
)
sqlda
+
offset
,
num
->
buf
,
num
->
ndigits
+
1
);
{
ecpg_sqlda_align_add_size
(
next_offset
,
sizeof
(
int
),
num
->
ndigits
+
1
,
&
offset
,
&
next_offset
);
memcpy
((
char
*
)
sqlda
+
offset
,
num
->
buf
,
num
->
ndigits
+
1
);
((
numeric
*
)
sqlda
->
sqlvar
[
i
].
sqldata
)
->
buf
=
(
NumericDigit
*
)
sqlda
+
offset
;
((
numeric
*
)
sqlda
->
sqlvar
[
i
].
sqldata
)
->
buf
=
(
NumericDigit
*
)
sqlda
+
offset
;
((
numeric
*
)
sqlda
->
sqlvar
[
i
].
sqldata
)
->
digits
=
(
NumericDigit
*
)
sqlda
+
offset
+
(
num
->
digits
-
num
->
buf
);
((
numeric
*
)
sqlda
->
sqlvar
[
i
].
sqldata
)
->
digits
=
(
NumericDigit
*
)
sqlda
+
offset
+
(
num
->
digits
-
num
->
buf
);
}
PGTYPESnumeric_free
(
num
);
PGTYPESnumeric_free
(
num
);
...
...
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