*** empty log message ***
This commit is contained in:
parent
2a76aa23e0
commit
f9f458be10
@ -502,5 +502,13 @@ Thu Mar 4 19:49:28 CET 1999
|
||||
Sat Mar 6 14:06:07 CET 1999
|
||||
|
||||
- Replaced placeholder ';;' by '?' since this is what standard says.
|
||||
|
||||
Mon Mar 8 17:07:14 CET 1999
|
||||
|
||||
- Corrected include directives to not include backend stuff.
|
||||
|
||||
Tue Mar 9 17:26:28 CET 1999
|
||||
|
||||
- Synced preproc.y with gram.y.
|
||||
- Set library version to 3.0.0
|
||||
- Set ecpg version to 2.6.0
|
||||
|
@ -758,7 +758,7 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
|
||||
%type <str> res_target_list res_target_el res_target_list2
|
||||
%type <str> res_target_el2 opt_id relation_name database_name
|
||||
%type <str> access_method attr_name class index_name name func_name
|
||||
%type <str> file_name recipe_name AexprConst ParamNo TypeId
|
||||
%type <str> file_name AexprConst ParamNo TypeId
|
||||
%type <str> in_expr_nodes not_in_expr_nodes a_expr b_expr
|
||||
%type <str> opt_indirection expr_list extract_list extract_arg
|
||||
%type <str> position_list position_expr substr_list substr_from
|
||||
@ -787,7 +787,7 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
|
||||
%type <str> RuleActionBlock RuleActionMulti join_list
|
||||
%type <str> RuleStmt opt_column opt_name oper_argtypes
|
||||
%type <str> MathOp RemoveFuncStmt aggr_argtype for_update_clause
|
||||
%type <str> RemoveAggrStmt remove_type RemoveStmt ExtendStmt RecipeStmt
|
||||
%type <str> RemoveAggrStmt remove_type RemoveStmt ExtendStmt
|
||||
%type <str> RemoveOperStmt RenameStmt all_Op user_valid_clause
|
||||
%type <str> VariableSetStmt var_value zone_value VariableShowStmt
|
||||
%type <str> VariableResetStmt AddAttrStmt alter_clause DropUserStmt
|
||||
@ -874,7 +874,6 @@ stmt: AddAttrStmt { output_statement($1, 0); }
|
||||
| UnlistenStmt { output_statement($1, 0); }
|
||||
| LockStmt { output_statement($1, 0); }
|
||||
| ProcedureStmt { output_statement($1, 0); }
|
||||
| RecipeStmt { output_statement($1, 0); }
|
||||
| RemoveAggrStmt { output_statement($1, 0); }
|
||||
| RemoveOperStmt { output_statement($1, 0); }
|
||||
| RemoveFuncStmt { output_statement($1, 0); }
|
||||
@ -2149,13 +2148,13 @@ ExtendStmt: EXTEND INDEX index_name where_clause
|
||||
* execute recipe <recipeName>
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/* NOT USED
|
||||
RecipeStmt: EXECUTE RECIPE recipe_name
|
||||
{
|
||||
$$ = cat2_str(make1_str("execute recipe"), $3);
|
||||
}
|
||||
;
|
||||
|
||||
*/
|
||||
/*****************************************************************************
|
||||
*
|
||||
* QUERY:
|
||||
@ -4295,7 +4294,7 @@ name: ColId { $$ = $1; };
|
||||
func_name: ColId { $$ = $1; };
|
||||
|
||||
file_name: Sconst { $$ = $1; };
|
||||
recipe_name: ident { $$ = $1; };
|
||||
/* NOT USED recipe_name: ident { $$ = $1; };*/
|
||||
|
||||
/* Constants
|
||||
* Include TRUE/FALSE for SQL3 support. - thomas 1997-10-24
|
||||
@ -4414,7 +4413,7 @@ ColId: ident { $$ = $1; }
|
||||
| PRIVILEGES { $$ = make1_str("privileges"); }
|
||||
| PROCEDURAL { $$ = make1_str("procedural"); }
|
||||
| READ { $$ = make1_str("read"); }
|
||||
| RECIPE { $$ = make1_str("recipe"); }
|
||||
/* NOT USED | RECIPE { $$ = make1_str("recipe"); } */
|
||||
| RELATIVE { $$ = make1_str("relative"); }
|
||||
| RENAME { $$ = make1_str("rename"); }
|
||||
| RETURNS { $$ = make1_str("returns"); }
|
||||
|
@ -1,5 +1,3 @@
|
||||
#include <stdio.h>
|
||||
|
||||
exec sql whenever sqlerror sqlprint;
|
||||
|
||||
exec sql include sqlca;
|
||||
|
@ -1,5 +1,3 @@
|
||||
#include <stdio.h>
|
||||
|
||||
exec sql include header_test;
|
||||
|
||||
exec sql type c is char reference;
|
||||
|
@ -1,125 +1,3 @@
|
||||
#include <stdio.h>
|
||||
|
||||
exec sql include header_test;
|
||||
|
||||
exec sql type str is varchar[10];
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
typedef struct { long born; short age; } birthinfo;
|
||||
exec sql type birthinfo is struct { long born; short age; };
|
||||
exec sql begin declare section;
|
||||
struct personal_struct { str name;
|
||||
birthinfo birth;
|
||||
} personal;
|
||||
struct personal_indicator { int ind_name;
|
||||
birthinfo ind_birth;
|
||||
} ind_personal;
|
||||
int *ind_married = NULL;
|
||||
int children;
|
||||
int ind_children;
|
||||
str *married = NULL;
|
||||
char *testname="Petra";
|
||||
char *query="select name, born, age, married, children from meskes where name = :var1";
|
||||
exec sql end declare section;
|
||||
|
||||
exec sql declare cur cursor for
|
||||
select name, born, age, married, children from meskes;
|
||||
|
||||
char msg[128], command[128];
|
||||
FILE *dbgs;
|
||||
|
||||
if ((dbgs = fopen("log", "w")) != NULL)
|
||||
ECPGdebug(1, dbgs);
|
||||
|
||||
strcpy(msg, "connect");
|
||||
exec sql connect to unix:postgresql://localhost:5432/mm;
|
||||
|
||||
strcpy(msg, "create");
|
||||
exec sql create table meskes(name char(8), born integer, age smallint, married date, children integer);
|
||||
|
||||
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, 33, '19900404', 3);
|
||||
exec sql insert into meskes(name, born, age) values ('Carsten', 19910103, 8);
|
||||
exec sql insert into meskes(name, born, age) values ('Marc', 19930907, 5);
|
||||
exec sql insert into meskes(name, born, age) values ('Chris', 19970923, 1);
|
||||
|
||||
strcpy(msg, "commit");
|
||||
exec sql commit;
|
||||
|
||||
strcpy(msg, "open");
|
||||
exec sql open cur;
|
||||
|
||||
exec sql whenever not found do break;
|
||||
|
||||
while (1) {
|
||||
strcpy(msg, "fetch");
|
||||
exec sql fetch in cur into :personal:ind_personal, :married:ind_married, :children:ind_children;
|
||||
printf("%8.8s", personal.name.arr);
|
||||
if (ind_personal.ind_birth.born >= 0)
|
||||
printf(", born %d", personal.birth.born);
|
||||
if (ind_personal.ind_birth.age >= 0)
|
||||
printf(", age = %d", personal.birth.age);
|
||||
if (ind_married >= 0)
|
||||
printf(", married %10.10s", married->arr);
|
||||
if (ind_children >= 0)
|
||||
printf(", children = %d", children);
|
||||
putchar('\n');
|
||||
|
||||
free(married);
|
||||
married = NULL;
|
||||
}
|
||||
|
||||
strcpy(msg, "close");
|
||||
exec sql close cur;
|
||||
|
||||
/* and now the same query with prepare */
|
||||
exec sql prepare MM from :query;
|
||||
exec sql declare prep cursor for MM;
|
||||
|
||||
strcpy(msg, "open");
|
||||
exec sql open prep using :testname;
|
||||
|
||||
exec sql whenever not found do break;
|
||||
|
||||
while (1) {
|
||||
strcpy(msg, "fetch");
|
||||
exec sql fetch in prep into :personal:ind_personal, :married:ind_married, :children:ind_children;
|
||||
printf("%8.8s", personal.name.arr);
|
||||
if (ind_personal.ind_birth.born >= 0)
|
||||
printf(", born %d", personal.birth.born);
|
||||
if (ind_personal.ind_birth.age >= 0)
|
||||
printf(", age = %d", personal.birth.age);
|
||||
if (ind_married >= 0)
|
||||
printf(", married %10.10s", married->arr);
|
||||
if (ind_children >= 0)
|
||||
printf(", children = %d", children);
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
free(married);
|
||||
|
||||
strcpy(msg, "close");
|
||||
exec sql close prep;
|
||||
|
||||
strcpy(msg, "drop");
|
||||
exec sql drop table meskes;
|
||||
|
||||
strcpy(msg, "commit");
|
||||
exec sql commit;
|
||||
|
||||
strcpy(msg, "disconnect");
|
||||
|
||||
exec sql disconnect;
|
||||
if (dbgs != NULL)
|
||||
fclose(dbgs);
|
||||
|
||||
return (0);
|
||||
}
|
||||
#include <stdio.h>
|
||||
|
||||
exec sql include header_test;
|
||||
|
||||
exec sql type str is varchar[10];
|
||||
|
Loading…
x
Reference in New Issue
Block a user