DBD-InterBase

 view release on metacpan or  search on metacpan

dbdimp.h  view on Meta::CPAN

/* structs for event */
typedef struct
{
    imp_dbh_t       *dbh;               /* pointer to parent dbh */
    ISC_LONG        id;                 /* event id assigned by IB */
#if defined(INCLUDE_TYPES_PUB_H)
    ISC_UCHAR       *event_buffer;
    ISC_UCHAR       *result_buffer;
#else
    char ISC_FAR    *event_buffer;
    char ISC_FAR    *result_buffer;
#endif
    char ISC_FAR * ISC_FAR *names;      /* names of events of interest */
    unsigned short  num;                /* number of events of interest */
    short           epb_length;         /* length of event parameter buffer */
    SV              *perl_cb;           /* perl callback for this event */
    IB_EVENT_STATE  state;
    char            exec_cb;
} IB_EVENT;

/* Define driver handle data structure */
struct imp_drh_st
{
    dbih_drc_t com;     /* MUST be first element in structure */
};

/* Define dbh implementor data structure */
struct imp_dbh_st
{
    dbih_dbc_t      com;                /* MUST be first element in structure */
    isc_db_handle   db;
    isc_tr_handle   tr;
    char ISC_FAR    *tpb_buffer;        /* transaction parameter buffer */
    unsigned short  tpb_length;         /* length of tpb_buffer */
    unsigned short  sqldialect;         /* default sql dialect */
    char            soft_commit;        /* use soft commit ? */

    unsigned int    sth_ddl;            /* number of open DDL statments */
    imp_sth_t       *first_sth;         /* pointer to first statement */
    imp_sth_t       *last_sth;          /* pointer to last statement */

#if defined(USE_THREADS) || defined(USE_ITHREADS) || defined(MULTIPLICITY)
    void            *context;           /* perl context for threads / multiplicity */
#endif

    /* per dbh default strftime() formats */
    char            *dateformat;
#ifdef IB_API_V6
    char            *timestampformat;
    char            *timeformat;
#endif
};

/* Define sth implementor data structure */
struct imp_sth_st
{
    dbih_stc_t      com;                /* MUST be first element in structure */
    isc_stmt_handle stmt;
    XSQLDA          *out_sqlda;         /* for storing select-list items */
    XSQLDA          *in_sqlda;          /* for storing placeholder values */
    char            *cursor_name;
    long            type;               /* statement type */
    char            count_item;
    int             fetched;            /* number of fetched rows */

    char            *dateformat;
#ifdef IB_API_V6
    char            *timestampformat;
    char            *timeformat;
#endif
    imp_sth_t       *prev_sth;                /* pointer to prev statement */
    imp_sth_t       *next_sth;                /* pointer to next statement */
};


/* newer header file defines the struct already */
typedef struct dbd_vary
{
    short vary_length;
    char  vary_string [1];
} DBD_VARY;


/* These defines avoid name clashes for multiple statically linked DBD's */
#define dbd_init            ib_init
#define dbd_discon_all      ib_discon_all
#define dbd_db_login        ib_db_login
#define dbd_db_login6       ib_db_login6
#define dbd_db_do           ib_db_do
#define dbd_db_commit       ib_db_commit
#define dbd_db_rollback     ib_db_rollback
#define dbd_db_disconnect   ib_db_disconnect
#define dbd_db_destroy      ib_db_destroy
#define dbd_db_STORE_attrib ib_db_STORE_attrib
#define dbd_db_FETCH_attrib ib_db_FETCH_attrib
#define dbd_st_prepare      ib_st_prepare
#define dbd_st_rows         ib_st_rows
#define dbd_st_execute      ib_st_execute
#define dbd_st_fetch        ib_st_fetch
#define dbd_st_finish       ib_st_finish
#define dbd_st_destroy      ib_st_destroy
#define dbd_st_blob_read    ib_st_blob_read
#define dbd_st_STORE_attrib ib_st_STORE_attrib
#define dbd_st_FETCH_attrib ib_st_FETCH_attrib
#define dbd_bind_ph         ib_bind_ph

void    do_error _((SV *h, int rc, char *what));

void    dbd_init     _((dbistate_t *dbistate));
void    dbd_preparse _((SV *sth, imp_sth_t *imp_sth, char *statement));
int     dbd_describe _((SV *sth, imp_sth_t *imp_sth));
int     dbd_db_ping   (SV *dbh);

int ib_error_check(SV *h, ISC_STATUS *status);

int ib_start_transaction   (SV *h, imp_dbh_t *imp_dbh);
int ib_commit_transaction  (SV *h, imp_dbh_t *imp_dbh);
int ib_rollback_transaction(SV *h, imp_dbh_t *imp_dbh);
long ib_rows(SV *xxh, isc_stmt_handle *h_stmt, char count_type);
void ib_cleanup_st_prepare (imp_sth_t *imp_sth);



( run in 0.753 second using v1.01-cache-2.11-cpan-39bf76dae61 )