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
9992f2b1
Commit
9992f2b1
authored
Dec 06, 2001
by
Michael Meskes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Removed debug message from preproc.y.
- Fixed some bugs in exec sql var and exec sql type command.
parent
fe933d6a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
112 additions
and
119 deletions
+112
-119
src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/ChangeLog
+6
-1
src/interfaces/ecpg/preproc/preproc.y
src/interfaces/ecpg/preproc/preproc.y
+98
-87
src/interfaces/ecpg/test/test2.pgc
src/interfaces/ecpg/test/test2.pgc
+4
-4
src/interfaces/ecpg/test/test3.pgc
src/interfaces/ecpg/test/test3.pgc
+4
-4
src/interfaces/ecpg/test/test_text.pgc
src/interfaces/ecpg/test/test_text.pgc
+0
-23
No files found.
src/interfaces/ecpg/ChangeLog
View file @
9992f2b1
...
...
@@ -1160,6 +1160,11 @@ Wed Dec 5 12:27:25 CET 2001
- Fixed variable handling in AT statement.
- Fixed bug that caused segfault when given incorrect DB name.
- Fixed bug in ecpglib causing indicator to list the size of the
variable instead of the size of the data.
variable instead of the size of the data
Thu Dec 6 14:02:56 CET 2001
- Removed debug message from preproc.y.
- Fixed some bugs in exec sql var and exec sql type command.
- Set ecpg version to 2.9.0.
- Set library version to 3.3.0.
src/interfaces/ecpg/preproc/preproc.y
View file @
9992f2b1
...
...
@@ -3886,7 +3886,6 @@ connection_target: database_name opt_server opt_port
| db_prefix ':' server opt_port '/' database_name opt_options
{
/* new style: <tcp|unix>:postgresql://server[:port][/dbname] */
printf("%s\n", $1);
if (strncmp($1, "unix:postgresql", strlen("unix:postgresql")) != 0 && strncmp($1, "tcp:postgresql", strlen("tcp:postgresql")) != 0)
{
sprintf(errortext, "only protocols 'tcp' and 'unix' and database type 'postgresql' are supported");
...
...
@@ -4271,10 +4270,6 @@ s_struct: SQL_STRUCT opt_symbol
if (struct_level >= STRUCT_DEPTH)
mmerror(ET_ERROR, "Too many levels in nested structure definition");
/* reset this variable so we see if there was */
/* an initializer specified */
initializer = 0;
$$ = cat2_str(make_str("struct"), $2);
};
...
...
@@ -4284,10 +4279,6 @@ s_union: UNION opt_symbol
if (struct_level >= STRUCT_DEPTH)
mmerror(ET_ERROR, "Too many levels in nested structure definition");
/* reset this variable so we see if there was */
/* an initializer specified */
initializer = 0;
$$ = cat2_str(make_str("union"), $2);
};
...
...
@@ -4661,52 +4652,62 @@ ECPGSetConnection: SET SQL_CONNECTION to_equal connection_object
/*
* define a new type for embedded SQL
*/
ECPGTypedef: TYPE_P ColLabel IS type opt_type_array_bounds opt_reference
ECPGTypedef: TYPE_P
{
/* reset this variable so we see if there was */
/* an initializer specified */
initializer = 0;
}
ColLabel IS type opt_type_array_bounds opt_reference
{
/* add entry to list */
struct typedefs *ptr, *this;
int dimension = $
5
.index1;
int length = $
5
.index2;
int dimension = $
6
.index1;
int length = $
6
.index2;
if (($
4
.type_enum == ECPGt_struct ||
$
4
.type_enum == ECPGt_union) &&
if (($
5
.type_enum == ECPGt_struct ||
$
5
.type_enum == ECPGt_union) &&
initializer == 1)
{
mmerror(ET_ERROR, "Initializer not allowed in EXEC SQL VAR command");
for (ptr = types; ptr != NULL; ptr = ptr->next)
}
else
{
if (strcmp($2, ptr->name) == 0
)
for (ptr = types; ptr != NULL; ptr = ptr->next
)
{
/* re-definition is a bug */
sprintf(errortext, "Type %s already defined", $2);
mmerror(ET_ERROR, errortext);
}
}
if (strcmp($3, ptr->name) == 0)
{
/* re-definition is a bug */
sprintf(errortext, "Type %s already defined", $3);
mmerror(ET_ERROR, errortext);
}
}
adjust_array($4.type_enum, &dimension, &length, $4.type_dimension, $4.type_index, *$6
?1:0);
adjust_array($5.type_enum, &dimension, &length, $5.type_dimension, $5.type_index, *$7
?1:0);
this = (struct typedefs *) mm_alloc(sizeof(struct typedefs));
this = (struct typedefs *) mm_alloc(sizeof(struct typedefs));
/* initial definition */
this->next = types;
this->name = $2
;
this->type = (struct this_type *) mm_alloc(sizeof(struct this_type));
this->type->type_enum = $4
.type_enum;
this->type->type_str = mm_strdup($2
);
this->type->type_dimension = dimension; /* dimension of array */
this->type->type_index = length; /* lenght of string */
this->struct_member_list = ($4.type_enum == ECPGt_struct || $4
.type_enum == ECPGt_union) ?
struct_member_list[struct_level] : NULL;
/* initial definition */
this->next = types;
this->name = $3
;
this->type = (struct this_type *) mm_alloc(sizeof(struct this_type));
this->type->type_enum = $5
.type_enum;
this->type->type_str = mm_strdup($3
);
this->type->type_dimension = dimension; /* dimension of array */
this->type->type_index = length; /* lenght of string */
this->struct_member_list = ($5.type_enum == ECPGt_struct || $5
.type_enum == ECPGt_union) ?
struct_member_list[struct_level] : NULL;
if ($4
.type_enum != ECPGt_varchar &&
$4
.type_enum != ECPGt_char &&
$4
.type_enum != ECPGt_unsigned_char &&
this->type->type_index >= 0)
mmerror(ET_ERROR, "No multi-dimensional array support for simple data types");
if ($5
.type_enum != ECPGt_varchar &&
$5
.type_enum != ECPGt_char &&
$5
.type_enum != ECPGt_unsigned_char &&
this->type->type_index >= 0)
mmerror(ET_ERROR, "No multi-dimensional array support for simple data types");
types = this;
types = this;
}
$$ = cat_str(7, make_str("/* exec sql type"), mm_strdup($
2), make_str("is"), mm_strdup($4.type_str), mm_strdup($5.str), $6
, make_str("*/"));
$$ = cat_str(7, make_str("/* exec sql type"), mm_strdup($
3), make_str("is"), mm_strdup($5.type_str), mm_strdup($6.str), $7
, make_str("*/"));
};
opt_type_array_bounds: '[' ']' opt_type_array_bounds
...
...
@@ -4754,60 +4755,70 @@ opt_reference: SQL_REFERENCE { $$ = make_str("reference"); }
/*
* define the type of one variable for embedded SQL
*/
ECPGVar: SQL_VAR
ColLabel IS type opt_type_array_bounds opt_reference
ECPGVar: SQL_VAR
{
struct variable *p = find_variable($2);
int dimension = $5.index1;
int length = $5.index2;
/* reset this variable so we see if there was */
/* an initializer specified */
initializer = 0;
}
ColLabel IS type opt_type_array_bounds opt_reference
{
struct variable *p = find_variable($3);
int dimension = $6.index1;
int length = $6.index2;
struct ECPGtype * type;
if (($
4
.type_enum == ECPGt_struct ||
$
4
.type_enum == ECPGt_union) &&
if (($
5
.type_enum == ECPGt_struct ||
$
5
.type_enum == ECPGt_union) &&
initializer == 1)
{
mmerror(ET_ERROR, "Initializer not allowed in EXEC SQL VAR command");
adjust_array($4.type_enum, &dimension, &length, $4.type_dimension, $4.type_index, *$6?1:0);
switch ($4.type_enum)
}
else
{
case ECPGt_struct:
case ECPGt_union:
if (dimension < 0)
type = ECPGmake_struct_type(struct_member_list[struct_level], $4.type_enum);
else
type = ECPGmake_array_type(ECPGmake_struct_type(struct_member_list[struct_level], $4.type_enum), dimension);
break;
case ECPGt_varchar:
if (dimension == -1)
type = ECPGmake_simple_type($4.type_enum, length);
else
type = ECPGmake_array_type(ECPGmake_simple_type($4.type_enum, length), dimension);
break;
case ECPGt_char:
case ECPGt_unsigned_char:
if (dimension == -1)
type = ECPGmake_simple_type($4.type_enum, length);
else
type = ECPGmake_array_type(ECPGmake_simple_type($4.type_enum, length), dimension);
break;
default:
if (length >= 0)
mmerror(ET_ERROR, "No multi-dimensional array support for simple data types");
adjust_array($5.type_enum, &dimension, &length, $5.type_dimension, $5.type_index, *$7?1:0);
if (dimension < 0)
type = ECPGmake_simple_type($4.type_enum, 1);
else
type = ECPGmake_array_type(ECPGmake_simple_type($4.type_enum, 1), dimension);
break;
}
ECPGfree_type(p->type);
p->type = type;
switch ($5.type_enum)
{
case ECPGt_struct:
case ECPGt_union:
if (dimension < 0)
type = ECPGmake_struct_type(struct_member_list[struct_level], $5.type_enum);
else
type = ECPGmake_array_type(ECPGmake_struct_type(struct_member_list[struct_level], $5.type_enum), dimension);
break;
case ECPGt_varchar:
if (dimension == -1)
type = ECPGmake_simple_type($5.type_enum, length);
else
type = ECPGmake_array_type(ECPGmake_simple_type($5.type_enum, length), dimension);
break;
case ECPGt_char:
case ECPGt_unsigned_char:
if (dimension == -1)
type = ECPGmake_simple_type($5.type_enum, length);
else
type = ECPGmake_array_type(ECPGmake_simple_type($5.type_enum, length), dimension);
break;
default:
if (length >= 0)
mmerror(ET_ERROR, "No multi-dimensional array support for simple data types");
if (dimension < 0)
type = ECPGmake_simple_type($5.type_enum, 1);
else
type = ECPGmake_array_type(ECPGmake_simple_type($5.type_enum, 1), dimension);
break;
}
ECPGfree_type(p->type);
p->type = type;
}
$$ = cat_str(7, make_str("/* exec sql var"), mm_strdup($
2), make_str("is"), mm_strdup($4.type_str), mm_strdup($5.str), $6
, make_str("*/"));
$$ = cat_str(7, make_str("/* exec sql var"), mm_strdup($
3), make_str("is"), mm_strdup($5.type_str), mm_strdup($6.str), $7
, make_str("*/"));
};
/*
...
...
src/interfaces/ecpg/test/test2.pgc
View file @
9992f2b1
...
...
@@ -50,10 +50,10 @@ exec sql end declare section;
strcpy(msg, "insert");
exec sql insert into meskes(name, married, children) values ('Petra', '19900404', 3);
exec sql insert into meskes(name, born, age, married, children) values ('Michael', 19660117, 3
4
, '19900404', 3);
exec sql insert into meskes(name, born, age) values ('Carsten', 19910103,
9
);
exec sql insert into meskes(name, born, age) values ('Marc', 19930907,
6
);
exec sql insert into meskes(name, born, age) values ('Chris', 19970923,
2
);
exec sql insert into meskes(name, born, age, married, children) values ('Michael', 19660117, 3
5
, '19900404', 3);
exec sql insert into meskes(name, born, age) values ('Carsten', 19910103,
10
);
exec sql insert into meskes(name, born, age) values ('Marc', 19930907,
8
);
exec sql insert into meskes(name, born, age) values ('Chris', 19970923,
4
);
strcpy(msg, "commit");
exec sql commit;
...
...
src/interfaces/ecpg/test/test3.pgc
View file @
9992f2b1
...
...
@@ -45,10 +45,10 @@ exec sql end declare section;
strcpy(msg, "insert");
exec sql insert into meskes(name, married, children) values (:wifesname, '19900404', 3);
exec sql insert into meskes(name, born, age, married, children) values ('Michael', 19660117, 3
4
, '19900404', 3);
exec sql insert into meskes(name, born, age) values ('Carsten', 19910103,
9
);
exec sql insert into meskes(name, born, age) values ('Marc', 19930907,
6
);
exec sql insert into meskes(name, born, age) values ('Chris', 19970923,
2
);
exec sql insert into meskes(name, born, age, married, children) values ('Michael', 19660117, 3
5
, '19900404', 3);
exec sql insert into meskes(name, born, age) values ('Carsten', 19910103,
10
);
exec sql insert into meskes(name, born, age) values ('Marc', 19930907,
8
);
exec sql insert into meskes(name, born, age) values ('Chris', 19970923,
4
);
strcpy(msg, "commit");
exec sql commit;
...
...
src/interfaces/ecpg/test/test_text.pgc
deleted
100644 → 0
View file @
fe933d6a
// $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