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
135ecf8d
Commit
135ecf8d
authored
Nov 10, 2003
by
Michael Meskes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Re-added forgotten cache.
parent
7da19cac
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
106 deletions
+78
-106
src/interfaces/ecpg/ecpglib/execute.c
src/interfaces/ecpg/ecpglib/execute.c
+78
-106
No files found.
src/interfaces/ecpg/ecpglib/execute.c
View file @
135ecf8d
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.2
7 2003/11/08 19:46:27
meskes Exp $ */
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.2
8 2003/11/10 20:28:30
meskes Exp $ */
/*
* The aim is to get a simpler inteface to the database routines.
...
...
@@ -230,12 +230,25 @@ next_insert(char *text)
return
(
*
ptr
==
'\0'
)
?
NULL
:
ptr
;
}
static
void
ECPGtypeinfocache_push
(
struct
ECPGtype_information_cache
**
cache
,
int
oid
,
bool
isarray
,
int
lineno
)
{
struct
ECPGtype_information_cache
*
new_entry
=
(
struct
ECPGtype_information_cache
*
)
ECPGalloc
(
sizeof
(
struct
ECPGtype_information_cache
),
lineno
);
new_entry
->
oid
=
oid
;
new_entry
->
isarray
=
isarray
;
new_entry
->
next
=
*
cache
;
*
cache
=
new_entry
;
}
static
enum
ARRAY_TYPE
ECPGis_type_an_array
(
int
type
,
const
struct
statement
*
stmt
,
const
struct
variable
*
var
)
{
char
*
array_query
;
enum
ARRAY_TYPE
isarray
=
ECPG_ARRAY_NOT_SET
;
PGresult
*
query
;
struct
ECPGtype_information_cache
*
cache_entry
;
if
((
stmt
->
connection
->
cache_head
)
==
NULL
)
{
...
...
@@ -246,98 +259,57 @@ ECPGis_type_an_array(int type, const struct statement * stmt, const struct varia
*/
#define not_an_array_in_ecpg ECPG_ARRAY_NONE
switch
(
type
)
{
case
BOOLOID
:
isarray
=
ECPG_ARRAY_NONE
;
break
;
case
BYTEAOID
:
isarray
=
ECPG_ARRAY_NONE
;
break
;
case
CHAROID
:
isarray
=
ECPG_ARRAY_NONE
;
break
;
case
NAMEOID
:
isarray
=
not_an_array_in_ecpg
;
break
;
case
INT8OID
:
isarray
=
ECPG_ARRAY_NONE
;
break
;
case
INT2OID
:
isarray
=
ECPG_ARRAY_NONE
;
break
;
case
INT2VECTOROID
:
isarray
=
ECPG_ARRAY_VECTOR
;
break
;
case
INT4OID
:
isarray
=
ECPG_ARRAY_NONE
;
break
;
case
REGPROCOID
:
isarray
=
ECPG_ARRAY_NONE
;
break
;
case
TEXTOID
:
isarray
=
ECPG_ARRAY_NONE
;
break
;
case
OIDOID
:
isarray
=
ECPG_ARRAY_NONE
;
break
;
case
TIDOID
:
isarray
=
ECPG_ARRAY_NONE
;
break
;
case
XIDOID
:
isarray
=
ECPG_ARRAY_NONE
;
break
;
case
CIDOID
:
isarray
=
ECPG_ARRAY_NONE
;
break
;
case
OIDVECTOROID
:
isarray
=
ECPG_ARRAY_VECTOR
;
break
;
case
POINTOID
:
isarray
=
ECPG_ARRAY_VECTOR
;
break
;
case
LSEGOID
:
isarray
=
ECPG_ARRAY_VECTOR
;
break
;
case
PATHOID
:
isarray
=
ECPG_ARRAY_NONE
;
break
;
case
BOXOID
:
isarray
=
ECPG_ARRAY_VECTOR
;
break
;
case
POLYGONOID
:
isarray
=
ECPG_ARRAY_NONE
;
break
;
case
LINEOID
:
isarray
=
ECPG_ARRAY_VECTOR
;
break
;
case
FLOAT4OID
:
isarray
=
ECPG_ARRAY_NONE
;
break
;
case
FLOAT8OID
:
isarray
=
ECPG_ARRAY_NONE
;
break
;
case
ABSTIMEOID
:
isarray
=
ECPG_ARRAY_NONE
;
break
;
case
RELTIMEOID
:
isarray
=
ECPG_ARRAY_NONE
;
break
;
case
TINTERVALOID
:
isarray
=
ECPG_ARRAY_NONE
;
break
;
case
UNKNOWNOID
:
isarray
=
ECPG_ARRAY_NONE
;
break
;
case
CIRCLEOID
:
isarray
=
ECPG_ARRAY_NONE
;
break
;
case
CASHOID
:
isarray
=
ECPG_ARRAY_NONE
;
break
;
case
INETOID
:
isarray
=
ECPG_ARRAY_NONE
;
break
;
case
CIDROID
:
isarray
=
ECPG_ARRAY_NONE
;
break
;
case
BPCHAROID
:
isarray
=
ECPG_ARRAY_NONE
;
break
;
case
VARCHAROID
:
isarray
=
ECPG_ARRAY_NONE
;
break
;
case
DATEOID
:
isarray
=
ECPG_ARRAY_NONE
;
break
;
case
TIMEOID
:
isarray
=
ECPG_ARRAY_NONE
;
break
;
case
TIMESTAMPOID
:
isarray
=
ECPG_ARRAY_NONE
;
break
;
case
TIMESTAMPTZOID
:
isarray
=
ECPG_ARRAY_NONE
;
break
;
case
INTERVALOID
:
isarray
=
ECPG_ARRAY_NONE
;
break
;
case
TIMETZOID
:
isarray
=
ECPG_ARRAY_NONE
;
break
;
case
ZPBITOID
:
isarray
=
ECPG_ARRAY_NONE
;
break
;
case
VARBITOID
:
isarray
=
ECPG_ARRAY_NONE
;
break
;
case
NUMERICOID
:
isarray
=
ECPG_ARRAY_NONE
;
break
;
default:
break
;
}
/* populate cache with well known types to speed things up */
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
BOOLOID
,
ECPG_ARRAY_NONE
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
BYTEAOID
,
ECPG_ARRAY_NONE
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
CHAROID
,
ECPG_ARRAY_NONE
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
NAMEOID
,
not_an_array_in_ecpg
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
INT8OID
,
ECPG_ARRAY_NONE
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
INT2OID
,
ECPG_ARRAY_NONE
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
INT2VECTOROID
,
ECPG_ARRAY_VECTOR
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
INT4OID
,
ECPG_ARRAY_NONE
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
REGPROCOID
,
ECPG_ARRAY_NONE
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
TEXTOID
,
ECPG_ARRAY_NONE
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
OIDOID
,
ECPG_ARRAY_NONE
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
TIDOID
,
ECPG_ARRAY_NONE
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
XIDOID
,
ECPG_ARRAY_NONE
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
CIDOID
,
ECPG_ARRAY_NONE
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
OIDVECTOROID
,
ECPG_ARRAY_VECTOR
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
POINTOID
,
ECPG_ARRAY_VECTOR
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
LSEGOID
,
ECPG_ARRAY_VECTOR
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
PATHOID
,
ECPG_ARRAY_NONE
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
BOXOID
,
ECPG_ARRAY_VECTOR
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
POLYGONOID
,
ECPG_ARRAY_NONE
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
LINEOID
,
ECPG_ARRAY_VECTOR
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
FLOAT4OID
,
ECPG_ARRAY_NONE
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
FLOAT8OID
,
ECPG_ARRAY_NONE
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
ABSTIMEOID
,
ECPG_ARRAY_NONE
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
RELTIMEOID
,
ECPG_ARRAY_NONE
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
TINTERVALOID
,
ECPG_ARRAY_NONE
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
UNKNOWNOID
,
ECPG_ARRAY_NONE
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
CIRCLEOID
,
ECPG_ARRAY_NONE
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
CASHOID
,
ECPG_ARRAY_NONE
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
INETOID
,
ECPG_ARRAY_NONE
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
CIDROID
,
ECPG_ARRAY_NONE
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
BPCHAROID
,
ECPG_ARRAY_NONE
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
VARCHAROID
,
ECPG_ARRAY_NONE
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
DATEOID
,
ECPG_ARRAY_NONE
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
TIMEOID
,
ECPG_ARRAY_NONE
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
TIMESTAMPOID
,
ECPG_ARRAY_NONE
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
TIMESTAMPTZOID
,
ECPG_ARRAY_NONE
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
INTERVALOID
,
ECPG_ARRAY_NONE
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
TIMETZOID
,
ECPG_ARRAY_NONE
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
ZPBITOID
,
ECPG_ARRAY_NONE
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
VARBITOID
,
ECPG_ARRAY_NONE
,
stmt
->
lineno
);
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
NUMERICOID
,
ECPG_ARRAY_NONE
,
stmt
->
lineno
);
}
for
(
cache_entry
=
(
stmt
->
connection
->
cache_head
);
cache_entry
!=
NULL
;
cache_entry
=
cache_entry
->
next
)
{
if
(
cache_entry
->
oid
==
type
)
return
cache_entry
->
isarray
;
}
if
(
isarray
==
ECPG_ARRAY_NOT_SET
)
{
array_query
=
(
char
*
)
ECPGalloc
(
strlen
(
"select typlen from pg_type where oid= and typelem<>0"
)
+
11
,
stmt
->
lineno
);
sprintf
(
array_query
,
"select typlen from pg_type where oid=%d and typelem<>0"
,
type
);
query
=
PQexec
(
stmt
->
connection
->
connection
,
array_query
);
...
...
@@ -355,7 +327,7 @@ ECPGis_type_an_array(int type, const struct statement * stmt, const struct varia
}
}
PQclear
(
query
);
}
ECPGtypeinfocache_push
(
&
(
stmt
->
connection
->
cache_head
),
type
,
isarray
,
stmt
->
lineno
);
ECPGlog
(
"ECPGexecute line %d: TYPE database: %d C: %d array: %d
\n
"
,
stmt
->
lineno
,
type
,
var
->
type
,
isarray
);
return
isarray
;
}
...
...
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