mirror of
https://github.com/postgres/postgres.git
synced 2025-04-24 10:47:04 +03:00
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:
parent
0b09955da8
commit
2a74511bf4
@ -239,3 +239,12 @@ Wed May 20 10:46:48 CEST 1998
|
|||||||
initialization.
|
initialization.
|
||||||
- Added enum datatype.
|
- Added enum datatype.
|
||||||
- Set version to 2.3.2
|
- 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
|
||||||
|
@ -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.
|
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:
|
Missing statements:
|
||||||
- exec sql type
|
- exec sql type
|
||||||
- exec sql define
|
- exec sql define
|
||||||
@ -10,3 +18,4 @@ Missing statements:
|
|||||||
- exec sql allocate
|
- exec sql allocate
|
||||||
- exqc sql free
|
- exqc sql free
|
||||||
- SQLSTATE
|
- SQLSTATE
|
||||||
|
- exec sql whenever sqlwarning
|
||||||
|
@ -7,13 +7,37 @@ extern "C" {
|
|||||||
|
|
||||||
struct sqlca
|
struct sqlca
|
||||||
{
|
{
|
||||||
int sqlcode;
|
char sqlcaid[8];
|
||||||
|
long sqlabc;
|
||||||
|
long sqlcode;
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
int sqlerrml;
|
int sqlerrml;
|
||||||
char sqlerrmc[1000];
|
char sqlerrmc[70];
|
||||||
} sqlerrm;
|
} sqlerrm;
|
||||||
|
char sqlerrp[8];
|
||||||
long sqlerrd[6];
|
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;
|
} sqlca;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -4,7 +4,7 @@ include $(SRCDIR)/Makefile.global
|
|||||||
PQ_INCLUDE=-I$(SRCDIR)/interfaces/libpq
|
PQ_INCLUDE=-I$(SRCDIR)/interfaces/libpq
|
||||||
|
|
||||||
SO_MAJOR_VERSION=2
|
SO_MAJOR_VERSION=2
|
||||||
SO_MINOR_VERSION=2
|
SO_MINOR_VERSION=3
|
||||||
|
|
||||||
PORTNAME=@PORTNAME@
|
PORTNAME=@PORTNAME@
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ static FILE *debugstream = NULL;
|
|||||||
static int committed = true;
|
static int committed = true;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
register_error(int code, char *fmt,...)
|
register_error(long code, char *fmt,...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
@ -131,9 +131,9 @@ ECPGdo(int lineno, char *query,...)
|
|||||||
long offset, ind_offset;
|
long offset, ind_offset;
|
||||||
enum ECPGttype ind_type;
|
enum ECPGttype ind_type;
|
||||||
|
|
||||||
|
memset((char *) &sqlca, 0, sizeof (sqlca));
|
||||||
va_start(ap, query);
|
va_start(ap, query);
|
||||||
|
|
||||||
sqlca.sqlcode = 0;
|
|
||||||
copiedquery = strdup(query);
|
copiedquery = strdup(query);
|
||||||
|
|
||||||
type = va_arg(ap, enum ECPGttype);
|
type = va_arg(ap, enum ECPGttype);
|
||||||
@ -666,6 +666,7 @@ ECPGdo(int lineno, char *query,...)
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
sqlca.sqlwarn[0] = sqlca.sqlwarn[1] = 'W';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -702,6 +703,7 @@ ECPGdo(int lineno, char *query,...)
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
sqlca.sqlwarn[0] = sqlca.sqlwarn[1] = 'W';
|
||||||
|
|
||||||
var->len = varcharsize;
|
var->len = varcharsize;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ include $(SRCDIR)/Makefile.global
|
|||||||
|
|
||||||
MAJOR_VERSION=2
|
MAJOR_VERSION=2
|
||||||
MINOR_VERSION=3
|
MINOR_VERSION=3
|
||||||
PATCHLEVEL=2
|
PATCHLEVEL=3
|
||||||
|
|
||||||
CFLAGS+=-I../include -DMAJOR_VERSION=$(MAJOR_VERSION) \
|
CFLAGS+=-I../include -DMAJOR_VERSION=$(MAJOR_VERSION) \
|
||||||
-DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \
|
-DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \
|
||||||
|
@ -643,9 +643,9 @@ output_statement(char * stmt, int mode)
|
|||||||
%type <str> group_clause groupby_list groupby having_clause from_clause
|
%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> 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> 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> 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> 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> opt_with_copy FetchStmt opt_direction fetch_how_many opt_portal_name
|
||||||
%type <str> ClosePortalStmt DestroyStmt VacuumStmt opt_verbose
|
%type <str> ClosePortalStmt DestroyStmt VacuumStmt opt_verbose
|
||||||
@ -691,6 +691,7 @@ output_statement(char * stmt, int mode)
|
|||||||
%type <action> action
|
%type <action> action
|
||||||
|
|
||||||
%type <index> opt_array_bounds nest_array_bounds
|
%type <index> opt_array_bounds nest_array_bounds
|
||||||
|
|
||||||
%%
|
%%
|
||||||
prog: statements;
|
prog: statements;
|
||||||
|
|
||||||
@ -735,7 +736,16 @@ stmt: AddAttrStmt { output_statement($1, 0); }
|
|||||||
| RemoveStmt { output_statement($1, 0); }
|
| RemoveStmt { output_statement($1, 0); }
|
||||||
| RenameStmt { output_statement($1, 0); }
|
| RenameStmt { output_statement($1, 0); }
|
||||||
| RevokeStmt { 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); }
|
| RuleStmt { output_statement($1, 0); }
|
||||||
| TransactionStmt {
|
| TransactionStmt {
|
||||||
fprintf(yyout, "ECPGtrans(__LINE__, \"%s\");", $1);
|
fprintf(yyout, "ECPGtrans(__LINE__, \"%s\");", $1);
|
||||||
@ -1989,7 +1999,7 @@ OptStmtMulti: OptStmtMulti OptimizableStmt ';'
|
|||||||
| OptStmtMulti OptimizableStmt
|
| OptStmtMulti OptimizableStmt
|
||||||
{ $$ = cat2_str($1, $2); }
|
{ $$ = cat2_str($1, $2); }
|
||||||
| OptimizableStmt ';'
|
| OptimizableStmt ';'
|
||||||
{ $$ = $1; }
|
{ $$ = cat2_str($1, make1_str(";")); }
|
||||||
;
|
;
|
||||||
|
|
||||||
event_object: relation_name '.' attr_name
|
event_object: relation_name '.' attr_name
|
||||||
@ -2197,17 +2207,12 @@ ExplainStmt: EXPLAIN opt_verbose OptimizableStmt
|
|||||||
* *
|
* *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
OptimizableStmt: SelectStmt { output_statement($1, 1); }
|
OptimizableStmt: SelectStmt
|
||||||
| CursorStmt
|
| CursorStmt
|
||||||
{
|
| UpdateStmt
|
||||||
fputs($1, yyout);
|
| InsertStmt
|
||||||
output_line_number();
|
| NotifyStmt
|
||||||
free($1);
|
| DeleteStmt
|
||||||
}
|
|
||||||
| UpdateStmt { output_statement($1, 0); }
|
|
||||||
| InsertStmt { output_statement($1, 0); }
|
|
||||||
| NotifyStmt { output_statement($1, 0); }
|
|
||||||
| DeleteStmt { output_statement($1, 0); }
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
@ -2334,7 +2339,7 @@ CursorStmt: DECLARE name opt_binary CURSOR FOR
|
|||||||
cur = this;
|
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));
|
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);
|
add_variable(&argsinsert, find_variable($1), &no_indicator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
exec sql include sqlca;
|
exec sql include sqlca;
|
||||||
|
|
||||||
exec sql whenever not found do break;
|
|
||||||
exec sql whenever sqlerror sqlprint;
|
exec sql whenever sqlerror sqlprint;
|
||||||
|
@ -48,6 +48,8 @@ exec sql end declare section;
|
|||||||
strcpy(msg, "open");
|
strcpy(msg, "open");
|
||||||
exec sql open cur;
|
exec sql open cur;
|
||||||
|
|
||||||
|
exec sql whenever not found do break;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
strcpy(msg, "fetch");
|
strcpy(msg, "fetch");
|
||||||
exec sql fetch cur into :personal:ind_personal, :married:ind_married;
|
exec sql fetch cur into :personal:ind_personal, :married:ind_married;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user