DBD-Oracle
view release on metacpan or search on metacpan
#ifndef DBD_OCI_TRACEON
/* OCI functions "wrapped" to produce tracefile dumps (may be handy when giving
diagnostic info to Oracle Support, or just learning about OCI)
Macros are named "_log" as a mnemonic that they log to the tracefile if needed
Macros named "_log_stat" return status in last parameter.
*/
#define DBD_OCI_TRACEON(h) (DBIc_DBISTATE(h)->debug >= 6 || dbd_verbose >= 6)
#define DBD_OCI_TRACEFP(h) (DBIc_LOGPIO(h))
#define OciTp ("\tOCI") /* OCI Trace Prefix */
#define OciTstr(s) ((s) ? (text*)(s) : (text*)"<NULL>")
#define ul_t(v) ((unsigned long)(v))
#define pul_t(v) ((unsigned long *)(v))
#define sl_t(v) ((signed long)(v))
#define psl_t(v) ((signed long *)(v))
/* XXX TO DO
1. Add parenthesis around all macro args. (or do item 4 below case-by-case)
DMG: Partly done, sort of. At least the types all match the doc'd casts, anyway.
2. #define a set of OciTxxx macros for different types of parameters
that would allow
a: casting to be hidden
b: casting easily changed on different platforms (64bit etc)
c: mapping of some type values to strings,
d: return pointed-to value instead of pointer where applicable
How to output arguments that are handles to opaque entities (OCIEnv*, etc)?
Output of pointer address is a quick n' dirty way of identifying
any number of handles that may be allocated.... yuck...
It sure would be nice to give something more mnemonic! (and meaningful!)
XXX Turn pointers into variable names by adding a prefix letter and, where
appropriate an &, thus: "...,&p%ld,...",
If done well the log will read like a compilable program.
*/
#define OCIServerRelease_log_stat(impdbh,sc,errhp,b,bl,ht,ver,stat) \
stat =OCIServerRelease(sc,errhp,b,bl,ht,ver);\
(DBD_OCI_TRACEON(impdbh)) \
? PerlIO_printf(DBD_OCI_TRACEFP(impdbh), \
"%sOCIServerRelease(%p)=%s\n",\
OciTp, sc,oci_status_name(stat)),stat \
: stat
#define OCISessionRelease_log_stat(impdbh,svchp,errhp,tag,tagl,mode,stat) \
stat =OCISessionRelease(svchp, errhp, tag, tagl, mode);\
(DBD_OCI_TRACEON(impdbh)) \
? PerlIO_printf(DBD_OCI_TRACEFP(impdbh), \
"%sOCISessionRelease(svchp=%p,tag=\"%s\",mode=%u)=%s\n",\
OciTp, svchp,tag,mode,oci_status_name(stat)),stat \
: stat
#define OCISessionPoolDestroy_log_stat(impdbh, ph, errhp,stat ) \
stat =OCISessionPoolDestroy(ph, errhp,OCI_DEFAULT);\
(DBD_OCI_TRACEON(impdbh)) \
? PerlIO_printf(DBD_OCI_TRACEFP(impdbh), \
"%sOCISessionPoolDestroy(ph=%p)=%s\n",\
OciTp, ph,oci_status_name(stat)),stat \
: stat
#define OCISessionGet_log_stat(impdbh,envhp,errhp,sh,ah,pn,pnl,tag,tagl,rettag,rettagl,found,stat) \
stat =OCISessionGet(envhp, errhp, sh, ah,pn,pnl,tag,tagl,rettag,rettagl,found, OCI_SESSGET_SPOOL);\
(DBD_OCI_TRACEON(impdbh)) \
? PerlIO_printf(DBD_OCI_TRACEFP(impdbh), \
"%sOCISessionGet(envhp=%p,sh=%p,ah=%p,pn=%p,pnl=%d,tag=\"%s\",found=%d)=%s\n",\
( run in 1.145 second using v1.01-cache-2.11-cpan-39bf76dae61 )