DBD-QBase
view release on metacpan or search on metacpan
/* --- Event Support (VERY LIABLE TO CHANGE) --- */
#define DBIh_EVENTx(h,t,a1,a2) (DBIS->event((h), (t), (a1), (a2)))
#define DBIh_EVENT0(h,t) DBIh_EVENTx((h), (t), &sv_undef, &sv_undef)
#define DBIh_EVENT1(h,t, a1) DBIh_EVENTx((h), (t), (a1), &sv_undef)
#define DBIh_EVENT2(h,t, a1,a2) DBIh_EVENTx((h), (t), (a1), (a2))
#define ERROR_event "ERROR"
#define WARN_event "WARN"
#define MSG_event "MESSAGE"
#define DBEVENT_event "DBEVENT"
#define UNKNOWN_event "UNKNOWN"
/* --- DBI State Structure --- */
typedef struct {
/* version and size are used to check for DBI/DBD version mis-match */
U16 version; /* version of this structure */
U16 size;
U16 xs_version; /* version of the overall DBIXS / DBD interface */
int debug;
int debugpvlen; /* only show dbgpvlen chars when debugging pv's */
FILE *logfp;
/* pointers to DBI functions which the DBD's will want to use */
imp_xxh_t * (*getcom) _((SV *h)); /* see DBIh_COM macro */
void (*clearcom) _((imp_xxh_t *imp_xxh));
SV * (*event) _((SV *h, char *name, SV*, SV*));
int (*set_attr) _((SV *h, SV *keysv, SV *valuesv));
SV * (*get_attr) _((SV *h, SV *keysv));
AV * (*get_fbav) _((imp_sth_t *imp_sth));
SV *pad1;
SV *pad2;
} dbistate_t;
#define DBISTATE_VERSION 7 /* Must change whenever dbistate_t does */
#define DBIS dbis /* default name for dbistate_t variable */
#define DBISTATE_DECLARE static dbistate_t *DBIS
#define DBISTATE_PERLNAME "DBI::_dbistate"
#define DBISTATE_ADDRSV (perl_get_sv(DBISTATE_PERLNAME, 0x05))
#define DBISTATE_INIT_DBIS (DBIS = (dbistate_t*)SvIV(DBISTATE_ADDRSV))
#define DBISTATE_INIT { /* typically use in BOOT: of XS file */ \
DBISTATE_INIT_DBIS; \
if (DBIS == NULL) \
croak("Unable to get DBI state. DBI not loaded."); \
if (DBIS->version < DBISTATE_VERSION || DBIS->size < sizeof(*DBIS)) \
croak("DBI version mismatch (DBI actual v%d/s%d, expected v%d/s%d)", \
DBIS->version, DBIS->size, DBISTATE_VERSION, (int)sizeof(*DBIS)); \
}
#define DBILOGFP (DBIS->logfp)
/* --- Assorted Utility Macros --- */
#define DBI_INTERNAL_ERROR(msg) \
croak("%s: file \"%s\", line %d", msg, __FILE__, __LINE__);
#define DBD_ATTRIBS_CHECK(func, h, attribs) \
if ((attribs) && SvOK(attribs)) { \
if (!SvROK(attribs) || SvTYPE(SvRV(attribs))!=SVt_PVHV) \
croak("%s->%s(...): attribute parameter is not a hash ref", \
SvPV(h,na), func); \
} else (attribs) = Nullsv
#define DBD_ATTRIB_GET_SVP(attribs, key, klen) \
hv_fetch((HV*)SvRV(attribs), key, klen, 0)
#define DBD_ATTRIB_GET_BOOL(attribs, key,klen, svp, var) \
if ( (svp=DBD_ATTRIB_GET_SVP(attribs, key,klen)) != NULL) \
var = SvTRUE(*svp)
#define DBD_ATTRIB_GET_IV(attribs, key,klen, svp, var) \
if ( (svp=DBD_ATTRIB_GET_SVP(attribs, key,klen)) != NULL) \
var = SvIV(*svp)
/* end of DBIXS.h */
( run in 1.399 second using v1.01-cache-2.11-cpan-39bf76dae61 )