-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
-C Fix\sa\stracing\smacro\sin\sthe\sVDBE\sin\sthe\sVColumn\sopcode.
-D 2009-11-24T16:26:17
+C Enhance\sthe\s%q,\s%Q,\sand\s%w\sprintf\sconversions\sso\sthat\sthe\sprecisions\s\nspecifies\sthe\slength\sof\sthe\sinput.
+D 2009-11-25T16:53:38
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 7f6c6aa7feeeb5e26e01b344161d9aa1b5d64177
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F src/pcache1.c 2bb2261190b42a348038f5b1c285c8cef415fcc8
F src/pragma.c 6936d7df5e04b9f996f8f320d15e65b6944b2caa
F src/prepare.c ad90970bba3aead154266d8bb6faf9fbb5233b94
-F src/printf.c 03fabdd6112a0e23f78f8ac9a1396947ade0273b
+F src/printf.c 51c3b010c6f1bd8bb07d7ea84147eb8f63ce1238
F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50
F src/resolve.c c52d9e52e11058f4113f6644adc20d3f85141b1d
F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697
F test/permutations.test 1ce2874df8fec876d0b963c7a3ef61c4e9df8827
F test/pragma.test 5aeb48a442dba3c3e8e38773b121371814ab3b17
F test/pragma2.test 5364893491b9231dd170e3459bfc2e2342658b47
-F test/printf.test 47e9e5bbec8509023479d54ceb71c9d05a95308a
+F test/printf.test 05970cde31b1a9f54bd75af60597be75a5c54fea
F test/progress.test 5b075c3c790c7b2a61419bc199db87aaf48b8301
F test/ptrchng.test ef1aa72d6cf35a2bbd0869a649b744e9d84977fc
F test/quick.test 12fdc7656b4d20a537a686fb223eb99b5fe54483
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P 02ef972a56aab1e61786000283193165d3968842
-R 906efa28fc9f004f544fa83f98fdcd2f
+P cb74b81bb0322efdd66146d7de466c14564b18fd
+R d2fd7cc9116d60ea3bf83caab579713e
U drh
-Z 2d2b583acdac8f54f65dc7650540653b
+Z bb155b9f1ed8f5cc73b48ffe4ac5abca
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
-iD8DBQFLDAksoxKgR168RlERAhoZAJ4s2MG81bz6MXkHnY2NUGswNrmvawCfdWH6
-NQdetJi/ySSQPEc42bDGVps=
-=OmlQ
+iD8DBQFLDWEVoxKgR168RlERAjrAAKCB/VKRKhYLK3n+HL8zd1duNxwkxQCfbc2N
+c9b72fb+mD/lcn1IAqU+NZQ=
+=Av30
-----END PGP SIGNATURE-----
-cb74b81bb0322efdd66146d7de466c14564b18fd
\ No newline at end of file
+3ba773132d3baeb87acaee538b8fb0b0f4293673
\ No newline at end of file
case etSQLESCAPE:
case etSQLESCAPE2:
case etSQLESCAPE3: {
- int i, j, n, isnull;
+ int i, j, k, n, isnull;
int needQuote;
char ch;
char q = ((xtype==etSQLESCAPE3)?'"':'\''); /* Quote character */
char *escarg = va_arg(ap,char*);
isnull = escarg==0;
if( isnull ) escarg = (xtype==etSQLESCAPE2 ? "NULL" : "(NULL)");
- for(i=n=0; (ch=escarg[i])!=0; i++){
+ k = precision;
+ for(i=n=0; (ch=escarg[i])!=0 && k!=0; i++, k--){
if( ch==q ) n++;
}
needQuote = !isnull && xtype==etSQLESCAPE2;
}
j = 0;
if( needQuote ) bufpt[j++] = q;
- for(i=0; (ch=escarg[i])!=0; i++){
- bufpt[j++] = ch;
+ k = i;
+ for(i=0; i<k; i++){
+ bufpt[j++] = ch = escarg[i];
if( ch==q ) bufpt[j++] = ch;
}
if( needQuote ) bufpt[j++] = q;
bufpt[j] = 0;
length = j;
- /* The precision is ignored on %q and %Q */
- /* if( precision>=0 && precision<length ) length = precision; */
+ /* The precision in %q and %Q means how many input characters to
+ ** consume, not the length of the output...
+ ** if( precision>=0 && precision<length ) length = precision; */
break;
}
case etTOKEN: {
do_test printf-4.4 {
sqlite3_mprintf_str {%d %d A NULL pointer in %%Q: %Q} 1 2
} {1 2 A NULL pointer in %Q: NULL}
+do_test printf-4.5 {
+ sqlite3_mprintf_str {%d %d A quoted string: '%.10q'} 1 2 {Hi Y'all}
+} {1 2 A quoted string: 'Hi Y''all'}
+do_test printf-4.6 {
+ sqlite3_mprintf_str {%d %d A quoted string: '%.9q'} 1 2 {Hi Y'all}
+} {1 2 A quoted string: 'Hi Y''all'}
+do_test printf-4.7 {
+ sqlite3_mprintf_str {%d %d A quoted string: '%.8q'} 1 2 {Hi Y'all}
+} {1 2 A quoted string: 'Hi Y''all'}
+do_test printf-4.8 {
+ sqlite3_mprintf_str {%d %d A quoted string: '%.7q'} 1 2 {Hi Y'all}
+} {1 2 A quoted string: 'Hi Y''al'}
+do_test printf-4.9 {
+ sqlite3_mprintf_str {%d %d A quoted string: '%.6q'} 1 2 {Hi Y'all}
+} {1 2 A quoted string: 'Hi Y''a'}
+do_test printf-4.10 {
+ sqlite3_mprintf_str {%d %d A quoted string: '%.5q'} 1 2 {Hi Y'all}
+} {1 2 A quoted string: 'Hi Y'''}
+do_test printf-4.11 {
+ sqlite3_mprintf_str {%d %d A quoted string: '%.4q'} 1 2 {Hi Y'all}
+} {1 2 A quoted string: 'Hi Y'}
+do_test printf-4.12 {
+ sqlite3_mprintf_str {%d %d A quoted string: '%.3q'} 1 2 {Hi Y'all}
+} {1 2 A quoted string: 'Hi '}
+do_test printf-4.13 {
+ sqlite3_mprintf_str {%d %d A quoted string: '%.2q'} 1 2 {Hi Y'all}
+} {1 2 A quoted string: 'Hi'}
+do_test printf-4.14 {
+ sqlite3_mprintf_str {%d %d A quoted string: '%.1q'} 1 2 {Hi Y'all}
+} {1 2 A quoted string: 'H'}
+do_test printf-4.15 {
+ sqlite3_mprintf_str {%d %d A quoted string: '%.0q'} 1 2 {Hi Y'all}
+} {1 2 A quoted string: ''}
+do_test printf-4.16 {
+ sqlite3_mprintf_str {%d A quoted string: '%.*q'} 1 6 {Hi Y'all}
+} {1 A quoted string: 'Hi Y''a'}
+
do_test printf-5.1 {
set x [sqlite3_mprintf_str {%d %d %100000s} 0 0 {Hello}]