/ Check-in [863540be]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix a bug in the logic that converts numbers into strings inside the VM. Ticket #844 (CVS 1878)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:863540be248d3079e1a997349be6c74199149511
User & Date: drh 2004-08-06 17:00:41
Context
2004-08-07
23:54
Do not invoke the busy callback when trying to promote a lock from SHARED to RESERVED. This avoids a deadlock. (CVS 1879) check-in: d33771a3 user: drh tags: trunk
2004-08-06
17:00
Fix a bug in the logic that converts numbers into strings inside the VM. Ticket #844 (CVS 1878) check-in: 863540be user: drh tags: trunk
2004-08-04
15:16
In the command-line shell: importments to the "help" message and better error checking in the new .import command. (CVS 1877) check-in: ed489f77 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbemem.c.

   158    158   
   159    159     /* For a Real or Integer, use sqlite3_snprintf() to produce the UTF-8
   160    160     ** string representation of the value. Then, if the required encoding
   161    161     ** is UTF-16le or UTF-16be do a translation.
   162    162     ** 
   163    163     ** FIX ME: It would be better if sqlite3_snprintf() could do UTF-16.
   164    164     */
   165         -  if( fg & MEM_Real || (pMem->type==SQLITE_FLOAT) ){
          165  +  if( fg & MEM_Real ){
   166    166       sqlite3_snprintf(NBFS, z, "%.15g", pMem->r);
   167    167     }else{
   168    168       assert( fg & MEM_Int );
   169    169       sqlite3_snprintf(NBFS, z, "%lld", pMem->i);
   170    170     }
   171    171     pMem->n = strlen(z);
   172    172     pMem->z = z;

Added test/trigger5.test.

            1  +# The author disclaims copyright to this source code.  In place of
            2  +# a legal notice, here is a blessing:
            3  +#
            4  +#    May you do good and not evil.
            5  +#    May you find forgiveness for yourself and forgive others.
            6  +#    May you share freely, never taking more than you give.
            7  +#
            8  +#***********************************************************************
            9  +#
           10  +# This file tests the triggers of views.
           11  +#
           12  +
           13  +set testdir [file dirname $argv0]
           14  +source $testdir/tester.tcl
           15  +
           16  +# Ticket #844
           17  +#
           18  +do_test trigger5-1.1 {
           19  +  execsql {
           20  +    CREATE TABLE Item(
           21  +       a integer PRIMARY KEY NOT NULL ,
           22  +       b double NULL ,
           23  +       c int NOT NULL DEFAULT 0
           24  +    );
           25  +    CREATE TABLE Undo(UndoAction TEXT);
           26  +    INSERT INTO Item VALUES (1,38205.60865,340);
           27  +    CREATE TRIGGER trigItem_UNDO_AD AFTER DELETE ON Item FOR EACH ROW
           28  +    BEGIN
           29  +      INSERT INTO Undo SELECT 'INSERT INTO Item (a,b,c) VALUES ('
           30  +       || coalesce(old.a,'NULL') || ',' || quote(old.b) || ',' || old.c || ');';
           31  +    END;
           32  +    DELETE FROM Item WHERE a = 1;
           33  +    SELECT * FROM Undo;
           34  +  }
           35  +} {{INSERT INTO Item (a,b,c) VALUES (1,38205.60865,340);}}
           36  +
           37  +integrity_check trigger5-99.9
           38  +
           39  +finish_test