From: Michael Meskes <meskes@topsystem.de>

+ Wed Jun  3 13:38:57 CEST 1998
+
+       - Made sqlca struct compatible with other systems.
+       - Give back a warning in case of truncation
+       - Changed the handling of OptimizableStmt since the old one broke
+         CREATE RULE
+       - Set library version to 2.3
+       - Set version to 2.3.3
This commit is contained in:
Marc G. Fournier 1998-06-03 13:55:15 +00:00
parent 0b09955da8
commit 2a74511bf4
9 changed files with 74 additions and 24 deletions

View File

@ -239,3 +239,12 @@ Wed May 20 10:46:48 CEST 1998
initialization.
- Added enum datatype.
- Set version to 2.3.2
Wed Jun 3 13:38:57 CEST 1998
- Made sqlca struct compatible with other systems.
- Give back a warning in case of truncation
- Changed the handling of OptimizableStmt since the old one broke
CREATE RULE
- Set library version to 2.3
- Set version to 2.3.3

View File

@ -3,6 +3,14 @@ section of the structure variable for ecpg to be able to understand it.
Variable type bool has to be checked. I never used it so far.
The error message for "no data" in an exec sql insert select from statement
has to be 100.
sqlwarn[6] should be 'W' if the PRECISION or SCALE value specified in a SET
DESCRIPTOR statement will be ignored.
it would be nice to be able to use :var[:index] as cvariable
Missing statements:
- exec sql type
- exec sql define
@ -10,3 +18,4 @@ Missing statements:
- exec sql allocate
- exqc sql free
- SQLSTATE
- exec sql whenever sqlwarning

View File

@ -7,13 +7,37 @@ extern "C" {
struct sqlca
{
int sqlcode;
char sqlcaid[8];
long sqlabc;
long sqlcode;
struct
{
int sqlerrml;
char sqlerrmc[1000];
char sqlerrmc[70];
} sqlerrm;
char sqlerrp[8];
long sqlerrd[6];
/* Element 0: empty */
/* 1: empty */
/* 2: number of rows processed */
/* after an INSERT, UPDATE or*/
/* DELETE statement */
/* 3: empty */
/* 4: empty */
/* 5: empty */
char sqlwarn[8];
/* Element 0: set to 'W' if at least one other is 'W' */
/* 1: if 'W' at least one character string */
/* value was truncated when it was */
/* stored into a host variable. */
/* 2: empty */
/* 3: empty */
/* 4: empty */
/* 5: empty */
/* 6: empty */
/* 7: empty */
char sqlext[8];
} sqlca;
#endif

View File

@ -4,7 +4,7 @@ include $(SRCDIR)/Makefile.global
PQ_INCLUDE=-I$(SRCDIR)/interfaces/libpq
SO_MAJOR_VERSION=2
SO_MINOR_VERSION=2
SO_MINOR_VERSION=3
PORTNAME=@PORTNAME@

View File

@ -38,7 +38,7 @@ static FILE *debugstream = NULL;
static int committed = true;
static void
register_error(int code, char *fmt,...)
register_error(long code, char *fmt,...)
{
va_list args;
@ -131,9 +131,9 @@ ECPGdo(int lineno, char *query,...)
long offset, ind_offset;
enum ECPGttype ind_type;
memset((char *) &sqlca, 0, sizeof (sqlca));
va_start(ap, query);
sqlca.sqlcode = 0;
copiedquery = strdup(query);
type = va_arg(ap, enum ECPGttype);
@ -666,6 +666,7 @@ ECPGdo(int lineno, char *query,...)
default:
break;
}
sqlca.sqlwarn[0] = sqlca.sqlwarn[1] = 'W';
}
}
}
@ -702,6 +703,7 @@ ECPGdo(int lineno, char *query,...)
default:
break;
}
sqlca.sqlwarn[0] = sqlca.sqlwarn[1] = 'W';
var->len = varcharsize;
}

View File

@ -3,7 +3,7 @@ include $(SRCDIR)/Makefile.global
MAJOR_VERSION=2
MINOR_VERSION=3
PATCHLEVEL=2
PATCHLEVEL=3
CFLAGS+=-I../include -DMAJOR_VERSION=$(MAJOR_VERSION) \
-DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \

