*** empty log message ***
This commit is contained in:
parent
a4ce6f00f8
commit
e4274d60a5
@ -519,5 +519,21 @@ Thu Mar 18 18:57:31 CET 1999
|
||||
|
||||
- Synced preproc.y with gram.y.
|
||||
- Added '%' operator.
|
||||
|
||||
Thu Mar 18 19:44:10 CET 1999
|
||||
|
||||
- Added ECPGstatus() function.
|
||||
- Cleaned up some error messages.
|
||||
|
||||
Fri Mar 19 08:49:32 CET 1999
|
||||
|
||||
- Synced preproc.y with gram.y.
|
||||
- Synced keywords.c.
|
||||
- Synced pgc.l with scan.l.
|
||||
|
||||
Sat Mar 20 19:57:42 CET 1999
|
||||
|
||||
- Synced preproc.y with gram.y.
|
||||
- Fixed handling of ';' character.
|
||||
- Set library version to 3.0.0
|
||||
- Set ecpg version to 2.6.0
|
||||
|
@ -23,8 +23,6 @@
|
||||
#define ECPG_CONVERT_BOOL -207
|
||||
#define ECPG_EMPTY -208
|
||||
|
||||
#define ECPG_UNDECLARED_CURSOR -210
|
||||
|
||||
#define ECPG_NO_CONN -220
|
||||
#define ECPG_NOT_CONN -221
|
||||
|
||||
|
@ -6,6 +6,7 @@ extern "C"
|
||||
#endif
|
||||
|
||||
void ECPGdebug(int, FILE *);
|
||||
bool ECPGstatus(int, const char *);
|
||||
bool ECPGsetconn(int, const char *);
|
||||
bool ECPGconnect(int, const char *, const char *, const char *, const char *);
|
||||
bool ECPGdo(int, const char *, char *,...);
|
||||
|
@ -183,7 +183,7 @@ ecpg_alloc(long size, int lineno)
|
||||
if (!new)
|
||||
{
|
||||
ECPGlog("out of memory\n");
|
||||
register_error(ECPG_OUT_OF_MEMORY, "out of memory in line %d", lineno);
|
||||
register_error(ECPG_OUT_OF_MEMORY, "Out of memory in line %d", lineno);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -199,7 +199,7 @@ ecpg_strdup(const char *string, int lineno)
|
||||
if (!new)
|
||||
{
|
||||
ECPGlog("out of memory\n");
|
||||
register_error(ECPG_OUT_OF_MEMORY, "out of memory in line %d", lineno);
|
||||
register_error(ECPG_OUT_OF_MEMORY, "Out of memory in line %d", lineno);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -336,7 +336,7 @@ create_statement(int lineno, struct connection *connection, struct statement **
|
||||
if (var->pointer == NULL)
|
||||
{
|
||||
ECPGlog("create_statement: invalid statement name\n");
|
||||
register_error(ECPG_INVALID_STMT, "Invalid statement name in line %d", lineno);
|
||||
register_error(ECPG_INVALID_STMT, "Invalid statement name in line %d.", lineno);
|
||||
free(var);
|
||||
return false;
|
||||
}
|
||||
@ -387,7 +387,7 @@ next_insert(char *text)
|
||||
static bool
|
||||
ECPGexecute(struct statement * stmt)
|
||||
{
|
||||
bool status = false;
|
||||
bool status = false;
|
||||
char *copiedquery;
|
||||
PGresult *results;
|
||||
PGnotify *notify;
|
||||
@ -637,7 +637,7 @@ ECPGexecute(struct statement * stmt)
|
||||
{
|
||||
if ((results = PQexec(stmt->connection->connection, "begin transaction")) == NULL)
|
||||
{
|
||||
register_error(ECPG_TRANS, "Error starting transaction line %d.", stmt->lineno);
|
||||
register_error(ECPG_TRANS, "Error in transaction processing line %d.", stmt->lineno);
|
||||
return false;
|
||||
}
|
||||
PQclear(results);
|
||||
@ -708,7 +708,7 @@ ECPGexecute(struct statement * stmt)
|
||||
/*
|
||||
* allocate memory for NULL pointers
|
||||
*/
|
||||
if (var->arrsize == 0 || var->varcharsize == 0)
|
||||
if ((var->arrsize == 0 || var->varcharsize == 0) && var->value == NULL)
|
||||
{
|
||||
int len = 0;
|
||||
|
||||
@ -716,34 +716,28 @@ ECPGexecute(struct statement * stmt)
|
||||
{
|
||||
case ECPGt_char:
|
||||
case ECPGt_unsigned_char:
|
||||
if (var->value == NULL)
|
||||
var->varcharsize = 0;
|
||||
/* check strlen for each tuple */
|
||||
for (act_tuple = 0; act_tuple < ntuples; act_tuple++)
|
||||
{
|
||||
var->varcharsize = 0;
|
||||
/* check strlen for each tuple */
|
||||
for (act_tuple = 0; act_tuple < ntuples; act_tuple++)
|
||||
{
|
||||
int len = strlen(PQgetvalue(results, act_tuple, act_field)) + 1;
|
||||
|
||||
if (len > var->varcharsize)
|
||||
var->varcharsize = len;
|
||||
}
|
||||
var->offset *= var->varcharsize;
|
||||
len = var->offset * ntuples;
|
||||
int len = strlen(PQgetvalue(results, act_tuple, act_field)) + 1;
|
||||
|
||||
if (len > var->varcharsize)
|
||||
var->varcharsize = len;
|
||||
}
|
||||
var->offset *= var->varcharsize;
|
||||
len = var->offset * ntuples;
|
||||
break;
|
||||
case ECPGt_varchar:
|
||||
if (var->value == NULL)
|
||||
len = ntuples * (var->varcharsize + sizeof (int));
|
||||
len = ntuples * (var->varcharsize + sizeof (int));
|
||||
break;
|
||||
default:
|
||||
if (var->value == NULL)
|
||||
len = var->offset * ntuples;
|
||||
len = var->offset * ntuples;
|
||||
break;
|
||||
}
|
||||
|
||||
var->pointer = (void *) ecpg_alloc(len, stmt->lineno);
|
||||
var->value = (void **) var->pointer;
|
||||
add_mem((void *) var->value, stmt->lineno);
|
||||
var->value = (void *) ecpg_alloc(len, stmt->lineno);
|
||||
*((void **) var->pointer) = var->value;
|
||||
add_mem(var->value, stmt->lineno);
|
||||
}
|
||||
|
||||
for (act_tuple = 0; act_tuple < ntuples && status; act_tuple++)
|
||||
@ -1004,7 +998,7 @@ ECPGexecute(struct statement * stmt)
|
||||
case PGRES_BAD_RESPONSE:
|
||||
ECPGlog("ECPGexecute line %d: Error: %s",
|
||||
stmt->lineno, PQerrorMessage(stmt->connection->connection));
|
||||
register_error(ECPG_PGSQL, "Error: %s line %d.",
|
||||
register_error(ECPG_PGSQL, "Postgres error: %s line %d.",
|
||||
PQerrorMessage(stmt->connection->connection), stmt->lineno);
|
||||
status = false;
|
||||
break;
|
||||
@ -1019,7 +1013,8 @@ ECPGexecute(struct statement * stmt)
|
||||
default:
|
||||
ECPGlog("ECPGexecute line %d: Got something else, postgres error.\n",
|
||||
stmt->lineno);
|
||||
register_error(ECPG_PGSQL, "Postgres error line %d.", stmt->lineno);
|
||||
register_error(ECPG_PGSQL, "Postgres error: %s line %d.",
|
||||
PQerrorMessage(stmt->connection->connection), stmt->lineno);
|
||||
status = false;
|
||||
break;
|
||||
}
|
||||
@ -1046,7 +1041,7 @@ ECPGdo(int lineno, const char *connection_name, char *query,...)
|
||||
|
||||
if (con == NULL)
|
||||
{
|
||||
register_error(ECPG_NO_CONN, "No such connection %s in line %d", connection_name, lineno);
|
||||
register_error(ECPG_NO_CONN, "No such connection %s in line %d.", connection_name, lineno);
|
||||
return (false);
|
||||
}
|
||||
|
||||
@ -1059,13 +1054,34 @@ ECPGdo(int lineno, const char *connection_name, char *query,...)
|
||||
if (con == NULL || con->connection == NULL)
|
||||
{
|
||||
ECPGlog("ECPGdo: not connected to %s\n", con->name);
|
||||
register_error(ECPG_NOT_CONN, "Not connected in line %d", lineno);
|
||||
register_error(ECPG_NOT_CONN, "Not connected in line %d.", lineno);
|
||||
return false;
|
||||
}
|
||||
|
||||
return (ECPGexecute(stmt));
|
||||
}
|
||||
|
||||
bool
|
||||
ECPGstatus(int lineno, const char *connection_name)
|
||||
{
|
||||
struct connection *con = get_connection(connection_name);
|
||||
|
||||
if (con == NULL)
|
||||
{
|
||||
register_error(ECPG_NO_CONN, "No such connection %s in line %d", connection_name, lineno);
|
||||
return (false);
|
||||
}
|
||||
|
||||
/* are we connected? */
|
||||
if (con->connection == NULL)
|
||||
{
|
||||
ECPGlog("ECPGdo: not connected to %s\n", con->name);
|
||||
register_error(ECPG_NOT_CONN, "Not connected in line %d", lineno);
|
||||
return false;
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
bool
|
||||
ECPGtrans(int lineno, const char *connection_name, const char *transaction)
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.11 1999/02/20 07:01:00 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.12 1999/03/20 19:46:53 meskes Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -188,7 +188,6 @@ static ScanKeyword ScanKeywords[] = {
|
||||
{"procedure", PROCEDURE},
|
||||
{"public", PUBLIC},
|
||||
{"read", READ},
|
||||
{"recipe", RECIPE},
|
||||
{"references", REFERENCES},
|
||||
{"relative", RELATIVE},
|
||||
{"rename", RENAME},
|
||||
|
@ -134,8 +134,8 @@ identifier {letter}{letter_or_digit}*
|
||||
|
||||
typecast "::"
|
||||
|
||||
self [,()\[\].$\:\+\-\*\/\<\>\=\|]
|
||||
op_and_self [\~\!\@\#\%\^\&\|\`\?\$\:\+\-\*\/\<\>\=]
|
||||
self [,()\[\].;$\:\+\-\*\/\%\<\>\=\|]
|
||||
op_and_self [\~\!\@\#\^\&\|\?\$\:\+\-\*\/\%\<\>\=]
|
||||
operator {op_and_self}+
|
||||
|
||||
xmstop -
|
||||
@ -299,7 +299,15 @@ cppline {space}*#.*(\\{space}*\n)*\n*
|
||||
BEGIN(xm);
|
||||
return yytext[0];
|
||||
}
|
||||
<SQL>{self} { return yytext[0]; }
|
||||
<SQL>{self} { /*
|
||||
* We may find a ';' inside a structure
|
||||
* definition in a TYPE or VAR statement.
|
||||
* This is not an EOL marker.
|
||||
*/
|
||||
if (yytext[0] == ';' && struct_level == 0)
|
||||
BEGIN C;
|
||||
return yytext[0];
|
||||
}
|
||||
<SQL>{operator}/-[\.0-9] {
|
||||
yylval.str = mm_strdup((char*)yytext);
|
||||
return Op;
|
||||
@ -510,14 +518,6 @@ cppline {space}*#.*(\\{space}*\n)*\n*
|
||||
}
|
||||
}
|
||||
<SQL>{space} { /* ignore */ }
|
||||
<SQL>";" { /*
|
||||
* We may find a ';' inside a structure
|
||||
* definition in a TYPE or VAR statement.
|
||||
* This is not a EOL marker.
|
||||
*/
|
||||
if (struct_level == 0)
|
||||
BEGIN C;
|
||||
return SQL_SEMI; }
|
||||
<SQL>{other} { return yytext[0]; }
|
||||
<C>{exec}{space}{sql} { BEGIN SQL; return SQL_START; }
|
||||
<C>{ccomment} { /* ignore */ }
|
||||
|
@ -652,7 +652,7 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
|
||||
%token SQL_FOUND SQL_FREE SQL_GO SQL_GOTO
|
||||
%token SQL_IDENTIFIED SQL_IMMEDIATE SQL_INDICATOR SQL_INT SQL_LONG
|
||||
%token SQL_OPEN SQL_PREPARE SQL_RELEASE SQL_REFERENCE
|
||||
%token SQL_SECTION SQL_SEMI SQL_SHORT SQL_SIGNED SQL_SQLERROR SQL_SQLPRINT
|
||||
%token SQL_SECTION SQL_SHORT SQL_SIGNED SQL_SQLERROR SQL_SQLPRINT
|
||||
%token SQL_SQLWARNING SQL_START SQL_STOP SQL_STRUCT SQL_UNSIGNED
|
||||
%token SQL_VAR SQL_WHENEVER
|
||||
|
||||
@ -710,7 +710,7 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
|
||||
LANCOMPILER, LIMIT, LISTEN, UNLISTEN, LOAD, LOCATION, LOCK_P, MAXVALUE, MINVALUE, MOVE,
|
||||
NEW, NOCREATEDB, NOCREATEUSER, NONE, NOTHING, NOTIFY, NOTNULL,
|
||||
OFFSET, OIDS, OPERATOR, PASSWORD, PROCEDURAL,
|
||||
RECIPE, RENAME, RESET, RETURNS, ROW, RULE,
|
||||
RENAME, RESET, RETURNS, ROW, RULE,
|
||||
SERIAL, SEQUENCE, SETOF, SHOW, START, STATEMENT, STDIN, STDOUT, TRUSTED,
|
||||
UNLISTEN, UNTIL, VACUUM, VALID, VERBOSE, VERSION
|
||||
|
||||
@ -734,6 +734,7 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
|
||||
%left Op /* multi-character ops and user-defined operators */
|
||||
%nonassoc NOTNULL
|
||||
%nonassoc ISNULL
|
||||
%nonassoc NULL_P
|
||||
%nonassoc IS
|
||||
%left '+' '-'
|
||||
%left '*' '/' '%'
|
||||
@ -839,8 +840,8 @@ prog: statements;
|
||||
statements: /* empty */
|
||||
| statements statement
|
||||
|
||||
statement: ecpgstart opt_at stmt SQL_SEMI { connection = NULL; }
|
||||
| ecpgstart stmt SQL_SEMI
|
||||
statement: ecpgstart opt_at stmt ';' { connection = NULL; }
|
||||
| ecpgstart stmt ';'
|
||||
| ECPGDeclaration
|
||||
| c_thing { fprintf(yyout, "%s", $1); free($1); }
|
||||
| cpp_line { fprintf(yyout, "%s", $1); free($1); }
|
||||
@ -3587,6 +3588,8 @@ a_expr: attr opt_indirection
|
||||
{ $$ = cat3_str($1, make1_str(">"), $3); }
|
||||
| a_expr '=' NULL_P
|
||||
{ $$ = cat2_str($1, make1_str("= NULL")); }
|
||||
| NULL_P '=' a_expr
|
||||
{ $$ = cat2_str(make1_str("= NULL"), $3); }
|
||||
| a_expr '=' a_expr
|
||||
{ $$ = cat3_str($1, make1_str("="), $3); }
|
||||
/* not possible in embedded sql | ':' a_expr
|
||||
@ -4798,9 +4801,9 @@ ECPGDeclaration: sql_startdeclare
|
||||
output_line_number();
|
||||
}
|
||||
|
||||
sql_startdeclare : ecpgstart BEGIN_TRANS DECLARE SQL_SECTION SQL_SEMI {}
|
||||
sql_startdeclare : ecpgstart BEGIN_TRANS DECLARE SQL_SECTION ';' {}
|
||||
|
||||
sql_enddeclare: ecpgstart END_TRANS DECLARE SQL_SECTION SQL_SEMI {}
|
||||
sql_enddeclare: ecpgstart END_TRANS DECLARE SQL_SECTION ';' {}
|
||||
|
||||
variable_declarations: /* empty */
|
||||
{
|
||||
@ -5389,7 +5392,7 @@ sql_declaration: ctype
|
||||
actual_type[struct_level].type_dimension = $1.type_dimension;
|
||||
actual_type[struct_level].type_index = $1.type_index;
|
||||
}
|
||||
sql_variable_list SQL_SEMI
|
||||
sql_variable_list ';'
|
||||
{
|
||||
$$ = cat3_str($1.type_str, $3, make1_str(";"));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user