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
0f0d6765
Commit
0f0d6765
authored
Sep 14, 2006
by
Michael Meskes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added missing constuctor/destructor for interval and date.
parent
f8fe328c
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
79 additions
and
7 deletions
+79
-7
src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/ChangeLog
+5
-0
src/interfaces/ecpg/include/pgtypes_date.h
src/interfaces/ecpg/include/pgtypes_date.h
+3
-1
src/interfaces/ecpg/include/pgtypes_interval.h
src/interfaces/ecpg/include/pgtypes_interval.h
+3
-1
src/interfaces/ecpg/pgtypeslib/datetime.c
src/interfaces/ecpg/pgtypeslib/datetime.c
+16
-1
src/interfaces/ecpg/pgtypeslib/interval.c
src/interfaces/ecpg/pgtypeslib/interval.c
+16
-1
src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.c
src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.c
+17
-2
src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.stdout
src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.stdout
+6
-0
src/interfaces/ecpg/test/pgtypeslib/dt_test2.pgc
src/interfaces/ecpg/test/pgtypeslib/dt_test2.pgc
+13
-1
No files found.
src/interfaces/ecpg/ChangeLog
View file @
0f0d6765
...
...
@@ -2144,5 +2144,10 @@ Tu 5. Sep 11:49:08 CEST 2006
- Fixed port number setting in regression suite.
- Added some interval checks to regression suite.
- Started to cleanup complex tests.
Th 14. Sep 09:47:03 CEST 2006
- Completely removed complex tests.
- Added missing constuctor/destructor for interval and date.
- Set ecpg library version to 5.2.
- Set ecpg version to 4.2.1.
src/interfaces/ecpg/include/pgtypes_date.h
View file @
0f0d6765
/* $PostgreSQL: pgsql/src/interfaces/ecpg/include/pgtypes_date.h,v 1.
9 2006/03/11 04:38:39 momjian
Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/include/pgtypes_date.h,v 1.
10 2006/09/14 08:02:38 meskes
Exp $ */
#ifndef PGTYPES_DATETIME
#define PGTYPES_DATETIME
...
...
@@ -12,6 +12,8 @@ extern "C"
{
#endif
extern
date
*
PGTYPESdate_new
(
void
);
extern
void
PGTYPESdate_free
(
date
*
);
extern
date
PGTYPESdate_from_asc
(
char
*
,
char
**
);
extern
char
*
PGTYPESdate_to_asc
(
date
);
extern
date
PGTYPESdate_from_timestamp
(
timestamp
);
...
...
src/interfaces/ecpg/include/pgtypes_interval.h
View file @
0f0d6765
/* $PostgreSQL: pgsql/src/interfaces/ecpg/include/pgtypes_interval.h,v 1.1
1 2006/08/24 10:48:21
meskes Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/include/pgtypes_interval.h,v 1.1
2 2006/09/14 08:02:38
meskes Exp $ */
#ifndef PGTYPES_INTERVAL
#define PGTYPES_INTERVAL
...
...
@@ -49,6 +49,8 @@ extern "C"
{
#endif
extern
interval
*
PGTYPESinterval_new
(
void
);
extern
void
PGTYPESinterval_free
(
interval
*
);
extern
interval
*
PGTYPESinterval_from_asc
(
char
*
,
char
**
);
extern
char
*
PGTYPESinterval_to_asc
(
interval
*
);
extern
int
PGTYPESinterval_copy
(
interval
*
,
interval
*
);
...
...
src/interfaces/ecpg/pgtypeslib/datetime.c
View file @
0f0d6765
/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/datetime.c,v 1.3
0 2006/08/15 06:40:19
meskes Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/datetime.c,v 1.3
1 2006/09/14 08:02:38
meskes Exp $ */
#include "postgres_fe.h"
...
...
@@ -12,6 +12,21 @@
#include "pgtypes_error.h"
#include "pgtypes_date.h"
date
*
PGTYPESdate_new
(
void
)
{
date
*
result
;
result
=
(
date
*
)
pgtypes_alloc
(
sizeof
(
date
));
/* result can be NULL if we run out of memory */
return
result
;
}
void
PGTYPESdate_free
(
date
*
d
)
{
free
(
d
);
}
date
PGTYPESdate_from_timestamp
(
timestamp
dt
)
{
...
...
src/interfaces/ecpg/pgtypeslib/interval.c
View file @
0f0d6765
/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/interval.c,v 1.3
4 2006/09/05 12:17:09
meskes Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/interval.c,v 1.3
5 2006/09/14 08:02:38
meskes Exp $ */
#include "postgres_fe.h"
#include <time.h>
...
...
@@ -753,6 +753,21 @@ tm2interval(struct tm * tm, fsec_t fsec, interval * span)
return
0
;
}
/* tm2interval() */
interval
*
PGTYPESinterval_new
(
void
)
{
interval
*
result
;
result
=
(
interval
*
)
pgtypes_alloc
(
sizeof
(
interval
));
/* result can be NULL if we run out of memory */
return
result
;
}
void
PGTYPESinterval_free
(
interval
*
intvl
)
{
free
(
intvl
);
}
interval
*
PGTYPESinterval_from_asc
(
char
*
str
,
char
**
endptr
)
{
...
...
src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.c
View file @
0f0d6765
...
...
@@ -70,6 +70,7 @@ main(void)
#line 51 "dt_test2.pgc"
date
date1
;
...
...
@@ -82,8 +83,11 @@ main(void)
#line 54 "dt_test2.pgc"
interval
*
i1
;
/* exec sql end declare section */
#line 55 "dt_test2.pgc"
date
*
dc
;
/* exec sql end declare section */
#line 56 "dt_test2.pgc"
int
i
,
j
;
...
...
@@ -98,9 +102,12 @@ main(void)
free
(
text
);
date1
=
PGTYPESdate_from_timestamp
(
ts1
);
text
=
PGTYPESdate_to_asc
(
date1
);
dc
=
PGTYPESdate_new
();
*
dc
=
date1
;
text
=
PGTYPESdate_to_asc
(
*
dc
);
printf
(
"Date of timestamp: %s
\n
"
,
text
);
free
(
text
);
PGTYPESdate_free
(
dc
);
for
(
i
=
0
;
dates
[
i
];
i
++
)
{
...
...
@@ -139,6 +146,7 @@ main(void)
for
(
i
=
0
;
intervals
[
i
];
i
++
)
{
interval
*
ic
;
i1
=
PGTYPESinterval_from_asc
(
intervals
[
i
],
&
endptr
);
if
(
*
endptr
)
printf
(
"endptr set to %s
\n
"
,
endptr
);
...
...
@@ -153,6 +161,13 @@ main(void)
text
=
PGTYPESinterval_to_asc
(
i1
);
printf
(
"interval[%d]: %s
\n
"
,
i
,
text
?
text
:
"-"
);
free
(
text
);
ic
=
PGTYPESinterval_new
();
PGTYPESinterval_copy
(
i1
,
ic
);
text
=
PGTYPESinterval_to_asc
(
i1
);
printf
(
"interval_copy[%d]: %s
\n
"
,
i
,
text
?
text
:
"-"
);
free
(
text
);
PGTYPESinterval_free
(
ic
);
}
return
(
0
);
...
...
src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.stdout
View file @
0f0d6765
...
...
@@ -88,9 +88,15 @@ TS[19,0]: 0099-01-08 00:04:00 BC
TS[19,1]: 0099-01-08 01:59:00 BC
TS[19,2]: 0099-01-08 13:24:40 BC
interval[0]: @ 1 min
interval_copy[0]: @ 1 min
interval[1]: @ 1 day 12 hours 59 mins 10 secs
interval_copy[1]: @ 1 day 12 hours 59 mins 10 secs
interval[2]: @ 2 days 12 hours 59 mins 10 secs
interval_copy[2]: @ 2 days 12 hours 59 mins 10 secs
interval[3]: @ 1 day 12 hours 59 mins 10 secs
interval_copy[3]: @ 1 day 12 hours 59 mins 10 secs
interval[4]: @ 1 day 1 hour 1 min 1 sec
interval_copy[4]: @ 1 day 1 hour 1 min 1 sec
interval[5]: @ 1 year 59 mins
interval_copy[5]: @ 1 year 59 mins
Error parsing interval 6
src/interfaces/ecpg/test/pgtypeslib/dt_test2.pgc
View file @
0f0d6765
...
...
@@ -52,6 +52,7 @@ main(void)
timestamp ts1, ts2;
char *text;
interval *i1;
date *dc;
exec sql end declare section;
int i, j;
...
...
@@ -66,9 +67,12 @@ main(void)
free(text);
date1 = PGTYPESdate_from_timestamp(ts1);
text = PGTYPESdate_to_asc(date1);
dc = PGTYPESdate_new();
*dc = date1;
text = PGTYPESdate_to_asc(*dc);
printf("Date of timestamp: %s\n", text);
free(text);
PGTYPESdate_free(dc);
for (i = 0; dates[i]; i++)
{
...
...
@@ -107,6 +111,7 @@ main(void)
for (i = 0; intervals[i]; i++)
{
interval *ic;
i1 = PGTYPESinterval_from_asc(intervals[i], &endptr);
if (*endptr)
printf("endptr set to %s\n", endptr);
...
...
@@ -121,6 +126,13 @@ main(void)
text = PGTYPESinterval_to_asc(i1);
printf("interval[%d]: %s\n", i, text ? text : "-");
free(text);
ic = PGTYPESinterval_new();
PGTYPESinterval_copy(i1, ic);
text = PGTYPESinterval_to_asc(i1);
printf("interval_copy[%d]: %s\n", i, text ? text : "-");
free(text);
PGTYPESinterval_free(ic);
}
return (0);
...
...
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