diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/shell.c.in | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/shell.c.in b/src/shell.c.in index 5bda7c9cd..fef9d45c3 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -1237,8 +1237,11 @@ static void shellDtostr( sqlite3_value **apVal ){ double r = sqlite3_value_double(apVal[0]); - char z[200]; - sprintf(z, "%#+.26e", r); + int n = nVal>=2 ? sqlite3_value_int(apVal[1]) : 26; + char z[400]; + if( n<1 ) n = 1; + if( n>350 ) n = 350; + sprintf(z, "%#+.*e", n, r); sqlite3_result_text(pCtx, z, -1, SQLITE_TRANSIENT); } @@ -5503,6 +5506,8 @@ static void open_db(ShellState *p, int openFlags){ shellStrtod, 0, 0); sqlite3_create_function(p->db, "dtostr", 1, SQLITE_UTF8, 0, shellDtostr, 0, 0); + sqlite3_create_function(p->db, "dtostr", 2, SQLITE_UTF8, 0, + shellDtostr, 0, 0); sqlite3_create_function(p->db, "shell_add_schema", 3, SQLITE_UTF8, 0, shellAddSchemaName, 0, 0); sqlite3_create_function(p->db, "shell_module_schema", 1, SQLITE_UTF8, 0, |