I've taken a look at this now, and I believe this patch should fix your
problem. Please try it, and I'd like to ask Jürgen to merge it.

Regards,
Elias



Index: src/sql/SqliteResultValue.cc
===================================================================
--- src/sql/SqliteResultValue.cc        (revision 885)
+++ src/sql/SqliteResultValue.cc        (working copy)
@@ -60,7 +60,7 @@
         int type = sqlite3_column_type( statement, i );
         switch( type ) {
         case SQLITE_INTEGER:
-            value = new IntResultValue( sqlite3_column_int( statement, i )
);
+            value = new IntResultValue( sqlite3_column_int64( statement, i
) );
             break;
         case SQLITE_FLOAT:
             value = new DoubleResultValue( sqlite3_column_double(
statement, i ) );
Index: src/sql/SqliteResultValue.hh
===================================================================
--- src/sql/SqliteResultValue.hh        (revision 885)
+++ src/sql/SqliteResultValue.hh        (working copy)
@@ -36,12 +36,12 @@

 class IntResultValue : public ResultValue {
 public:
-    IntResultValue( int value_in ) : value( value_in ) {}
+    IntResultValue( APL_Integer value_in ) : value( value_in ) {}
     virtual ~IntResultValue() {}
     virtual void update( Cell *cell, Value & cell_owner ) const;

 private:
-    int value;
+    APL_Integer value;
 };

 class DoubleResultValue : public ResultValue {


On 12 February 2017 at 19:18, Elias Mårtenson <loke...@gmail.com> wrote:

> Thanks. I'll take a look at this today or tomorrow if no one else does it
> before me. Ma ☺️
>
> On 12 Feb 2017 7:13 PM, "Kacper Gutowski" <mwgam...@gmail.com> wrote:
>
>> The sqlite provider seems to silently truncate integer values in results:
>>
>>       )COPY 5 SQL
>> DUMPED 2017-02-12 10:13:53 (GMT+1)
>>       db←'sqlite' SQL∆Connect ':memory:'
>>       'create table a(b)' SQL∆Exec[db] ⍬
>>
>>       'insert into a values(?),(?)' SQL∆Exec[db] 2⋆31 32
>>
>>       'select b from a' SQL∆Select[db] ⍬
>> ¯2147483648
>>           0
>>       'select cast(b as real) from a' SQL∆Select[db] ⍬
>> 2147483648 <(214)%20748-3648>
>> 4294967296
>>
>>
>> -k
>>
>>

Reply via email to