View File

@ -643,9 +643,9 @@ output_statement(char * stmt, int mode)
%type <str> group_clause groupby_list groupby having_clause from_clause
%type <str> from_list from_val join_expr join_outer join_spec join_list
%type <str> join_using where_clause relation_expr row_op sub_type
%type <str> opt_column_list insert_rest InsertStmt
%type <str> opt_column_list insert_rest InsertStmt OptimizableStmt
%type <str> columnList DeleteStmt LockStmt UpdateStmt CursorStmt
%type <str> NotifyStmt columnElem copy_dirn OptimizableStmt
%type <str> NotifyStmt columnElem copy_dirn
%type <str> copy_delimiter ListenStmt CopyStmt copy_file_name opt_binary
%type <str> opt_with_copy FetchStmt opt_direction fetch_how_many opt_portal_name
%type <str> ClosePortalStmt DestroyStmt VacuumStmt opt_verbose
@ -691,6 +691,7 @@ output_statement(char * stmt, int mode)
%type <action> action
%type <index> opt_array_bounds nest_array_bounds
%%
prog: statements;
@ -735,7 +736,16 @@ stmt: AddAttrStmt { output_statement($1, 0); }
| RemoveStmt { output_statement($1, 0); }
| RenameStmt { output_statement($1, 0); }
| RevokeStmt { output_statement($1, 0); }
| OptimizableStmt { /* output already written */ }
| OptimizableStmt {
if (strncmp($1, "/* declare" , sizeof("/* declare")-1) == 0)
{
fputs($1, yyout);
output_line_number();
free($1);
}
else
output_statement($1, 1);
}
| RuleStmt { output_statement($1, 0); }
| TransactionStmt {
fprintf(yyout, "ECPGtrans(__LINE__, \"%s\");", $1);
@ -1989,7 +1999,7 @@ OptStmtMulti: OptStmtMulti OptimizableStmt ';'
| OptStmtMulti OptimizableStmt
{ $$ = cat2_str($1, $2); }
| OptimizableStmt ';'
{ $$ = $1; }
{ $$ = cat2_str($1, make1_str(";")); }
;
event_object: relation_name '.' attr_name
@ -2197,17 +2207,12 @@ ExplainStmt: EXPLAIN opt_verbose OptimizableStmt
* *
*****************************************************************************/
OptimizableStmt: SelectStmt { output_statement($1, 1); }
| CursorStmt
{
fputs($1, yyout);
output_line_number();
free($1);
}
| UpdateStmt { output_statement($1, 0); }
| InsertStmt { output_statement($1, 0); }
| NotifyStmt { output_statement($1, 0); }
| DeleteStmt { output_statement($1, 0); }
OptimizableStmt: SelectStmt
| CursorStmt
| UpdateStmt
| InsertStmt
| NotifyStmt
| DeleteStmt
;
@ -2334,7 +2339,7 @@ CursorStmt: DECLARE name opt_binary CURSOR FOR
cur = this;
}
$$ = cat5_str(make1_str("/* declare cursor\""), $2, make1_str("\"statement has been moved to location of open cursor \""), strdup($2), make1_str("\"statement. */"));
$$ = make5_str(make1_str("/* declare cursor \""), $2, make1_str("\" statement has been moved to location of open cursor \""), strdup($2), make1_str("\" statement. */"));
}
;
@ -4584,7 +4589,7 @@ cinputvariable : cvariable indicator {
add_variable(&argsinsert, find_variable($1), ($2 == NULL) ? &no_indicator : find_variable($2));
}
civariableonly : cvariable name {
civariableonly : cvariable {
add_variable(&argsinsert, find_variable($1), &no_indicator);
}

View File

@ -1,4 +1,3 @@
exec sql include sqlca;
exec sql whenever not found do break;
exec sql whenever sqlerror sqlprint;

View File

@ -48,6 +48,8 @@ exec sql end declare section;
strcpy(msg, "open");
exec sql open cur;
exec sql whenever not found do break;
while (1) {
strcpy(msg, "fetch");
exec sql fetch cur into :personal:ind_personal, :married:ind_married;