home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-perl-addon-1.4.9-installer.exe / dbivport.h < prev    next >
Encoding:
C/C++ Source or Header  |  2004-03-09  |  1.9 KB  |  49 lines

  1. /* dbivport.h
  2.  
  3.     Provides macros that enable greater portability between DBI versions.
  4.  
  5.     This file should be *copied* and included in driver distributions
  6.     and #included into the source, after #include DBIXS.h
  7.  
  8.     New driver releases should include an updated copy of dbivport.h
  9.     from the most recent DBI release.
  10. */
  11.  
  12. #ifndef DBI_VPORT_H
  13. #define DBI_VPORT_H
  14.  
  15. #ifndef DBIh_SET_ERR_CHAR
  16. /* Emulate DBIh_SET_ERR_CHAR
  17.     Only uses the err_i, errstr and state parameters.
  18. */
  19. #define DBIh_SET_ERR_CHAR(h, imp_xxh, err_c, err_i, errstr, state, method) \
  20.         sv_setiv(DBIc_ERR(imp_xxh), err_i); \
  21.         sv_setpv(DBIc_STATE(imp_xxh), state); \
  22.         sv_setpv(DBIc_ERRSTR(imp_xxh), errstr)
  23. #endif
  24.  
  25. #ifndef DBIc_TRACE_LEVEL_MASK
  26. #define DBIc_TRACE_LEVEL_MASK   0x0000000F
  27. #define DBIc_TRACE_FLAGS_MASK   0xFFFFFF00
  28. #define DBIc_TRACE_SETTINGS(imp) (DBIc_DBISTATE(imp)->debug)
  29. #define DBIc_TRACE_LEVEL(imp)   (DBIc_TRACE_SETTINGS(imp) & DBIc_TRACE_LEVEL_MASK)
  30. #define DBIc_TRACE_FLAGS(imp)   (DBIc_TRACE_SETTINGS(imp) & DBIc_TRACE_FLAGS_MASK)
  31. /* DBIc_TRACE_MATCHES - true if s1 'matches' s2  (c.f. trace_msg())
  32.    DBIc_TRACE_MATCHES(foo, DBIc_TRACE_SETTINGS(imp))
  33. */
  34. #define DBIc_TRACE_MATCHES(s1, s2)      \
  35.         (  ((s1 & DBIc_TRACE_LEVEL_MASK) >= (s2 & DBIc_TRACE_LEVEL_MASK)) \
  36.         || ((s1 & DBIc_TRACE_FLAGS_MASK)  & (s2 & DBIc_TRACE_FLAGS_MASK)) )
  37. /* DBIc_TRACE - true if flags match & DBI level>=flaglevel, or if DBI level>level
  38.    DBIc_TRACE(imp,         0, 0, 4) = if level >= 4
  39.    DBIc_TRACE(imp, DBDtf_FOO, 2, 4) = if tracing DBDtf_FOO & level>=2 or level>=4
  40.    DBIc_TRACE(imp, DBDtf_FOO, 2, 0) = as above but never trace just due to level
  41. */
  42. #define DBIc_TRACE(imp, flags, flaglevel, level)        \
  43.         (  (flags && (DBIc_TRACE_FLAGS(imp) & flags) && (DBIc_TRACE_LEVEL(imp) >= flaglevel)) \
  44.         || (level && DBIc_TRACE_LEVEL(imp) >= level) )
  45. #endif
  46.  
  47.  
  48. #endif /* !DBI_VPORT_H */
  49.