Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9992f2b

Browse files
author
Michael Meskes
committed
- Removed debug message from preproc.y.
- Fixed some bugs in exec sql var and exec sql type command.
1 parentfe933d6 commit9992f2b

File tree

5 files changed

+112
-119
lines changed

5 files changed

+112
-119
lines changed

‎src/interfaces/ecpg/ChangeLog

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1160,6 +1160,11 @@ Wed Dec 5 12:27:25 CET 2001
11601160
- Fixed variable handling in AT statement.
11611161
- Fixed bug that caused segfault when given incorrect DB name.
11621162
- Fixed bug in ecpglib causing indicator to list the size of the
1163-
variable instead of the size of the data.
1163+
variable instead of the size of the data
1164+
1165+
Thu Dec 6 14:02:56 CET 2001
1166+
1167+
- Removed debug message from preproc.y.
1168+
- Fixed some bugs in exec sql var and exec sql type command.
11641169
- Set ecpg version to 2.9.0.
11651170
- Set library version to 3.3.0.

‎src/interfaces/ecpg/preproc/preproc.y

Lines changed: 98 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -3886,7 +3886,6 @@ connection_target: database_name opt_server opt_port
38863886
|db_prefix':'serveropt_port'/'database_nameopt_options
38873887
{
38883888
/* new style: <tcp|unix>:postgresql://server[:port][/dbname]*/
3889-
printf("%s\n", $1);
38903889
if (strncmp($1,"unix:postgresql", strlen("unix:postgresql")) !=0 && strncmp($1,"tcp:postgresql", strlen("tcp:postgresql")) !=0)
38913890
{
38923891
sprintf(errortext,"only protocols 'tcp' and 'unix' and database type 'postgresql' are supported");
@@ -4271,10 +4270,6 @@ s_struct: SQL_STRUCT opt_symbol
42714270
if (struct_level >= STRUCT_DEPTH)
42724271
mmerror(ET_ERROR,"Too many levels in nested structure definition");
42734272

4274-
/* reset this variable so we see if there was*/
4275-
/* an initializer specified*/
4276-
initializer =0;
4277-
42784273
$$ = cat2_str(make_str("struct"),$2);
42794274
};
42804275

@@ -4284,10 +4279,6 @@ s_union: UNION opt_symbol
42844279
if (struct_level >= STRUCT_DEPTH)
42854280
mmerror(ET_ERROR,"Too many levels in nested structure definition");
42864281

4287-
/* reset this variable so we see if there was*/
4288-
/* an initializer specified*/
4289-
initializer =0;
4290-
42914282
$$ = cat2_str(make_str("union"),$2);
42924283
};
42934284

