mirror of
https://github.com/postgres/postgres.git
synced 2025-05-02 11:44:50 +03:00
*** 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.
|
- Synced preproc.y with gram.y.
|
||||||
- Added '%' operator.
|
- 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 library version to 3.0.0
|
||||||
- Set ecpg version to 2.6.0
|
- Set ecpg version to 2.6.0
|
||||||
|
@ -23,8 +23,6 @@
|
|||||||
#define ECPG_CONVERT_BOOL -207
|
#define ECPG_CONVERT_BOOL -207
|
||||||
#define ECPG_EMPTY -208
|
#define ECPG_EMPTY -208
|
||||||
|
|
||||||
#define ECPG_UNDECLARED_CURSOR -210
|
|
||||||
|
|
||||||
#define ECPG_NO_CONN -220
|
#define ECPG_NO_CONN -220
|
||||||
#define ECPG_NOT_CONN -221
|
#define ECPG_NOT_CONN -221
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ extern "C"
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void ECPGdebug(int, FILE *);
|
void ECPGdebug(int, FILE *);
|
||||||
|
bool ECPGstatus(int, const char *);
|
||||||
bool ECPGsetconn(int, const char *);
|
bool ECPGsetconn(int, const char *);
|
||||||
bool ECPGconnect(int, const char *, const char *, const char *, const char *);
|
bool ECPGconnect(int, const char *, const char *, const char *, const char *);
|
||||||
bool ECPGdo(int, const char *, char *,...);
|
bool ECPGdo(int, const char *, char *,...);
|
||||||
|
@ -183,7 +183,7 @@ ecpg_alloc(long size, int lineno)
|
|||||||
if (!new)
|
if (!new)
|
||||||
{
|
{
|
||||||
ECPGlog("out of memory\n");
|
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;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ ecpg_strdup(const char *string, int lineno)
|
|||||||
if (!new)
|
if (!new)
|
||||||
{
|
{
|
||||||
ECPGlog("out of memory\n");
|
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;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -336,7 +336,7 @@ create_statement(int lineno, struct connection *connection, struct statement **
|
|||||||
if (var->pointer == NULL)
|
if (var->pointer == NULL)
|
||||||
{
|
{
|
||||||
ECPGlog("create_statement: invalid statement name\n");
|
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);
|
free(var);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -387,7 +387,7 @@ next_insert(char *text)
|
|||||||
static bool
|
static bool
|
||||||
ECPGexecute(struct statement * stmt)
|
ECPGexecute(struct statement * stmt)
|
||||||
{
|
{
|
||||||
bool status = false;
|
bool status = false;
|
||||||
char *copiedquery;
|
char *copiedquery;
|
||||||
PGresult *results;
|
PGresult *results;
|
||||||
PGnotify *notify;
|
PGnotify *notify;
|
||||||
@ -637,7 +637,7 @@ ECPGexecute(struct statement * stmt)
|
|||||||
{
|
{
|
||||||
if ((results = PQexec(stmt->connection->connection, "begin transaction")) == NULL)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
PQclear(results);
|
PQclear(results);
|
||||||
@ -708,7 +708,7 @@ ECPGexecute(struct statement * stmt)
|
|||||||
/*
|
/*
|
||||||
* allocate memory for NULL pointers
|
* 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;
|
int len = 0;
|
||||||
|
|
||||||
@ -716,34 +716,28 @@ ECPGexecute(struct statement * stmt)
|
|||||||
{
|
{
|
||||||
case ECPGt_char:
|
case ECPGt_char:
|
||||||
case ECPGt_unsigned_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;
|
int len = strlen(PQgetvalue(results, act_tuple, act_field)) + 1;
|
||||||
/* check strlen for each tuple */
|
|
||||||
for (act_tuple = 0; act_tuple < ntuples; act_tuple++)
|
if (len > var->varcharsize)
|
||||||
{
|
var->varcharsize = len;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
var->offset *= var->varcharsize;
|
||||||
|
len = var->offset * ntuples;
|
||||||
break;
|
break;
|
||||||
case ECPGt_varchar:
|
case ECPGt_varchar:
|
||||||
if (var->value == NULL)
|
len = ntuples * (var->varcharsize + sizeof (int));
|
||||||
len = ntuples * (var->varcharsize + sizeof (int));
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (var->value == NULL)
|
len = var->offset * ntuples;
|
||||||
len = var->offset * ntuples;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
var->value = (void *) ecpg_alloc(len, stmt->lineno);
|
||||||
var->pointer = (void *) ecpg_alloc(len, stmt->lineno);
|
*((void **) var->pointer) = var->value;
|
||||||
var->value = (void **) var->pointer;
|
add_mem(var->value, stmt->lineno);
|
||||||
add_mem((void *) var->value, stmt->lineno);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (act_tuple = 0; act_tuple < ntuples && status; act_tuple++)
|
for (act_tuple = 0; act_tuple < ntuples && status; act_tuple++)
|
||||||
@ -1004,7 +998,7 @@ ECPGexecute(struct statement * stmt)
|
|||||||
case PGRES_BAD_RESPONSE:
|
case PGRES_BAD_RESPONSE:
|
||||||
ECPGlog("ECPGexecute line %d: Error: %s",
|
ECPGlog("ECPGexecute line %d: Error: %s",
|
||||||
stmt->lineno, PQerrorMessage(stmt->connection->connection));
|
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);
|
PQerrorMessage(stmt->connection->connection), stmt->lineno);
|
||||||
status = false;
|
status = false;
|
||||||
break;
|
break;
|
||||||
@ -1019,7 +1013,8 @@ ECPGexecute(struct statement * stmt)
|
|||||||
default:
|
default:
|
||||||
ECPGlog("ECPGexecute line %d: Got something else, postgres error.\n",
|
ECPGlog("ECPGexecute line %d: Got something else, postgres error.\n",
|
||||||
stmt->lineno);
|
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;
|
status = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1046,7 +1041,7 @@ ECPGdo(int lineno, const char *connection_name, char *query,...)
|
|||||||
|
|
||||||
if (con == NULL)
|
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);
|
return (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1059,13 +1054,34 @@ ECPGdo(int lineno, const char *connection_name, char *query,...)
|
|||||||
if (con == NULL || con->connection == NULL)
|
if (con == NULL || con->connection == NULL)
|
||||||
{
|
{
|
||||||
ECPGlog("ECPGdo: not connected to %s\n", con->name);
|
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 false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (ECPGexecute(stmt));
|
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
|
bool
|
||||||
ECPGtrans(int lineno, const char *connection_name, const char *transaction)
|
ECPGtrans(int lineno, const char *connection_name, const char *transaction)
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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},
|
{"procedure", PROCEDURE},
|
||||||
{"public", PUBLIC},
|
{"public", PUBLIC},
|
||||||
{"read", READ},
|
{"read", READ},
|
||||||
{"recipe", RECIPE},
|
|
||||||
{"references", REFERENCES},
|
{"references", REFERENCES},
|
||||||
{"relative", RELATIVE},
|
{"relative", RELATIVE},
|
||||||
{"rename", RENAME},
|
{"rename", RENAME},
|
||||||
|
@ -134,8 +134,8 @@ identifier {letter}{letter_or_digit}*
|
|||||||
|
|
||||||
typecast "::"
|
typecast "::"
|
||||||
|
|
||||||
self [,()\[\].$\:\+\-\*\/\<\>\=\|]
|
self [,()\[\].;$\:\+\-\*\/\%\<\>\=\|]
|
||||||
op_and_self [\~\!\@\#\%\^\&\|\`\?\$\:\+\-\*\/\<\>\=]
|
op_and_self [\~\!\@\#\^\&\|\?\$\:\+\-\*\/\%\<\>\=]
|
||||||
operator {op_and_self}+
|
operator {op_and_self}+
|
||||||
|
|
||||||
xmstop -
|
xmstop -
|
||||||
@ -299,7 +299,15 @@ cppline {space}*#.*(\\{space}*\n)*\n*
|
|||||||
BEGIN(xm);
|
BEGIN(xm);
|
||||||
return yytext[0];
|
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] {
|
<SQL>{operator}/-[\.0-9] {
|
||||||
yylval.str = mm_strdup((char*)yytext);
|
yylval.str = mm_strdup((char*)yytext);
|
||||||
return Op;
|
return Op;
|
||||||
@ -510,14 +518,6 @@ cppline {space}*#.*(\\{space}*\n)*\n*
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
<SQL>{space} { /* ignore */ }
|
<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]; }
|
<SQL>{other} { return yytext[0]; }
|
||||||
<C>{exec}{space}{sql} { BEGIN SQL; return SQL_START; }
|
<C>{exec}{space}{sql} { BEGIN SQL; return SQL_START; }
|
||||||
<C>{ccomment} { /* ignore */ }
|
<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_FOUND SQL_FREE SQL_GO SQL_GOTO
|
||||||
%token SQL_IDENTIFIED SQL_IMMEDIATE SQL_INDICATOR SQL_INT SQL_LONG
|
%token SQL_IDENTIFIED SQL_IMMEDIATE SQL_INDICATOR SQL_INT SQL_LONG
|
||||||
%token SQL_OPEN SQL_PREPARE SQL_RELEASE SQL_REFERENCE
|
%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_SQLWARNING SQL_START SQL_STOP SQL_STRUCT SQL_UNSIGNED
|
||||||
%token SQL_VAR SQL_WHENEVER
|
%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,
|
LANCOMPILER, LIMIT, LISTEN, UNLISTEN, LOAD, LOCATION, LOCK_P, MAXVALUE, MINVALUE, MOVE,
|
||||||
NEW, NOCREATEDB, NOCREATEUSER, NONE, NOTHING, NOTIFY, NOTNULL,
|
NEW, NOCREATEDB, NOCREATEUSER, NONE, NOTHING, NOTIFY, NOTNULL,
|
||||||
OFFSET, OIDS, OPERATOR, PASSWORD, PROCEDURAL,
|
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,
|
SERIAL, SEQUENCE, SETOF, SHOW, START, STATEMENT, STDIN, STDOUT, TRUSTED,
|
||||||
UNLISTEN, UNTIL, VACUUM, VALID, VERBOSE, VERSION
|
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 */
|
%left Op /* multi-character ops and user-defined operators */
|
||||||
%nonassoc NOTNULL
|
%nonassoc NOTNULL
|
||||||
%nonassoc ISNULL
|
%nonassoc ISNULL
|
||||||
|
%nonassoc NULL_P
|
||||||
%nonassoc IS
|
%nonassoc IS
|
||||||
%left '+' '-'
|
%left '+' '-'
|
||||||
%left '*' '/' '%'
|
%left '*' '/' '%'
|
||||||
@ -839,8 +840,8 @@ prog: statements;
|
|||||||
statements: /* empty */
|
statements: /* empty */
|
||||||
| statements statement
|
| statements statement
|
||||||
|
|
||||||
statement: ecpgstart opt_at stmt SQL_SEMI { connection = NULL; }
|
statement: ecpgstart opt_at stmt ';' { connection = NULL; }
|
||||||
| ecpgstart stmt SQL_SEMI
|
| ecpgstart stmt ';'
|
||||||
| ECPGDeclaration
|
| ECPGDeclaration
|
||||||
| c_thing { fprintf(yyout, "%s", $1); free($1); }
|
| c_thing { fprintf(yyout, "%s", $1); free($1); }
|
||||||
| cpp_line { 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); }
|
{ $$ = cat3_str($1, make1_str(">"), $3); }
|
||||||
| a_expr '=' NULL_P
|
| a_expr '=' NULL_P
|
||||||
{ $$ = cat2_str($1, make1_str("= NULL")); }
|
{ $$ = cat2_str($1, make1_str("= NULL")); }
|
||||||
|
| NULL_P '=' a_expr
|
||||||
|
{ $$ = cat2_str(make1_str("= NULL"), $3); }
|
||||||
| a_expr '=' a_expr
|
| a_expr '=' a_expr
|
||||||
{ $$ = cat3_str($1, make1_str("="), $3); }
|
{ $$ = cat3_str($1, make1_str("="), $3); }
|
||||||
/* not possible in embedded sql | ':' a_expr
|
/* not possible in embedded sql | ':' a_expr
|
||||||
@ -4798,9 +4801,9 @@ ECPGDeclaration: sql_startdeclare
|
|||||||
output_line_number();
|
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 */
|
variable_declarations: /* empty */
|
||||||
{
|
{
|
||||||
@ -5389,7 +5392,7 @@ sql_declaration: ctype
|
|||||||
actual_type[struct_level].type_dimension = $1.type_dimension;
|
actual_type[struct_level].type_dimension = $1.type_dimension;
|
||||||
actual_type[struct_level].type_index = $1.type_index;
|
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(";"));
|
$$ = cat3_str($1.type_str, $3, make1_str(";"));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user