better-sqlite3 icon indicating copy to clipboard operation
better-sqlite3 copied to clipboard

Verbose: max length

Open Paultje52 opened this issue 2 years ago • 2 comments

Hello, I'm trying to use the "verbose" option to debug my code, however I'm running into a problem: the verbose option has a max length. When I want to debug large queries, I get this: UPDATE dataSETvalue='{"excelRead":{"Blad1":["Serial",'/*+13627 bytes*/ WHERE key = 'page-TNjmvagO3E' LIMIT 1.

Is there a way to disable that /*+13627 bytes*/ so I can read the whole SQL query? Thanks for your help in advance!

Paultje52 avatar Jun 01 '22 17:06 Paultje52

Any update on my issue?

Paultje52 avatar Jun 24 '22 15:06 Paultje52

You can compile a custom version and set SQLITE_TRACE_SIZE_LIMIT and SQLITE_LIMIT_LENGTH to whatever size you need.

See:

https://www.sqlite.org/c3ref/expanded_sql.html https://github.com/WiseLibs/better-sqlite3/blob/master/docs/compilation.md https://github.com/WiseLibs/better-sqlite3/blob/6da9e569dbd3ad6d3e04b4cbd61c788c039d2ef3/src/objects/database.lzz#L67

The sqlite3_expanded_sql() interface returns NULL if insufficient memory is available to hold the result, or if the result would exceed the the maximum string length determined by the SQLITE_LIMIT_LENGTH. The SQLITE_TRACE_SIZE_LIMIT compile-time option limits the size of bound parameter expansions. The SQLITE_OMIT_TRACE compile-time option causes sqlite3_expanded_sql() to always return NULL.

I don't see these options being increased in the future for the default better-sqlite3.

Prinzhorn avatar Jul 16 '22 08:07 Prinzhorn