Author: turnstep
Date: Sat Feb 16 17:13:24 2008
New Revision: 10751
Added:
DBD-Pg/trunk/dbivport.h
Modified:
DBD-Pg/trunk/Changes
DBD-Pg/trunk/MANIFEST
DBD-Pg/trunk/README.dev
Log:
Add in dbivport.h
Modified: DBD-Pg/trunk/Changes
==============================================================================
--- DBD-Pg/trunk/Changes (original)
+++ DBD-Pg/trunk/Changes Sat Feb 16 17:13:24 2008
@@ -8,6 +8,7 @@
- Force client encoding of UTF8 for some tests.
- Make 03dbmethod.t pass minor test for version 8.1.9
[CPAN bug #33282]
+ - Add a local copy of dbivport.h
2.0.0 Released February 2008
Modified: DBD-Pg/trunk/MANIFEST
==============================================================================
--- DBD-Pg/trunk/MANIFEST (original)
+++ DBD-Pg/trunk/MANIFEST Sat Feb 16 17:13:24 2008
@@ -15,6 +15,7 @@
Pg.h
Pg.pm
Pg.xs
+dbivport.h
dbdimp.c
dbdimp.h
types.c
Modified: DBD-Pg/trunk/README.dev
==============================================================================
--- DBD-Pg/trunk/README.dev (original)
+++ DBD-Pg/trunk/README.dev Sat Feb 16 17:13:24 2008
@@ -99,6 +99,9 @@
dbdimp.h - Helper file for dbdimp.c.
+dbivport.h - DBI portability macros. This should be the latest version from
the
+ DBI subversion repository.
+
Pg.pm - The main Perl file, which contains DBD::Pg packages and code for the
methods. Often times code here calls code from Pg.xs and dbdimp.c.
This file contains a version number in two places (once in the code, once
Added: DBD-Pg/trunk/dbivport.h
==============================================================================
--- (empty file)
+++ DBD-Pg/trunk/dbivport.h Sat Feb 16 17:13:24 2008
@@ -0,0 +1,52 @@
+/* dbivport.h
+
+ Provides macros that enable greater portability between DBI versions.
+
+ This file should be *copied* and included in driver distributions
+ and #included into the source, after #include DBIXS.h
+
+ New driver releases should include an updated copy of dbivport.h
+ from the most recent DBI release.
+*/
+
+#ifndef DBI_VPORT_H
+#define DBI_VPORT_H
+
+#ifndef DBIh_SET_ERR_CHAR
+/* Emulate DBIh_SET_ERR_CHAR
+ Only uses the err_i, errstr and state parameters.
+*/
+#define DBIh_SET_ERR_CHAR(h, imp_xxh, err_c, err_i, errstr, state, method) \
+ sv_setiv(DBIc_ERR(imp_xxh), err_i); \
+ (state) ? (void)sv_setpv(DBIc_STATE(imp_xxh), state) :
(void)SvOK_off(DBIc_STATE(imp_xxh)); \
+ sv_setpv(DBIc_ERRSTR(imp_xxh), errstr)
+#endif
+
+#ifndef DBIcf_Executed
+#define DBIcf_Executed 0x080000
+#endif
+
+#ifndef DBIc_TRACE_LEVEL_MASK
+#define DBIc_TRACE_LEVEL_MASK 0x0000000F
+#define DBIc_TRACE_FLAGS_MASK 0xFFFFFF00
+#define DBIc_TRACE_SETTINGS(imp) (DBIc_DBISTATE(imp)->debug)
+#define DBIc_TRACE_LEVEL(imp) (DBIc_TRACE_SETTINGS(imp) &
DBIc_TRACE_LEVEL_MASK)
+#define DBIc_TRACE_FLAGS(imp) (DBIc_TRACE_SETTINGS(imp) &
DBIc_TRACE_FLAGS_MASK)
+/* DBIc_TRACE_MATCHES - true if s1 'matches' s2 (c.f. trace_msg())
+ DBIc_TRACE_MATCHES(foo, DBIc_TRACE_SETTINGS(imp))
+*/
+#define DBIc_TRACE_MATCHES(s1, s2) \
+ ( ((s1 & DBIc_TRACE_LEVEL_MASK) >= (s2 & DBIc_TRACE_LEVEL_MASK)) \
+ || ((s1 & DBIc_TRACE_FLAGS_MASK) & (s2 & DBIc_TRACE_FLAGS_MASK)) )
+/* DBIc_TRACE - true if flags match & DBI level>=flaglevel, or if DBI
level>level
+ DBIc_TRACE(imp, 0, 0, 4) = if level >= 4
+ DBIc_TRACE(imp, DBDtf_FOO, 2, 4) = if tracing DBDtf_FOO & level>=2 or
level>=4
+ DBIc_TRACE(imp, DBDtf_FOO, 2, 0) = as above but never trace just due to
level
+*/
+#define DBIc_TRACE(imp, flags, flaglevel, level) \
+ ( (flags && (DBIc_TRACE_FLAGS(imp) & flags) && (DBIc_TRACE_LEVEL(imp)
>= flaglevel)) \
+ || (level && DBIc_TRACE_LEVEL(imp) >= level) )
+#endif
+
+
+#endif /* !DBI_VPORT_H */