Author: timbo
Date: Mon Jun 18 07:19:45 2007
New Revision: 9659

Modified:
   dbi/trunk/Changes
   dbi/trunk/DBI.xs
   dbi/trunk/DBIXS.h
   dbi/trunk/dbixs_rev.h

Log:
Note: this release includes a change to the DBI::hash() function which will
now produce different values than before *if* your perl was built with 64-bit
'int' type (i.e. "perl -V:intsize" says intsize='4').  It's relatively rare
for perl to be configured that way, even on 64-bit systems.
Changed DBI::hash to return 'I32' type instead of 'int' so results are
portable/consistent regardless of size of the int type.


Modified: dbi/trunk/Changes
==============================================================================
--- dbi/trunk/Changes   (original)
+++ dbi/trunk/Changes   Mon Jun 18 07:19:45 2007
@@ -39,6 +39,11 @@
 
 =head2 Changes in DBI 1.57 (svn rev 9639),  13th June 2007
 
+  Note: this release includes a change to the DBI::hash() function which will
+  now produce different values than before *if* your perl was built with 64-bit
+  'int' type (i.e. "perl -V:intsize" says intsize='4').  It's relatively rare
+  for perl to be configured that way, even on 64-bit systems.
+
   Fixed XS versions of select*_*() methods to call execute()
     fetch() etc., with inner handle instead of outer.
   Fixed execute_for_fetch() to not cache errstr values
@@ -46,11 +51,13 @@
   Fixed unused var compiler warning thanks to JDHEDDEN.
   Fixed t/86gofer_fail tests to be less likely to fail falsely.
 
+  Changed DBI::hash to return 'I32' type instead of 'int' so results are
+    portable/consistent regardless of size of the int type.
   Corrected timeout example in docs thanks to Egmont Koblinger.
   Changed t/01basic.t to warn instead of failing when it detects
-    a problem with Math::BigInt (some recent versions have been buggy).
+    a problem with Math::BigInt (some recent versions had problems).
 
-  Added support for !Time and !Time~N to DBI::Profile Path.
+  Added support for !Time and !Time~N to DBI::Profile Path. See docs.
   Added extra trace info to connect_cached thanks to Walery Studennikov.
   Added non-random (deterministic) mode to DBI_GOFER_RANDOM mechanism.
   Added DBIXS_REVISION macro that drivers can use.
@@ -59,7 +66,7 @@
   DBI::Profile changes:
     dbi_profile() now returns ref to relevant leaf node.
     Don't profile DESTROY during global destruction.
-    Added as_node_path_list() and as_text() methods and tests.
+    Added as_node_path_list() and as_text() methods.
   DBI::ProfileDumper changes:
     Don't write file if there's no profile data.
     Uses full natural precision when saving data (was using %.6f)
@@ -72,7 +79,7 @@
     Enabled DBI_PROFILE_APACHE_LOG_DIR for mod_perl 1 as well as 2.
     Added parent pid to default data file name.
   DBI::ProfileData changes:
-    Added DeleteFiles option to delete files once read.
+    Added DeleteFiles option to rename & delete files once read.
     Locks the data files while reading.
     Added ability to sort by Path elements.
   dbiprof changes:

Modified: dbi/trunk/DBI.xs
==============================================================================
--- dbi/trunk/DBI.xs    (original)
+++ dbi/trunk/DBI.xs    Mon Jun 18 07:19:45 2007
@@ -78,7 +78,7 @@
 static int      set_err_char _((SV *h, imp_xxh_t *imp_xxh, const char *err_c, 
IV err_i, const char *errstr, const char *state, const char *method));
 static int     set_err_sv   _((SV *h, imp_xxh_t *imp_xxh, SV *err, SV *errstr, 
SV *state, SV *method));
 static int     quote_type _((int sql_type, int p, int s, int *base_type, void 
*v));
-static int     dbi_hash _((const char *string, long i));
+static I32     dbi_hash _((const char *string, long i));
 static void    dbih_dumphandle _((pTHX_ SV *h, const char *msg, int level));
 static int     dbih_dumpcom _((pTHX_ imp_xxh_t *imp_xxh, const char *msg, int 
level));
 char *neatsvpv _((SV *sv, STRLEN maxlen));
@@ -571,8 +571,10 @@
     return SvPV_nolen(sv);
 }
 
+/* 32 bit magic FNV-0 and FNV-1 prime */
+#define FNV_32_PRIME ((UV)0x01000193)
 
-static int
+static I32
 dbi_hash(const char *key, long type)
 {
     if (type == 0) {
@@ -582,14 +584,14 @@
            hash = hash * 33 + *key++;
        hash &= 0x7FFFFFFF;     /* limit to 31 bits             */
        hash |= 0x40000000;     /* set bit 31                   */
-       return -(int)hash;      /* return negative int  */
+       return -(I32)hash;      /* return negative int  */
     }
     else if (type == 1) {      /* Fowler/Noll/Vo hash  */
        /* see http://www.isthe.com/chongo/tech/comp/fnv/ */
        U32 hash = 0x811c9dc5;
        const unsigned char *s = (unsigned char *)key;    /* unsigned string */
        while (*s) {
-           /* multiply by the 32 bit FNV magic prime mod 2^64 */
+           /* multiply by the 32 bit FNV magic prime mod 2^32 */
            hash *= FNV_32_PRIME;
            /* xor the bottom with the current octet */
            hash ^= (U32)*s++;
@@ -3999,7 +4001,7 @@
     (void)cv;
 
 
-int
+I32
 hash(key, type=0)
     const char *key
     long type
@@ -4172,7 +4174,11 @@
        SvROK(method) ? SvRV(method) : method,
        t1, t2
     );
-    (void)cv;
+    if (DBIc_TRACE_LEVEL(imp_xxh) >= 9)
+        warn("dbi_profile(%s, %s, %f, %f) =%s, gimme=%d",
+                neatsvpv(statement,0), neatsvpv(method,0), t1, t2,
+                neatsvpv(leaf,0), GIMME_V);
+    (void)cv;   /* avoid unused var warnings */
     if (GIMME_V == G_VOID)
         ST(0) = &sv_undef;  /* skip sv_mortalcopy if not needed */
     else

Modified: dbi/trunk/DBIXS.h
==============================================================================
--- dbi/trunk/DBIXS.h   (original)
+++ dbi/trunk/DBIXS.h   Mon Jun 18 07:19:45 2007
@@ -414,7 +414,7 @@
     AV        * (*get_fbav)    _((imp_sth_t *imp_sth));
     SV        * (*make_fdsv)   _((SV *sth, const char *imp_class, STRLEN 
imp_size, const char *col_name));
     int         (*bind_as_num) _((int sql_type, int p, int s, int *t, void 
*v));
-    int         (*hash)                _((const char *string, long i));
+    I32         (*hash)                _((const char *string, long i));
     SV        * (*preparse)    _((SV *sth, char *statement, IV ps_return, IV 
ps_accept, void *foo));
 
     SV *neatsvpvlen;           /* only show dbgpvlen chars when debugging pv's 
*/

Modified: dbi/trunk/dbixs_rev.h
==============================================================================
--- dbi/trunk/dbixs_rev.h       (original)
+++ dbi/trunk/dbixs_rev.h       Mon Jun 18 07:19:45 2007
@@ -1,2 +1,3 @@
 /* Mixed revision working copy */
-#define DBIXS_REVISION 9632
+/* Code modified since last checkin */
+#define DBIXS_REVISION 9640

Reply via email to