/ 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 Unified Diffs Ignore Whitespace Patch

Changes to src/vdbemem.c.

158
159
160
161
162
163
164
165
166
167
168
169
170
171
172

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







|







158
159
160
161
162
163
164
165
166
167
168
169
170
171
172

  /* For a Real or Integer, use sqlite3_snprintf() to produce the UTF-8
  ** string representation of the value. Then, if the required encoding
  ** is UTF-16le or UTF-16be do a translation.
  ** 
  ** FIX ME: It would be better if sqlite3_snprintf() could do UTF-16.
  */
  if( fg & MEM_Real ){
    sqlite3_snprintf(NBFS, z, "%.15g", pMem->r);
  }else{
    assert( fg & MEM_Int );
    sqlite3_snprintf(NBFS, z, "%lld", pMem->i);
  }
  pMem->n = strlen(z);
  pMem->z = z;

Added test/trigger5.test.















































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
#
# This file tests the triggers of views.
#

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Ticket #844
#
do_test trigger5-1.1 {
  execsql {
    CREATE TABLE Item(
       a integer PRIMARY KEY NOT NULL ,
       b double NULL ,
       c int NOT NULL DEFAULT 0
    );
    CREATE TABLE Undo(UndoAction TEXT);
    INSERT INTO Item VALUES (1,38205.60865,340);
    CREATE TRIGGER trigItem_UNDO_AD AFTER DELETE ON Item FOR EACH ROW
    BEGIN
      INSERT INTO Undo SELECT 'INSERT INTO Item (a,b,c) VALUES ('
       || coalesce(old.a,'NULL') || ',' || quote(old.b) || ',' || old.c || ');';
    END;
    DELETE FROM Item WHERE a = 1;
    SELECT * FROM Undo;
  }
} {{INSERT INTO Item (a,b,c) VALUES (1,38205.60865,340);}}

integrity_check trigger5-99.9

finish_test