diff options
Diffstat (limited to 'src/printf.c')
-rw-r--r-- | src/printf.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/printf.c b/src/printf.c index 65e539bef..0cbd4c3c6 100644 --- a/src/printf.c +++ b/src/printf.c @@ -649,6 +649,7 @@ void sqlite3_str_vappendf( { i64 szBufNeeded; /* Size of a temporary buffer needed */ szBufNeeded = MAX(e2,0)+(i64)precision+(i64)width+15; + if( cThousand ) szBufNeeded += (e2+2)/3; if( szBufNeeded > etBUFSIZE ){ bufpt = zExtra = printfTempBuf(pAccum, szBufNeeded); if( bufpt==0 ) return; @@ -666,10 +667,12 @@ void sqlite3_str_vappendf( }else if( msd>0 ){ for(; e2>=0; e2--){ *(bufpt++) = et_getdigit_int(&longvalue,&msd); + if( cThousand && (e2%3)==0 && e2>1 ) *(bufpt++) = ','; } }else{ for(; e2>=0; e2--){ *(bufpt++) = et_getdigit(&realvalue,&nsd); + if( cThousand && (e2%3)==0 && e2>1 ) *(bufpt++) = ','; } } /* The decimal point */ |