Yuriy Kaminskiy wrote:
> This cannot be right:
> 
>> sqlite_set_result(pTHX_ sqlite3_context *context, SV *result, int is_error)
>> {
>> ...
>>     else if ( SvIOK(result) ) {
>>         sqlite3_result_int( context, SvIV(result));
>> ...

... and this may truncate integer to 32-bit on some machines. Untested [my perl
build unaffected] patch (on top of alternative 2, otherwise apply by hand) 
attached.
>From 557cc5270cd050fd06b162a81529ea5ca910a20e Mon Sep 17 00:00:00 2001
From: "Yuriy M. Kaminskiy" <yum...@gmail.com>
Date: Sat, 24 Mar 2012 16:43:42 +0400
Subject: [PATCH 2/2] Fix integer result truncated with 32-bit int and
 USE_64_BIT_INT

---
 dbdimp.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/dbdimp.c b/dbdimp.c
index 3163dcf..26872be 100644
--- a/dbdimp.c
+++ b/dbdimp.c
@@ -146,7 +146,11 @@ sqlite_set_result(pTHX_ sqlite3_context *context, SV *result, int is_error)
         sqlite3_result_text( context, s, len, SQLITE_TRANSIENT );
     }
     else if ( SvIOK(result) ) {
+#if defined(USE_64_BIT_INT)
+        sqlite3_result_int64( context, SvIV(result));
+#else
         sqlite3_result_int( context, SvIV(result));
+#endif
     } else if ( SvNOK(result) && ( sizeof(NV) == sizeof(double) || SvNVX(result) == (double) SvNVX(result) ) ) {
         sqlite3_result_double( context, SvNV(result));
     } else {
-- 
1.7.6.3

_______________________________________________
DBD-SQLite mailing list
DBD-SQLite@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbd-sqlite

Reply via email to