@@ -4661,52 +4652,62 @@ ECPGSetConnection: SET SQL_CONNECTION to_equal connection_object
46614652
/*
46624653
* define a new type for embedded SQL
46634654
*/
4664-
ECPGTypedef:TYPE_PColLabelIStypeopt_type_array_boundsopt_reference
4655+
ECPGTypedef:TYPE_P
4656+
{
4657+
/* reset this variable so we see if there was*/
4658+
/* an initializer specified*/
4659+
initializer =0;
4660+
}
4661+
ColLabelIStypeopt_type_array_boundsopt_reference
46654662
{
46664663
/* add entry to list*/
46674664
structtypedefs *ptr, *this;
4668-
int dimension =$5.index1;
4669-
int length =$5.index2;
4665+
int dimension =$6.index1;
4666+
int length =$6.index2;
46704667

4671-
if (($4.type_enum == ECPGt_struct ||
4672-
$4.type_enum == ECPGt_union) &&
4668+
if (($5.type_enum == ECPGt_struct ||
4669+
$5.type_enum == ECPGt_union) &&
46734670
initializer ==1)
4671+
{
46744672
mmerror(ET_ERROR,"Initializer not allowed in EXEC SQL VAR command");
4675-
4676-
for (ptr = types; ptr !=NULL; ptr = ptr->next)
4673+
}
4674+
else
46774675
{
4678-
if (strcmp($2,ptr->name) ==0)
4676+
for (ptr = types;ptr !=NULL; ptr = ptr->next)
46794677
{
4680-
/* re-definition is a bug*/
4681-
sprintf(errortext,"Type %s already defined", $2);
4682-
mmerror(ET_ERROR, errortext);
4683-
}
4684-
}
4678+
if (strcmp($3, ptr->name) ==0)
4679+
{
4680+
/* re-definition is a bug*/
4681+
sprintf(errortext,"Type %s already defined", $3);
4682+
mmerror(ET_ERROR, errortext);
4683+
}
4684+
}
46854685

4686-
adjust_array($4.type_enum, &dimension, &length, $4.type_dimension, $4.type_index, *$6?1:0);
4686+
adjust_array($5.type_enum, &dimension, &length, $5.type_dimension, $5.type_index, *$7?1:0);
46874687

4688-
this = (structtypedefs *) mm_alloc(sizeof(structtypedefs));
4688+
this = (structtypedefs *) mm_alloc(sizeof(structtypedefs));
46894689

4690-
/* initial definition*/
4691-
this->next = types;
4692-
this->name =$2;
4693-
this->type = (structthis_type *) mm_alloc(sizeof(structthis_type));
4694-
this->type->type_enum =$4.type_enum;
4695-
this->type->type_str = mm_strdup($2);
4696-
this->type->type_dimension = dimension;/* dimension of array*/
4697-
this->type->type_index = length;/* lenght of string*/
4698-
this->struct_member_list = ($4.type_enum == ECPGt_struct ||$4.type_enum == ECPGt_union) ?
4699-
struct_member_list[struct_level] :NULL;
4690+
/* initial definition*/
4691+
this->next = types;
4692+
this->name =$3;
4693+
this->type = (structthis_type *) mm_alloc(sizeof(structthis_type));
4694+
this->type->type_enum =$5.type_enum;
4695+
this->type->type_str = mm_strdup($3);
4696+
this->type->type_dimension = dimension;/* dimension of array*/
4697+
this->type->type_index = length;/* lenght of string*/
4698+
this->struct_member_list = ($5.type_enum == ECPGt_struct ||$5.type_enum == ECPGt_union) ?
4699+
struct_member_list[struct_level] :NULL;
47004700

4701-
if ($4.type_enum != ECPGt_varchar &&
4702-
$4.type_enum != ECPGt_char &&
4703-
$4.type_enum != ECPGt_unsigned_char &&
4704-
this->type->type_index >=0)
4705-
mmerror(ET_ERROR,"No multi-dimensional array support for simple data types");
4701+
if ($5.type_enum != ECPGt_varchar &&
4702+
$5.type_enum != ECPGt_char &&
4703+
$5.type_enum != ECPGt_unsigned_char &&
4704+
this->type->type_index >=0)
4705+
mmerror(ET_ERROR,"No multi-dimensional array support for simple data types");
47064706

4707-
types =this;
4707+
types =this;
4708+
}
47084709

4709-
$$ = 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("*/"));
4710+
$$ = 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("*/"));
47104711
};
47114712

