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
c7fddd30
Commit
c7fddd30
authored
Jul 04, 2003
by
Michael Meskes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
date, interval and timestamp data should be quoted.
parent
23e4fc18
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
10 deletions
+20
-10
src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/ChangeLog
+4
-0
src/interfaces/ecpg/ecpglib/execute.c
src/interfaces/ecpg/ecpglib/execute.c
+7
-7
src/interfaces/ecpg/pgtypeslib/datetime.c
src/interfaces/ecpg/pgtypeslib/datetime.c
+1
-1
src/interfaces/ecpg/test/dt_test.pgc
src/interfaces/ecpg/test/dt_test.pgc
+8
-2
No files found.
src/interfaces/ecpg/ChangeLog
View file @
c7fddd30
...
...
@@ -1546,6 +1546,10 @@ Wed Jul 2 09:45:59 CEST 2003
- Fixed initialization bug in compatlib.
- Added postgres_fe.h to all files in pgtypeslib.
Fri Jul 4 13:51:11 CEST 2003
- date, interval and timestamp data should be quoted.
- Set ecpg version to 3.0.0
- Set ecpg library to 4.0.0
- Set pgtypes library to 1.0.0
...
...
src/interfaces/ecpg/ecpglib/execute.c
View file @
c7fddd30
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.1
5 2003/07/04 11:30:48
meskes Exp $ */
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.1
6 2003/07/04 12:00:52
meskes Exp $ */
/*
* The aim is to get a simpler inteface to the database routines.
...
...
@@ -885,7 +885,7 @@ ECPGstore_input(const struct statement * stmt, const struct variable * var,
{
for
(
element
=
0
;
element
<
var
->
arrsize
;
element
++
)
{
str
=
PGTYPESinterval_to_asc
((
Interval
*
)((
var
+
var
->
offset
*
element
)
->
value
)
);
str
=
quote_postgres
(
PGTYPESinterval_to_asc
((
Interval
*
)((
var
+
var
->
offset
*
element
)
->
value
)),
stmt
->
lineno
);
slen
=
strlen
(
str
);
if
(
!
(
mallocedval
=
ECPGrealloc
(
mallocedval
,
strlen
(
mallocedval
)
+
slen
+
5
,
stmt
->
lineno
)))
...
...
@@ -901,7 +901,7 @@ ECPGstore_input(const struct statement * stmt, const struct variable * var,
}
else
{
str
=
PGTYPESinterval_to_asc
((
Interval
*
)(
var
->
value
)
);
str
=
quote_postgres
(
PGTYPESinterval_to_asc
((
Interval
*
)(
var
->
value
)),
stmt
->
lineno
);
slen
=
strlen
(
str
);
if
(
!
(
mallocedval
=
ECPGalloc
(
slen
+
1
,
stmt
->
lineno
)))
...
...
@@ -926,7 +926,7 @@ ECPGstore_input(const struct statement * stmt, const struct variable * var,
{
for
(
element
=
0
;
element
<
var
->
arrsize
;
element
++
)
{
str
=
PGTYPESdate_to_asc
(
*
(
Date
*
)((
var
+
var
->
offset
*
element
)
->
value
)
);
str
=
quote_postgres
(
PGTYPESdate_to_asc
(
*
(
Date
*
)((
var
+
var
->
offset
*
element
)
->
value
)),
stmt
->
lineno
);
slen
=
strlen
(
str
);
if
(
!
(
mallocedval
=
ECPGrealloc
(
mallocedval
,
strlen
(
mallocedval
)
+
slen
+
5
,
stmt
->
lineno
)))
...
...
@@ -942,7 +942,7 @@ ECPGstore_input(const struct statement * stmt, const struct variable * var,
}
else
{
str
=
PGTYPESdate_to_asc
(
*
(
Date
*
)(
var
->
value
)
);
str
=
quote_postgres
(
PGTYPESdate_to_asc
(
*
(
Date
*
)(
var
->
value
)),
stmt
->
lineno
);
slen
=
strlen
(
str
);
if
(
!
(
mallocedval
=
ECPGalloc
(
slen
+
1
,
stmt
->
lineno
)))
...
...
@@ -967,7 +967,7 @@ ECPGstore_input(const struct statement * stmt, const struct variable * var,
{
for
(
element
=
0
;
element
<
var
->
arrsize
;
element
++
)
{
str
=
PGTYPEStimestamp_to_asc
(
*
(
Timestamp
*
)((
var
+
var
->
offset
*
element
)
->
value
)
);
str
=
quote_postgres
(
PGTYPEStimestamp_to_asc
(
*
(
Timestamp
*
)((
var
+
var
->
offset
*
element
)
->
value
)),
stmt
->
lineno
);
slen
=
strlen
(
str
);
if
(
!
(
mallocedval
=
ECPGrealloc
(
mallocedval
,
strlen
(
mallocedval
)
+
slen
+
5
,
stmt
->
lineno
)))
...
...
@@ -983,7 +983,7 @@ ECPGstore_input(const struct statement * stmt, const struct variable * var,
}
else
{
str
=
PGTYPEStimestamp_to_asc
(
*
(
Timestamp
*
)(
var
->
value
)
);
str
=
quote_postgres
(
PGTYPEStimestamp_to_asc
(
*
(
Timestamp
*
)(
var
->
value
)),
stmt
->
lineno
);
slen
=
strlen
(
str
);
if
(
!
(
mallocedval
=
ECPGalloc
(
slen
+
1
,
stmt
->
lineno
)))
...
...
src/interfaces/ecpg/pgtypeslib/datetime.c
View file @
c7fddd30
...
...
@@ -87,7 +87,7 @@ PGTYPESdate_to_asc(Date dDate)
{
struct
tm
tt
,
*
tm
=
&
tt
;
char
buf
[
MAXDATELEN
+
1
];
int
DateStyle
=
0
;
int
DateStyle
=
1
;
bool
EuroDates
=
FALSE
;
j2date
((
dDate
+
date2j
(
2000
,
1
,
1
)),
&
(
tm
->
tm_year
),
&
(
tm
->
tm_mon
),
&
(
tm
->
tm_mday
));
...
...
src/interfaces/ecpg/test/dt_test.pgc
View file @
c7fddd30
...
...
@@ -17,6 +17,8 @@ main()
Date date2;
int mdy[3] = { 4, 19, 1998 };
char *fmt, *out, *in;
char *d1 = "Mon Jan 17 1966";
char *t1 = "2000-7-12 17:34:29";
FILE *dbgs;
...
...
@@ -25,8 +27,12 @@ main()
exec sql whenever sqlerror do sqlprint();
exec sql connect to mm;
exec sql create table date_test (d date, ts timestamp, iv interval);
exec sql set datestyle to iso;
exec sql insert into date_test(d, ts, iv) values ('Mon Jan 17 1966', '2000-7-12 17:34:29', now()-'Mon Jan 17 1966');
date1 = PGTYPESdate_from_asc(d1, NULL);
ts1 = PGTYPEStimestamp_from_asc(t1, NULL);
exec sql insert into date_test(d, ts, iv) values (:date1, :ts1, now()-'Mon Jan 17 1966');
exec sql select * into :date1, :ts1 , :iv1 from date_test;
...
...
@@ -38,7 +44,7 @@ main()
text = PGTYPESinterval_to_asc(&iv1);
printf ("interval: %s\n", text);
PGTYPESdate_mdyjul(mdy, &date2);
printf("m: %d, d: %d, y: %d\n", mdy[0], mdy[1], mdy[2]);
/* reset */
...
...
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