3#define POSTGRES_ECPG_INTERNAL
23#define stmtCacheNBuckets 2039
24#define stmtCacheEntPerBucket 8
26#define stmtCacheArraySize (stmtCacheNBuckets * stmtCacheEntPerBucket + 1)
49 if (
c ==
'_' ||
c ==
'>' ||
c ==
'-' ||
c ==
'.')
65 int lineno =
stmt->lineno;
105 this->prepared =
true;
123 for (; (*text)[ptr] !=
'\0'; ptr++)
125 if ((*
text)[ptr] ==
'\'')
126 string =
string ?
false :
true;
128 if (
string || (((*
text)[ptr] !=
':') && ((*
text)[ptr] !=
'?')))
131 if (((*
text)[ptr] ==
':') && ((*
text)[ptr + 1] ==
':'))
163 if ((*
text)[ptr] ==
'\0')
192 stmt->connection = con;
233 ecpg_log(
"prepare_common on line %d: name %s; query: \"%s\"\n",
stmt->lineno,
name,
stmt->command);
235 this->prepared =
true;
279 prev =
this,
this = this->
next)
297 ecpg_log(
"deallocate_one on line %d: name %s\n", lineno, this->
name);
310 query =
PQexec(this->
stmt->connection->connection, text);
313 this->
stmt->connection->connection,
394 return this ? this->
stmt->command :
NULL;
527 const char *ecpgQuery)
601 ecpg_log(
"ecpg_auto_prepare on line %d: statement found in cache; entry %d\n", lineno,
entNo);
622 ecpg_log(
"ecpg_auto_prepare on line %d: statement not in cache; inserting\n", lineno);
struct connection * ecpg_get_connection(const char *connection_name)
#define ECPG_INVALID_STMT
bool ecpg_check_PQresult(PGresult *results, int lineno, PGconn *connection, enum COMPAT_MODE compat)
char * ecpg_strdup(const char *string, int lineno, bool *alloc_failed)
char * ecpg_alloc(long size, int lineno)
void ecpg_log(const char *format,...) pg_attribute_printf(1
bool ecpg_init(const struct connection *con, const char *connection_name, const int lineno)
void ecpg_raise(int line, int code, const char *sqlstate, const char *str)
void ecpg_free(void *ptr)
#define ECPG_SQLSTATE_INVALID_SQL_STATEMENT_NAME
PGresult * PQprepare(PGconn *conn, const char *stmtName, const char *query, int nParams, const Oid *paramTypes)
PGresult * PQexec(PGconn *conn, const char *query)
static bool prepare_common(int lineno, struct connection *con, const char *name, const char *variable)
static bool deallocate_one(int lineno, enum COMPAT_MODE c, struct connection *con, struct prepared_statement *prev, struct prepared_statement *this)
bool ecpg_deallocate_all_conn(int lineno, enum COMPAT_MODE c, struct connection *con)
bool ECPGdeallocate_all(int lineno, int compat, const char *connection_name)
static int ecpg_freeStmtCacheEntry(int lineno, int compat, int entNo)
static int AddStmtToCache(int lineno, const char *stmtID, const char *connection, int compat, const char *ecpgQuery)
bool ecpg_register_prepared_stmt(struct statement *stmt)
static int SearchStmtCache(const char *ecpgQuery)
static bool isvarchar(unsigned char c)
char * ECPGprepared_statement(const char *connection_name, const char *name, int lineno)
static int HashStmt(const char *ecpgQuery)
bool ECPGprepare(int lineno, const char *connection_name, const bool questionmarks, const char *name, const char *variable)
char * ecpg_prepared(const char *name, struct connection *con)
#define stmtCacheEntPerBucket
struct prepared_statement * ecpg_find_prepared_statement(const char *name, struct connection *con, struct prepared_statement **prev_)
static stmtCacheEntry * stmtCacheEntries
bool ecpg_auto_prepare(int lineno, const char *connection_name, const int compat, char **name, const char *query)
static bool replace_variables(char **text, int lineno)
bool ECPGdeallocate(int lineno, int c, const char *connection_name, const char *name)
#define stmtCacheNBuckets
#define stmtCacheArraySize
struct prepared_statement * prep_stmts
struct prepared_statement * next