47124713
opt_type_array_bounds:'['']'opt_type_array_bounds
@@ -4754,60 +4755,70 @@ opt_reference: SQL_REFERENCE { $$ = make_str("reference"); }
47544755
/*
47554756
* define the type of one variable for embedded SQL
47564757
*/
4757-
ECPGVar:SQL_VARColLabelIStypeopt_type_array_boundsopt_reference
4758+
ECPGVar:SQL_VAR
47584759
{
4759-
structvariable *p = find_variable($2);
4760-
int dimension =$5.index1;
4761-
int length =$5.index2;
4760+
/* reset this variable so we see if there was*/
4761+
/* an initializer specified*/
4762+
initializer =0;
4763+
}
4764+
ColLabelIStypeopt_type_array_boundsopt_reference
4765+
{
4766+
structvariable *p = find_variable($3);
4767+
int dimension =$6.index1;
4768+
int length =$6.index2;
47624769
structECPGtype * type;
47634770

4764-
if (($4.type_enum == ECPGt_struct ||
4765-
$4.type_enum == ECPGt_union) &&
4771+
if (($5.type_enum == ECPGt_struct ||
4772+
$5.type_enum == ECPGt_union) &&
47664773
initializer ==1)
4774+
{
47674775
mmerror(ET_ERROR,"Initializer not allowed in EXEC SQL VAR command");
4768-
4769-
adjust_array($4.type_enum, &dimension, &length, $4.type_dimension, $4.type_index, *$6?1:0);
4770-
4771-
switch ($4.type_enum)
4776+
}
4777+
else
47724778
{
4773-
case ECPGt_struct:
4774-
case ECPGt_union:
4775-
if (dimension <0)
4776-
type = ECPGmake_struct_type(struct_member_list[struct_level],$4.type_enum);
4777-
else
4778-
type = ECPGmake_array_type(ECPGmake_struct_type(struct_member_list[struct_level],$4.type_enum), dimension);
4779-
break;
4780-
case ECPGt_varchar:
4781-
if (dimension == -1)
4782-
type = ECPGmake_simple_type($4.type_enum, length);
4783-
else
4784-
type = ECPGmake_array_type(ECPGmake_simple_type($4.type_enum, length), dimension);
4785-
4786-
break;
4787-
case ECPGt_char:
4788-
case ECPGt_unsigned_char:
4789-
if (dimension == -1)
4790-
type = ECPGmake_simple_type($4.type_enum, length);
4791-
else
4792-
type = ECPGmake_array_type(ECPGmake_simple_type($4.type_enum, length), dimension);
4793-
4794-
break;
4795-
default:
4796-
if (length >=0)
4797-
mmerror(ET_ERROR,"No multi-dimensional array support for simple data types");
4779+
adjust_array($5.type_enum, &dimension, &length, $5.type_dimension, $5.type_index, *$7?1:0);
47984780

4799-
if (dimension <0)
4800-
type = ECPGmake_simple_type($4.type_enum,1);
4801-
else
4802-
type = ECPGmake_array_type(ECPGmake_simple_type($4.type_enum,1), dimension);
4803-
4804-
break;
4805-
}
4806-
4807-
ECPGfree_type(p->type);
4808-
p->type = type;
4781+
switch ($5.type_enum)
4782+
{
4783+
case ECPGt_struct:
4784+
case ECPGt_union:
4785+
if (dimension <0)
4786+
type = ECPGmake_struct_type(struct_member_list[struct_level],$5.type_enum);
4787+
else
4788+
type = ECPGmake_array_type(ECPGmake_struct_type(struct_member_list[struct_level],$5.type_enum), dimension);
4789+
break;
4790+
case ECPGt_varchar:
4791+
if (dimension == -1)
4792+
type = ECPGmake_simple_type($5.type_enum, length);
4793+
else
4794+
type = ECPGmake_array_type(ECPGmake_simple_type($5.type_enum, length), dimension);
4795+
4796+
break;
4797+
case ECPGt_char:
4798+
case ECPGt_unsigned_char:
4799+
if (dimension == -1)
4800+
type = ECPGmake_simple_type($5.type_enum, length);
4801+
else
4802+
type = ECPGmake_array_type(ECPGmake_simple_type($5.type_enum, length), dimension);
4803+
4804+
break;
4805+
default:
4806+
if (length >=0)
4807+
mmerror(ET_ERROR,"No multi-dimensional array support for simple data types");
4808+
4809+
if (dimension <0)
4810+
type = ECPGmake_simple_type($5.type_enum,1);
4811+
else
4812+
type = ECPGmake_array_type(ECPGmake_simple_type($5.type_enum,1), dimension);
4813+
4814+
break;
4815+
}
4816+
4817+
ECPGfree_type(p->type);
4818+
p->type = type;
4819+
}
48094820

4810-
$$ = 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("*/"));
4821+
$$ = 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("*/"));
48114822
};
48124823

48134824
/*

‎src/interfaces/ecpg/test/test2.pgc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ exec sql end declare section;
5050

5151
strcpy(msg, "insert");
5252
exec sql insert into meskes(name, married, children) values ('Petra', '19900404', 3);
53-
exec sql insert into meskes(name, born, age, married, children) values ('Michael', 19660117,34, '19900404', 3);
54-
exec sql insert into meskes(name, born, age) values ('Carsten', 19910103,9);
55-
exec sql insert into meskes(name, born, age) values ('Marc', 19930907,6);
56-
exec sql insert into meskes(name, born, age) values ('Chris', 19970923,2);
53+
exec sql insert into meskes(name, born, age, married, children) values ('Michael', 19660117,35, '19900404', 3);
54+
exec sql insert into meskes(name, born, age) values ('Carsten', 19910103,10);
55+
exec sql insert into meskes(name, born, age) values ('Marc', 19930907,8);
56+
exec sql insert into meskes(name, born, age) values ('Chris', 19970923,4);
5757

5858
strcpy(msg, "commit");
5959
exec sql commit;

‎src/interfaces/ecpg/test/test3.pgc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ exec sql end declare section;
4545

4646
strcpy(msg, "insert");
4747
exec sql insert into meskes(name, married, children) values (:wifesname, '19900404', 3);
48-
exec sql insert into meskes(name, born, age, married, children) values ('Michael', 19660117,34, '19900404', 3);
49-
exec sql insert into meskes(name, born, age) values ('Carsten', 19910103,9);
50-
exec sql insert into meskes(name, born, age) values ('Marc', 19930907,6);
51-
exec sql insert into meskes(name, born, age) values ('Chris', 19970923,2);
48+
exec sql insert into meskes(name, born, age, married, children) values ('Michael', 19660117,35, '19900404', 3);
49+
exec sql insert into meskes(name, born, age) values ('Carsten', 19910103,10);
50+
exec sql insert into meskes(name, born, age) values ('Marc', 19930907,8);
51+
exec sql insert into meskes(name, born, age) values ('Chris', 19970923,4);
5252

5353
strcpy(msg, "commit");
5454
exec sql commit;

‎src/interfaces/ecpg/test/test_text.pgc

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp