Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | mprintf() correctly handles "%s","". Fix for ticket #812. (CVS 1800) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
4f56db1149f65dc2edf6626fa20ae255 |
User & Date: | drh 2004-07-17 21:56:10.000 |
Context
2004-07-18
| ||
20:52 | min() ignores NULL values. Ticket #800. (CVS 1802) (check-in: 166234a2b6 user: drh tags: trunk) | |
2004-07-17
| ||
21:56 | mprintf() correctly handles "%s","". Fix for ticket #812. (CVS 1800) (check-in: 4f56db1149 user: drh tags: trunk) | |
21:44 | Use the F_FULLFSYNC fctrl if it is available. Record the name of files that are opened in the OsFile structure. (CVS 1799) (check-in: 1d30d0dd46 user: drh tags: trunk) | |
Changes
Changes to src/printf.c.
︙ | ︙ | |||
224 225 226 227 228 229 230 231 232 233 234 235 236 237 | double rounder; /* Used for rounding floating point values */ etByte flag_dp; /* True if decimal point should be shown */ etByte flag_rtz; /* True if trailing zeros should be removed */ etByte flag_exp; /* True to force display of the exponent */ int nsd; /* Number of significant digits returned */ #endif count = length = 0; bufpt = 0; for(; (c=(*fmt))!=0; ++fmt){ if( c!='%' ){ int amt; bufpt = (char *)fmt; amt = 1; | > | 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | double rounder; /* Used for rounding floating point values */ etByte flag_dp; /* True if decimal point should be shown */ etByte flag_rtz; /* True if trailing zeros should be removed */ etByte flag_exp; /* True to force display of the exponent */ int nsd; /* Number of significant digits returned */ #endif func(arg,"",0); count = length = 0; bufpt = 0; for(; (c=(*fmt))!=0; ++fmt){ if( c!='%' ){ int amt; bufpt = (char *)fmt; amt = 1; |
︙ | ︙ | |||
680 681 682 683 684 685 686 | memcpy(pM->zText, pM->zBase, pM->nChar); } }else{ pM->zText = pM->xRealloc(pM->zText, pM->nAlloc); } } } | | > | | > | 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 | memcpy(pM->zText, pM->zBase, pM->nChar); } }else{ pM->zText = pM->xRealloc(pM->zText, pM->nAlloc); } } } if( pM->zText ){ if( nNewChar>0 ){ memcpy(&pM->zText[pM->nChar], zNewText, nNewChar); pM->nChar += nNewChar; } pM->zText[pM->nChar] = 0; } } /* ** This routine is a wrapper around xprintf() that invokes mout() as ** the consumer. |
︙ | ︙ |
Changes to src/test1.c.
︙ | ︙ | |||
9 10 11 12 13 14 15 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** Code for testing the printf() interface to SQLite. This code ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** Code for testing the printf() interface to SQLite. This code ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** ** $Id: test1.c,v 1.94 2004/07/17 21:56:10 drh Exp $ */ #include "sqliteInt.h" #include "tcl.h" #include "os.h" #include <stdlib.h> #include <string.h> |
︙ | ︙ | |||
664 665 666 667 668 669 670 671 672 673 674 675 676 677 | if( Tcl_GetDouble(interp, argv[i], &r[i-2]) ) return TCL_ERROR; } z = sqlite3_mprintf(argv[1], r[0]*r[1]); Tcl_AppendResult(interp, z, 0); sqlite3_free(z); return TCL_OK; } /* ** Usage: sqlite_malloc_fail N ** ** Rig sqliteMalloc() to fail on the N-th call. Turn off this mechanism ** and reset the sqlite3_malloc_failed variable is N==0. */ | > > > > > > > > > > > > > > > > > > > > > > > > > | 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 | if( Tcl_GetDouble(interp, argv[i], &r[i-2]) ) return TCL_ERROR; } z = sqlite3_mprintf(argv[1], r[0]*r[1]); Tcl_AppendResult(interp, z, 0); sqlite3_free(z); return TCL_OK; } /* ** Usage: sqlite3_mprintf_stronly FORMAT STRING ** ** Call mprintf with a single double argument which is the product of the ** two arguments given above. This is used to generate overflow and underflow ** doubles to test that they are converted properly. */ static int sqlite3_mprintf_stronly( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ char **argv /* Text of each argument */ ){ char *z; if( argc!=3 ){ Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], " FORMAT STRING\"", 0); return TCL_ERROR; } z = sqlite3_mprintf(argv[1], argv[2]); Tcl_AppendResult(interp, z, 0); sqlite3_free(z); return TCL_OK; } /* ** Usage: sqlite_malloc_fail N ** ** Rig sqliteMalloc() to fail on the N-th call. Turn off this mechanism ** and reset the sqlite3_malloc_failed variable is N==0. */ |
︙ | ︙ | |||
2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 | static struct { char *zName; Tcl_CmdProc *xProc; } aCmd[] = { { "sqlite3_mprintf_int", (Tcl_CmdProc*)sqlite3_mprintf_int }, { "sqlite3_mprintf_int64", (Tcl_CmdProc*)sqlite3_mprintf_int64 }, { "sqlite3_mprintf_str", (Tcl_CmdProc*)sqlite3_mprintf_str }, { "sqlite3_mprintf_double", (Tcl_CmdProc*)sqlite3_mprintf_double }, { "sqlite3_mprintf_scaled", (Tcl_CmdProc*)sqlite3_mprintf_scaled }, { "sqlite3_mprintf_z_test", (Tcl_CmdProc*)test_mprintf_z }, { "sqlite3_last_insert_rowid", (Tcl_CmdProc*)test_last_rowid }, { "sqlite3_exec_printf", (Tcl_CmdProc*)test_exec_printf }, { "sqlite3_get_table_printf", (Tcl_CmdProc*)test_get_table_printf }, { "sqlite3_close", (Tcl_CmdProc*)sqlite_test_close }, | > | 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 | static struct { char *zName; Tcl_CmdProc *xProc; } aCmd[] = { { "sqlite3_mprintf_int", (Tcl_CmdProc*)sqlite3_mprintf_int }, { "sqlite3_mprintf_int64", (Tcl_CmdProc*)sqlite3_mprintf_int64 }, { "sqlite3_mprintf_str", (Tcl_CmdProc*)sqlite3_mprintf_str }, { "sqlite3_mprintf_stronly", (Tcl_CmdProc*)sqlite3_mprintf_stronly}, { "sqlite3_mprintf_double", (Tcl_CmdProc*)sqlite3_mprintf_double }, { "sqlite3_mprintf_scaled", (Tcl_CmdProc*)sqlite3_mprintf_scaled }, { "sqlite3_mprintf_z_test", (Tcl_CmdProc*)test_mprintf_z }, { "sqlite3_last_insert_rowid", (Tcl_CmdProc*)test_last_rowid }, { "sqlite3_exec_printf", (Tcl_CmdProc*)test_exec_printf }, { "sqlite3_get_table_printf", (Tcl_CmdProc*)test_get_table_printf }, { "sqlite3_close", (Tcl_CmdProc*)sqlite_test_close }, |
︙ | ︙ |
Changes to test/printf.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2001 September 15 # # 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 implements regression tests for SQLite library. The # focus of this file is testing the sqlite_*_printf() interface. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 2001 September 15 # # 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 implements regression tests for SQLite library. The # focus of this file is testing the sqlite_*_printf() interface. # # $Id: printf.test,v 1.12 2004/07/17 21:56:10 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl set n 1 foreach v {1 2 5 10 99 100 1000000 999999999 0 -1 -2 -5 -10 -99 -100 -9999999} { do_test printf-1.$n.1 [subst { |
︙ | ︙ | |||
156 157 158 159 160 161 162 163 164 | } {B } do_test printf-9.3 { sqlite3_mprintf_int {%*.*c} 4 1 67 } { C} do_test printf-9.4 { sqlite3_mprintf_int {%yhello} 0 0 0 } {%} finish_test | > > > > > > > | 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | } {B } do_test printf-9.3 { sqlite3_mprintf_int {%*.*c} 4 1 67 } { C} do_test printf-9.4 { sqlite3_mprintf_int {%yhello} 0 0 0 } {%} # Ticket #812 # do_test printf-10.1 { sqlite3_mprintf_stronly %s {} } {} finish_test |
Changes to www/arch.tcl.
1 2 3 | # # Run this Tcl script to generate the sqlite.html file. # | | | 1 2 3 4 5 6 7 8 9 10 11 | # # Run this Tcl script to generate the sqlite.html file. # set rcsid {$Id: arch.tcl,v 1.14 2004/07/17 21:56:10 drh Exp $} source common.tcl header {Architecture of SQLite} puts { <h2>The Architecture Of SQLite</h2> <h3>Introduction</h3> |
︙ | ︙ | |||
144 145 146 147 148 149 150 | its own header files: <b>vdbe.h</b> that defines an interface between the virtual machine and the rest of the SQLite library and <b>vdbeInt.h</b> which defines structure private the virtual machine. The <b>vdbeaux.c</b> file contains utilities used by the virtual machine and interface modules used by the rest of the library to construct VM programs.</p> | < < < < < < < < < < < < < < < < < | 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | its own header files: <b>vdbe.h</b> that defines an interface between the virtual machine and the rest of the SQLite library and <b>vdbeInt.h</b> which defines structure private the virtual machine. The <b>vdbeaux.c</b> file contains utilities used by the virtual machine and interface modules used by the rest of the library to construct VM programs.</p> <h3>B-Tree</h3> <p>An SQLite database is maintained on disk using a B-tree implementation found in the <b>btree.c</b> source file. A separate B-tree is used for each table and index in the database. All B-trees are stored in the same disk file.</p> |
︙ | ︙ |
Changes to www/arch2.fig.
︙ | ︙ | |||
11 12 13 14 15 16 17 | 0 33 #868686 0 34 #dfefd7 0 35 #d7efef 0 36 #efdbef 0 37 #efdbd7 0 38 #e7efcf 0 39 #9e9e9e | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < | | > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > | > > > > > > | 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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | 0 33 #868686 0 34 #dfefd7 0 35 #d7efef 0 36 #efdbef 0 37 #efdbd7 0 38 #e7efcf 0 39 #9e9e9e 6 3225 3900 4650 6000 2 2 0 1 0 7 51 0 20 0.000 0 0 -1 0 0 5 3225 5475 4575 5475 4575 5925 3225 5925 3225 5475 2 2 0 0 0 33 52 0 20 0.000 0 0 -1 0 0 5 3300 5550 4650 5550 4650 6000 3300 6000 3300 5550 2 2 0 1 0 7 51 0 20 0.000 0 0 -1 0 0 5 3225 4650 4575 4650 4575 5100 3225 5100 3225 4650 2 2 0 0 0 33 52 0 20 0.000 0 0 -1 0 0 5 3300 4725 4650 4725 4650 5175 3300 5175 3300 4725 2 2 0 1 0 7 51 0 20 0.000 0 0 -1 0 0 5 3225 3900 4575 3900 4575 4350 3225 4350 3225 3900 2 2 0 0 0 33 52 0 20 0.000 0 0 -1 0 0 5 3300 3975 4650 3975 4650 4425 3300 4425 3300 3975 2 1 0 1 0 38 50 0 -1 0.000 0 0 -1 1 0 2 1 1 1.00 60.00 120.00 3900 4350 3900 4650 2 1 0 1 0 38 50 0 -1 0.000 0 0 -1 1 0 2 1 1 1.00 60.00 120.00 3900 5100 3900 5475 4 1 0 50 0 2 12 0.0000 4 135 1050 3900 5775 OS Interface\001 4 1 0 50 0 2 12 0.0000 4 135 615 3900 4200 B-Tree\001 4 1 0 50 0 2 12 0.0000 4 180 495 3900 4950 Pager\001 -6 6 5400 4725 6825 5250 2 2 0 1 0 7 51 0 20 0.000 0 0 -1 0 0 5 5400 4725 6750 4725 6750 5175 5400 5175 5400 4725 2 2 0 0 0 33 52 0 20 0.000 0 0 -1 0 0 5 5475 4800 6825 4800 6825 5250 5475 5250 5475 4800 4 1 0 50 0 2 12 0.0000 4 135 630 6000 5025 Utilities\001 -6 6 5400 5550 6825 6075 2 2 0 1 0 7 51 0 20 0.000 0 0 -1 0 0 5 5400 5550 6750 5550 6750 6000 5400 6000 5400 5550 2 2 0 0 0 33 52 0 20 0.000 0 0 -1 0 0 5 5475 5625 6825 5625 6825 6075 5475 6075 5475 5625 4 1 0 50 0 2 12 0.0000 4 135 855 6000 5850 Test Code\001 -6 6 5400 2775 6825 3750 2 2 0 0 0 33 52 0 20 0.000 0 0 -1 0 0 5 5475 2850 6825 2850 6825 3750 5475 3750 5475 2850 2 2 0 1 0 7 51 0 20 0.000 0 0 -1 0 0 5 5400 2775 6750 2775 6750 3675 5400 3675 5400 2775 4 1 0 50 0 2 12 0.0000 4 135 420 6075 3150 Code\001 4 1 0 50 0 2 12 0.0000 4 135 855 6075 3375 Generator\001 -6 6 5400 1950 6825 2475 2 2 0 1 0 7 51 0 20 0.000 0 0 -1 0 0 5 5400 1950 6750 1950 6750 2400 5400 2400 5400 1950 2 2 0 0 0 33 52 0 20 0.000 0 0 -1 0 0 5 5475 2025 6825 2025 6825 2475 5475 2475 5475 2025 4 1 0 50 0 2 12 0.0000 4 135 570 6075 2250 Parser\001 -6 2 2 0 1 0 7 51 0 20 0.000 0 0 -1 0 0 5 5400 1050 6750 1050 6750 1500 5400 1500 5400 1050 2 2 0 0 0 33 52 0 20 0.000 0 0 -1 0 0 5 5475 1125 6825 1125 6825 1575 5475 1575 5475 1125 2 2 0 1 0 7 51 0 20 0.000 0 0 -1 0 0 5 3225 1050 4575 1050 4575 1500 3225 1500 3225 1050 2 2 0 0 0 33 52 0 20 0.000 0 0 -1 0 0 5 |
︙ | ︙ | |||
89 90 91 92 93 94 95 | 1 1 1.00 60.00 120.00 3900 3000 3900 3900 2 1 0 1 0 38 50 0 -1 0.000 0 0 -1 1 0 2 1 1 1.00 60.00 120.00 4575 1950 5400 1350 2 1 0 1 0 38 50 0 -1 0.000 0 0 -1 1 0 2 1 1 1.00 60.00 120.00 | | < < < < < < < < < < < < < < | > > > > > > | < < < < < < < < < < < > > | 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | 1 1 1.00 60.00 120.00 3900 3000 3900 3900 2 1 0 1 0 38 50 0 -1 0.000 0 0 -1 1 0 2 1 1 1.00 60.00 120.00 4575 1950 5400 1350 2 1 0 1 0 38 50 0 -1 0.000 0 0 -1 1 0 2 1 1 1.00 60.00 120.00 5400 2925 4650 2325 2 2 0 1 0 34 55 0 20 0.000 0 0 -1 0 0 5 2850 750 4875 750 4875 3375 2850 3375 2850 750 2 1 0 1 0 38 50 0 -1 0.000 0 0 -1 1 0 2 1 1 1.00 60.00 120.00 6075 1500 6075 1950 2 3 0 1 0 35 55 0 20 0.000 0 0 -1 0 0 5 2850 3675 4875 3675 4875 6225 2850 6225 2850 3675 2 2 0 1 0 37 55 0 20 0.000 0 0 -1 0 0 5 5175 750 7200 750 7200 4050 5175 4050 5175 750 2 2 0 1 0 38 55 0 20 0.000 0 0 -1 0 0 5 5175 4425 7200 4425 7200 6225 5175 6225 5175 4425 2 1 0 1 0 38 50 0 -1 0.000 0 0 -1 1 0 2 1 1 1.00 60.00 120.00 6075 2475 6075 2775 4 1 0 50 0 2 12 0.0000 4 135 855 6075 1350 Tokenizer\001 4 1 0 50 0 1 12 1.5708 4 180 1020 7125 2250 SQL Compiler\001 4 1 0 50 0 1 12 1.5708 4 135 345 3075 2025 Core\001 4 1 0 50 0 2 12 0.0000 4 135 1290 3900 2850 Virtual Machine\001 4 1 0 50 0 2 12 0.0000 4 165 1185 3900 1995 SQL Command\001 4 1 0 50 0 2 12 0.0000 4 135 855 3900 2183 Processor\001 4 1 0 50 0 2 14 0.0000 4 150 870 3900 1350 Interface\001 4 1 0 50 0 1 12 1.5708 4 135 885 7125 5400 Accessories\001 4 1 0 50 0 1 12 1.5708 4 135 645 3075 4875 Backend\001 |
Changes to www/support.tcl.
|
| | | 1 2 3 4 5 6 7 8 | set rcsid {$Id: support.tcl,v 1.4 2004/07/17 21:56:10 drh Exp $} source common.tcl header {SQLite Support Options} puts { <h2>SQLite Support Options</h2> <h3>Mailing List</h3> |
︙ | ︙ | |||
21 22 23 24 25 26 27 | mailing list, send a message to <a href="mailto:sqlite-users-help@sqlite.org"> sqlite-users-help@sqlite.org</a> and instructions will be sent by to you by return email. </p> <p> | | > > > | | > > > > | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | mailing list, send a message to <a href="mailto:sqlite-users-help@sqlite.org"> sqlite-users-help@sqlite.org</a> and instructions will be sent by to you by return email. </p> <p> There are multiple archives of the mailing list: </p> <blockquote> <a href="http://www.mail-archive.com/sqlite-users%40sqlite.org/"> http://www.mail-archive.com/sqlite-users%40sqlite.org</a><br> <a href="http://www.theaimsgroup.com/"> http://www.theaimsgroup.com/</a><br> <a href="http://news.gmane.org/gmane.comp.db.sqlite.general"> http://news.gmane.org/gmane.comp.db.sqlite.general</a> </blockquote> </p> <h3>Professional Support</h3> <p> If you would like professional support for SQLite or if you want custom modifications to SQLite performed by the |
︙ | ︙ |