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
7845954e
Commit
7845954e
authored
Nov 16, 2001
by
Michael Meskes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed again to add the missing files/patches.
parent
949af991
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
181 additions
and
149 deletions
+181
-149
src/interfaces/ecpg/preproc/extern.h
src/interfaces/ecpg/preproc/extern.h
+1
-1
src/interfaces/ecpg/preproc/preproc.y
src/interfaces/ecpg/preproc/preproc.y
+123
-141
src/interfaces/ecpg/preproc/variable.c
src/interfaces/ecpg/preproc/variable.c
+24
-7
src/interfaces/ecpg/test/testdynalloc.pgc
src/interfaces/ecpg/test/testdynalloc.pgc
+33
-0
No files found.
src/interfaces/ecpg/preproc/extern.h
View file @
7845954e
...
...
@@ -71,7 +71,7 @@ extern void add_variable(struct arguments **, struct variable *, struct variable
extern
void
append_variable
(
struct
arguments
**
,
struct
variable
*
,
struct
variable
*
);
extern
void
dump_variables
(
struct
arguments
*
,
int
);
extern
struct
typedefs
*
get_typedef
(
char
*
);
extern
void
adjust_array
(
enum
ECPGttype
,
int
*
,
int
*
,
int
,
int
,
bool
);
extern
void
adjust_array
(
enum
ECPGttype
,
int
*
,
int
*
,
int
,
int
,
int
);
extern
void
reset_variables
(
void
);
extern
void
check_indicator
(
struct
ECPGtype
*
);
extern
void
remove_variables
(
int
);
...
...
src/interfaces/ecpg/preproc/preproc.y
View file @
7845954e
This diff is collapsed.
Click to expand it.
src/interfaces/ecpg/preproc/variable.c
View file @
7845954e
...
...
@@ -298,7 +298,7 @@ get_typedef(char *name)
}
void
adjust_array
(
enum
ECPGttype
type_enum
,
int
*
dimension
,
int
*
length
,
int
type_dimension
,
int
type_index
,
bool
pointer
)
adjust_array
(
enum
ECPGttype
type_enum
,
int
*
dimension
,
int
*
length
,
int
type_dimension
,
int
type_index
,
int
pointer_len
)
{
if
(
type_index
>=
0
)
{
...
...
@@ -318,8 +318,19 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
*
dimension
=
type_dimension
;
}
if
(
pointer_len
>
2
)
{
sprintf
(
errortext
,
"No multilevel (more than 2) pointer supported %d"
,
pointer_len
);
mmerror
(
ET_FATAL
,
errortext
);
// mmerror(ET_FATAL, "No multilevel (more than 2) pointer supported %d",pointer_len);
}
if
(
pointer_len
>
1
&&
type_enum
!=
ECPGt_char
&&
type_enum
!=
ECPGt_unsigned_char
)
mmerror
(
ET_FATAL
,
"No pointer to pointer supported for this type"
);
if
(
pointer_len
>
1
&&
(
*
length
>=
0
||
*
dimension
>=
0
))
mmerror
(
ET_FATAL
,
"No multi-dimensional array support"
);
if
(
*
length
>=
0
&&
*
dimension
>=
0
&&
pointer
)
if
(
*
length
>=
0
&&
*
dimension
>=
0
&&
pointer
_len
)
mmerror
(
ET_FATAL
,
"No multi-dimensional array support"
);
switch
(
type_enum
)
...
...
@@ -327,7 +338,7 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
case
ECPGt_struct
:
case
ECPGt_union
:
/* pointer has to get dimension 0 */
if
(
pointer
)
if
(
pointer
_len
)
{
*
length
=
*
dimension
;
*
dimension
=
0
;
...
...
@@ -339,7 +350,7 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
break
;
case
ECPGt_varchar
:
/* pointer has to get dimension 0 */
if
(
pointer
)
if
(
pointer
_len
)
*
dimension
=
0
;
/* one index is the string length */
...
...
@@ -352,8 +363,15 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
break
;
case
ECPGt_char
:
case
ECPGt_unsigned_char
:
/* char ** */
if
(
pointer_len
==
2
)
{
*
length
=
*
dimension
=
0
;
break
;
}
/* pointer has to get length 0 */
if
(
pointer
)
if
(
pointer
_len
==
1
)
*
length
=
0
;
/* one index is the string length */
...
...
@@ -362,11 +380,10 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
*
length
=
(
*
dimension
<
0
)
?
1
:
*
dimension
;
*
dimension
=
-
1
;
}
break
;
default:
/* a pointer has dimension = 0 */
if
(
pointer
)
if
(
pointer
_len
)
{
*
length
=
*
dimension
;
*
dimension
=
0
;
...
...
src/interfaces/ecpg/test/testdynalloc.pgc
0 → 100644
View file @
7845954e
#include <stdio.h>
exec sql include sqlca;
#include <stdlib.h>
int main()
{
exec sql begin declare section;
char **cpp=0;
int *ipointer=0;
exec sql end declare section;
int i;
if (getenv("SQLOPT")) ECPGdebug(1,stderr);
exec sql whenever sqlerror do sqlprint();
exec sql connect to template1;
exec sql allocate descriptor mydesc;
exec sql select tablename into descriptor mydesc from pg_tables;
exec sql get descriptor mydesc value 1 :cpp=DATA, :ipointer=INDICATOR;
printf("Result ");
for (i=0;i<sqlca.sqlerrd[2];++i)
{ if (ipointer[i]) printf("NULL, ");
else printf("'%s', ",cpp[i]);
}
ECPGfree_auto_mem();
printf("\n");
exec sql deallocate descriptor mydesc;
exec sql disconnect;
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