PostgreSQL Source Code
git master
|
#include "postgres_fe.h"
#include <ctype.h>
#include "ecpgerrno.h"
#include "ecpglib.h"
#include "ecpglib_extern.h"
#include "ecpgtype.h"
#include "sqlca.h"
Go to the source code of this file.
Data Structures | |
struct | stmtCacheEntry |
Macros | |
#define | POSTGRES_ECPG_INTERNAL |
#define | STMTID_SIZE 32 |
#define | stmtCacheNBuckets 2039 /* should be a prime number */ |
#define | stmtCacheEntPerBucket 8 |
#define | stmtCacheArraySize (stmtCacheNBuckets * stmtCacheEntPerBucket + 1) |
Functions | |
static bool | deallocate_one (int lineno, enum COMPAT_MODE c, struct connection *con, struct prepared_statement *prev, struct prepared_statement *this) |
static bool | isvarchar (unsigned char c) |
bool | ecpg_register_prepared_stmt (struct statement *stmt) |
static bool | replace_variables (char **text, int lineno) |
static bool | prepare_common (int lineno, struct connection *con, const char *name, const char *variable) |
bool | ECPGprepare (int lineno, const char *connection_name, const bool questionmarks, const char *name, const char *variable) |
struct prepared_statement * | ecpg_find_prepared_statement (const char *name, struct connection *con, struct prepared_statement **prev_) |
bool | ECPGdeallocate (int lineno, int c, const char *connection_name, const char *name) |
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) |
char * | ecpg_prepared (const char *name, struct connection *con) |
char * | ECPGprepared_statement (const char *connection_name, const char *name, int lineno) |
static int | HashStmt (const char *ecpgQuery) |
static int | SearchStmtCache (const char *ecpgQuery) |
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_auto_prepare (int lineno, const char *connection_name, const int compat, char **name, const char *query) |
Variables | |
static int | nextStmtID = 1 |
static stmtCacheEntry * | stmtCacheEntries = NULL |
#define stmtCacheArraySize (stmtCacheNBuckets * stmtCacheEntPerBucket + 1) |
#define stmtCacheNBuckets 2039 /* should be a prime number */ |
|
static |
Definition at line 491 of file prepare.c.
References compat, stmtCacheEntry::connection, connection, ecpg_alloc(), ecpg_freeStmtCacheEntry(), ecpg_strdup(), stmtCacheEntry::ecpgQuery, stmtCacheEntry::execs, HashStmt(), stmtCacheEntry::lineno, stmtCacheArraySize, stmtCacheEntPerBucket, stmtCacheEntries, and stmtCacheEntry::stmtID.
Referenced by ecpg_auto_prepare().
|
static |
Definition at line 260 of file prepare.c.
References ecpg_alloc(), ecpg_check_PQresult(), ecpg_free(), ECPG_INVALID_STMT, ecpg_log(), ecpg_raise(), ECPG_SQLSTATE_INVALID_SQL_STATEMENT_NAME, INFORMIX_MODE, name, next, prepared_statement::next, PQclear(), PQexec(), connection::prep_stmts, prepared_statement::prepared, sprintf, and stmt.
Referenced by ecpg_deallocate_all_conn(), ecpg_freeStmtCacheEntry(), ecpg_register_prepared_stmt(), ECPGdeallocate(), and ECPGprepare().
bool ecpg_auto_prepare | ( | int | lineno, |
const char * | connection_name, | ||
const int | compat, | ||
char ** | name, | ||
const char * | query | ||
) |
Definition at line 553 of file prepare.c.
References AddStmtToCache(), compat, ecpg_find_prepared_statement(), ecpg_get_connection(), ecpg_log(), ecpg_strdup(), ECPGprepare(), stmtCacheEntry::execs, name, nextStmtID, prepare_common(), SearchStmtCache(), sprintf, stmtCacheEntries, stmtCacheEntry::stmtID, and STMTID_SIZE.
Referenced by ecpg_do_prologue().
bool ecpg_deallocate_all_conn | ( | int | lineno, |
enum COMPAT_MODE | c, | ||
struct connection * | con | ||
) |
Definition at line 337 of file prepare.c.
References deallocate_one(), and connection::prep_stmts.
Referenced by ecpg_finish(), and ECPGdeallocate_all().
struct prepared_statement* ecpg_find_prepared_statement | ( | const char * | name, |
struct connection * | con, | ||
struct prepared_statement ** | prev_ | ||
) |
Definition at line 239 of file prepare.c.
References name, prepared_statement::next, and connection::prep_stmts.
Referenced by ecpg_auto_prepare(), ecpg_freeStmtCacheEntry(), ecpg_prepared(), ecpg_register_prepared_stmt(), ECPGdeallocate(), ECPGdescribe(), and ECPGprepare().
|
static |
Definition at line 451 of file prepare.c.
References compat, stmtCacheEntry::connection, deallocate_one(), ecpg_find_prepared_statement(), ecpg_free(), ecpg_get_connection(), stmtCacheEntry::ecpgQuery, stmtCacheEntries, and stmtCacheEntry::stmtID.
Referenced by AddStmtToCache().
char* ecpg_prepared | ( | const char * | name, |
struct connection * | con | ||
) |
Definition at line 357 of file prepare.c.
References ecpg_find_prepared_statement(), name, and stmt.
Referenced by ecpg_do_prologue(), and ECPGprepared_statement().
Definition at line 59 of file prepare.c.
References statement::command, statement::connection, deallocate_one(), ecpg_alloc(), ECPG_COMPAT_PGSQL, ecpg_find_prepared_statement(), ecpg_free(), ecpg_strdup(), statement::inlist, statement::lineno, name, statement::name, next, statement::outlist, connection::prep_stmts, and stmt.
Referenced by ecpg_execute().
bool ECPGdeallocate | ( | int | lineno, |
int | c, | ||
const char * | connection_name, | ||
const char * | name | ||
) |
Definition at line 315 of file prepare.c.
References deallocate_one(), ecpg_find_prepared_statement(), ecpg_get_connection(), ecpg_init(), ECPG_INVALID_STMT, ecpg_raise(), ECPG_SQLSTATE_INVALID_SQL_STATEMENT_NAME, INFORMIX_MODE, and name.
Referenced by execute_test(), fn(), and main().
bool ECPGdeallocate_all | ( | int | lineno, |
int | compat, | ||
const char * | connection_name | ||
) |
Definition at line 350 of file prepare.c.
References compat, ecpg_deallocate_all_conn(), and ecpg_get_connection().
Referenced by main().
bool ECPGprepare | ( | int | lineno, |
const char * | connection_name, | ||
const bool | questionmarks, | ||
const char * | name, | ||
const char * | variable | ||
) |
Definition at line 217 of file prepare.c.
References deallocate_one(), ECPG_COMPAT_PGSQL, ecpg_find_prepared_statement(), ecpg_get_connection(), ecpg_init(), name, prepare_common(), and questionmarks.
Referenced by ecpg_auto_prepare(), execute_test(), fn(), main(), and test().
char* ECPGprepared_statement | ( | const char * | connection_name, |
const char * | name, | ||
int | lineno | ||
) |
Definition at line 368 of file prepare.c.
References ecpg_get_connection(), ecpg_prepared(), and name.
Referenced by execute_test(), main(), and test().
|
static |
Definition at line 379 of file prepare.c.
References stmtCacheEntPerBucket, and stmtCacheNBuckets.
Referenced by AddStmtToCache(), and SearchStmtCache().
|
static |
|
static |
Definition at line 159 of file prepare.c.
References ecpg_alloc(), ecpg_check_PQresult(), ecpg_free(), ecpg_log(), ecpg_strdup(), statement::lineno, name, next, PQclear(), PQprepare(), connection::prep_stmts, replace_variables(), and stmt.
Referenced by ecpg_auto_prepare(), and ECPGprepare().
|
static |
Definition at line 104 of file prepare.c.
References ecpg_alloc(), ecpg_free(), false, isvarchar(), len, statement::lineno, and snprintf.
Referenced by prepare_common().
|
static |
Definition at line 415 of file prepare.c.
References HashStmt(), stmtCacheEntPerBucket, and stmtCacheEntries.
Referenced by ecpg_auto_prepare().
|
static |
Definition at line 37 of file prepare.c.
Referenced by ecpg_auto_prepare().
|
static |
Definition at line 38 of file prepare.c.
Referenced by AddStmtToCache(), ecpg_auto_prepare(), ecpg_freeStmtCacheEntry(), and SearchStmtCache().