DBD-Pg
view release on metacpan or search on metacpan
bool prepare_now; /* force immediate prepares, even with placeholders. Set by user, default is 0 */
bool done_begin; /* have we done a begin? (e.g. are we in a transaction?) */
bool dollaronly; /* only consider $1, $2 ... as valid placeholders */
bool nocolons; /* do not consider :1, :2 ... as valid placeholders */
bool ph_escaped; /* allow backslash to escape placeholders */
bool expand_array; /* transform arrays from the db into Perl arrays? Default is 1 */
bool txn_read_only; /* are we in read-only mode? Set with $dbh->{ReadOnly} */
int pg_enable_utf8; /* legacy utf8 flag: force utf8 flag on or off, regardless of client_encoding */
bool pg_utf8_flag; /* are we currently flipping the utf8 flag on? */
bool client_encoding_utf8; /* is the client_encoding utf8 last we checked? */
PGresult *last_result; /* PGresult structure from the last executed query (can be from imp_dbh or imp_sth) */
bool result_clearable; /* Is it alright to call PQclear on last_result? (statements handles set it to false */
imp_sth_t *do_tmp_sth; /* temporary sth to refer inside a do() call */
};
/* Each statement is broken up into segments */
struct seg_st {
char *segment; /* non-placeholder string segment */
int placeholder; /* which placeholder this points to, 0=none */
struct ph_st *ph; /* points to the relevant ph structure */
struct seg_st *nextseg; /* linked lists are fun */
};
typedef struct seg_st seg_t;
/* The placeholders are also a linked list */
struct ph_st {
char *fooname; /* name if using :foo style */
char *value; /* the literal passed-in value, may be binary */
STRLEN valuelen; /* length of the value */
char *quoted; /* quoted version of the value, for PQexec only */
STRLEN quotedlen; /* length of the quoted value */
bool referenced; /* used for PREPARE AS construction */
bool defaultval; /* is it using a generic 'default' value? */
bool iscurrent; /* do we want to use a literal CURRENT_TIMESTAMP? */
bool isdefault; /* are we passing a literal 'DEFAULT'? */
bool isinout; /* is this a bind_param_inout value? */
SV *inout; /* what variable we are updating via inout magic */
sql_type_info_t* bind_type; /* type information for this placeholder */
struct ph_st *nextph; /* more linked list goodness */
};
typedef struct ph_st ph_t;
typedef enum
{
PLACEHOLDER_NONE,
PLACEHOLDER_QUESTIONMARK,
PLACEHOLDER_DOLLAR,
PLACEHOLDER_COLON
} PGPlaceholderType;
#define PLACEHOLDER_TYPE_COUNT (PLACEHOLDER_COLON + 1)
/* Define sth implementor data structure */
struct imp_sth_st {
dbih_stc_t com; /* MUST be first element in structure */
bool server_prepare; /* inherited from dbh */
int switch_prepared; /* inherited from dbh */
int number_iterations; /* how many times has the statement been executed? Used by switch_prepared */
PGPlaceholderType placeholder_type; /* which style is being used 1=? 2=$1 3=:foo */
int numsegs; /* how many segments this statement has */
int numphs; /* how many placeholders this statement has */
int numbound; /* how many placeholders were explicitly bound by the client, not us */
int cur_tuple; /* current tuple being fetched */
long rows; /* number of affected rows */
int async_flag; /* async? 0=no 1=async 2=cancel 4=wait */
int async_status; /* 0=no async 1=async started -1=async has been cancelled */
STRLEN totalsize; /* total string length of the statement (with no placeholders)*/
const char ** PQvals; /* List of values to pass to PQ* */
int * PQlens; /* List of lengths to pass to PQ* */
int * PQfmts; /* List of formats to pass to PQ* */
Oid * PQoids; /* List of types to pass to PQ* */
char *prepare_name; /* name of the prepared query; NULL if not prepared */
char *firstword; /* first word of the statement */
PGresult *result; /* result structure from the executed query */
sql_type_info_t **type_info; /* type of each column in result */
seg_t *seg; /* linked list of segments */
ph_t *ph; /* linked list of placeholders */
bool prepare_now; /* prepare this statement right away, even if it has placeholders */
bool prepared_by_us; /* false if {prepare_name} set directly */
bool direct; /* allow bypassing of the statement parsing */
bool is_dml; /* is this SELECT/INSERT/UPDATE/DELETE/MERGE/VALUES/TABLE/WITH? */
bool has_binary; /* does it have one or more binary placeholders? */
bool has_default; /* does it have one or more 'DEFAULT' values? */
bool has_current; /* does it have one or more 'DEFAULT' values? */
bool dollaronly; /* Only use $1 as placeholders, allow all else */
bool nocolons; /* do not consider :1, :2 ... as valid placeholders */
bool use_inout; /* Any placeholders using inout? */
bool all_bound; /* Have all placeholders been bound? */
};
/* Avoid name clashes by assigning DBI funcs to a pg_ name. */
/* In order of appearance in dbdimp.c */
#define dbd_init pg_init
extern void dbd_init (dbistate_t *dbistate);
#define dbd_db_login6 pg_db_login6
int dbd_db_login6 (SV * dbh, imp_dbh_t * imp_dbh, char * dbname, char * uid, char * pwd, SV *attr);
#define dbd_db_continue_connect pg_db_continue_connect
int dbd_db_continue_connect(SV *h);
#define dbd_db_ping pg_db_ping
int dbd_db_ping(SV *dbh);
#define dbd_db_commit pg_db_commit
int dbd_db_commit (SV * dbh, imp_dbh_t * imp_dbh);
#define dbd_db_rollback pg_db_rollback
int dbd_db_rollback (SV * dbh, imp_dbh_t * imp_dbh);
#define dbd_db_disconnect pg_db_disconnect
( run in 0.731 second using v1.01-cache-2.11-cpan-71847e10f99 )