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
c9ecf3d1
Commit
c9ecf3d1
authored
Jan 31, 2001
by
Michael Meskes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Applied two bug fixes by Christof Petig.
parent
234599e9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
92 additions
and
46 deletions
+92
-46
src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/ChangeLog
+4
-0
src/interfaces/ecpg/lib/execute.c
src/interfaces/ecpg/lib/execute.c
+63
-45
src/interfaces/ecpg/test/Makefile
src/interfaces/ecpg/test/Makefile
+2
-1
src/interfaces/ecpg/test/test_text.pgc
src/interfaces/ecpg/test/test_text.pgc
+23
-0
No files found.
src/interfaces/ecpg/ChangeLog
View file @
c9ecf3d1
...
...
@@ -1047,5 +1047,9 @@ Tue Jan 23 08:54:14 CET 2001
Thu Jan 25 21:14:38 CET 2001
- Synced gram.y and preproc.y.
Wed Jan 31 17:11:04 CET 2001
- Added two bug fixes by Christof Petig.
- Set ecpg version to 2.8.0.
- Set library version to 3.2.0.
src/interfaces/ecpg/lib/execute.c
View file @
c9ecf3d1
...
...
@@ -288,48 +288,52 @@ ECPGis_type_an_array(int type,const struct statement * stmt,const struct variabl
if
((
stmt
->
connection
->
cache_head
)
==
NULL
)
{
/* Text like types are not an array for ecpg, but postgres counts them as
an array. This define reminds you to not 'correct' these values. */
#define not_an_array_in_ecpg false
/* populate cache with well known types to speed things up */
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
BOOLOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
BYTEAOID
,
true
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
CHAROID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
NAMEOID
,
true
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
INT8OID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
INT2OID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
INT2VECTOROID
,
true
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
INT4OID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
REGPROCOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
TEXTOID
,
true
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
OIDOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
TIDOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
XIDOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
CIDOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
OIDVECTOROID
,
true
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
POINTOID
,
true
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
LSEGOID
,
true
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
PATHOID
,
true
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
BOXOID
,
true
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
POLYGONOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
LINEOID
,
true
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
FLOAT4OID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
FLOAT8OID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
ABSTIMEOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
RELTIMEOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
TINTERVALOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
UNKNOWNOID
,
true
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
CIRCLEOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
CASHOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
INETOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
CIDROID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
BPCHAROID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
VARCHAROID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
DATEOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
TIMEOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
TIMESTAMPOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
INTERVALOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
TIMETZOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
ZPBITOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
VARBITOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
NUMERICOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
BOOLOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
BYTEAOID
,
not_an_array_in_ecpg
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
CHAROID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
NAMEOID
,
not_an_array_in_ecpg
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
INT8OID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
INT2OID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
INT2VECTOROID
,
true
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
INT4OID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
REGPROCOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
TEXTOID
,
not_an_array_in_ecpg
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
OIDOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
TIDOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
XIDOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
CIDOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
OIDVECTOROID
,
true
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
POINTOID
,
true
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
LSEGOID
,
true
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
PATHOID
,
not_an_array_in_ecpg
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
BOXOID
,
true
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
POLYGONOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
LINEOID
,
true
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
FLOAT4OID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
FLOAT8OID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
ABSTIMEOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
RELTIMEOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
TINTERVALOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
UNKNOWNOID
,
not_an_array_in_ecpg
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
CIRCLEOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
CASHOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
INETOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
CIDROID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
BPCHAROID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
VARCHAROID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
DATEOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
TIMEOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
TIMESTAMPOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
INTERVALOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
TIMETZOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
ZPBITOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
VARBITOID
,
false
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
NUMERICOID
,
false
,
stmt
->
lineno
);
}
for
(
cache_entry
=
(
stmt
->
connection
->
cache_head
);
cache_entry
!=
NULL
;
cache_entry
=
cache_entry
->
next
)
...
...
@@ -630,13 +634,27 @@ ECPGexecute(struct statement * stmt)
{
strncpy
(
mallocedval
,
"'{"
,
sizeof
(
"'{"
));
for
(
element
=
0
;
element
<
var
->
arrsize
;
element
++
)
sprintf
(
mallocedval
+
strlen
(
mallocedval
),
"%c,"
,
(((
char
*
)
var
->
value
)[
element
])
?
't'
:
'f'
);
if
(
var
->
offset
==
sizeof
(
char
))
for
(
element
=
0
;
element
<
var
->
arrsize
;
element
++
)
sprintf
(
mallocedval
+
strlen
(
mallocedval
),
"%c,"
,
(((
char
*
)
var
->
value
)[
element
])
?
't'
:
'f'
);
// this is necessary since sizeof(C++'s bool)==sizeof(int)
else
if
(
var
->
offset
==
sizeof
(
int
))
for
(
element
=
0
;
element
<
var
->
arrsize
;
element
++
)
sprintf
(
mallocedval
+
strlen
(
mallocedval
),
"%c,"
,
(((
int
*
)
var
->
value
)[
element
])
?
't'
:
'f'
);
else
ECPGraise
(
stmt
->
lineno
,
ECPG_CONVERT_BOOL
,
"different size"
);
strncpy
(
mallocedval
+
strlen
(
mallocedval
)
-
1
,
"}'"
,
sizeof
(
"}'"
));
}
else
sprintf
(
mallocedval
,
"'%c'"
,
(
*
((
char
*
)
var
->
value
))
?
't'
:
'f'
);
{
if
(
var
->
offset
==
sizeof
(
char
))
sprintf
(
mallocedval
,
"'%c'"
,
(
*
((
char
*
)
var
->
value
))
?
't'
:
'f'
);
else
if
(
var
->
offset
==
sizeof
(
int
))
sprintf
(
mallocedval
,
"'%c'"
,
(
*
((
int
*
)
var
->
value
))
?
't'
:
'f'
);
else
ECPGraise
(
stmt
->
lineno
,
ECPG_CONVERT_BOOL
,
"different size"
);
}
tobeinserted
=
mallocedval
;
break
;
...
...
@@ -1006,7 +1024,7 @@ ECPGdo(int lineno, const char *connection_name, char *query,...)
*
* Copyright (c) 2000, Christof Petig <christof.petig@wtal.de>
*
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.1
6 2001/01/02 22:03:02 momjian
Exp $
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.1
7 2001/01/31 16:12:34 meskes
Exp $
*/
PGconn
*
ECPG_internal_get_connection
(
char
*
name
);
...
...
src/interfaces/ecpg/test/Makefile
View file @
c9ecf3d1
...
...
@@ -18,9 +18,10 @@ dyntest2: dyntest2.c
test_code100
:
test_code100.c
test_notice
:
test_notice.c
test_init
:
test_init.c
test_text
:
test_text.c
.pgc.c
:
$(ECPG)
$?
clean
:
rm
-f
test1 test2 test3 test4 perftest
*
.c log dyntest dyntest2 test_notice test_code100 test_init
rm
-f
test1 test2 test3 test4 perftest
*
.c log dyntest dyntest2 test_notice test_code100 test_init
test_text
src/interfaces/ecpg/test/test_text.pgc
0 → 100644
View file @
c9ecf3d1
// $Id: test_text.pgc,v 1.1 2001/01/31 16:12:34 meskes Exp $
exec sql include sqlca;
#include <stdio.h>
int main(int argc, char **argv)
{ exec sql begin declare section;
int index;
char lab[15];
exec sql end declare section;
ECPGdebug(1,stdout);
exec sql connect to mm;
if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
exec sql select 'a1234567890'::text into :lab;
if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
exec sql disconnect;
if (sqlca.sqlcode) printf("%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
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