78 Commits

Author SHA1 Message Date
drh
a0a63a0408 New test cases for QRF
FossilOrigin-Name: e49c63e31888c6787ab13f736d58ff985a24c3f98b475e05c30e8b244afffb80
2025-12-02 18:37:49 +00:00
drh
9fb597aed1 Add developer note on how to measure coverage of QRF.
FossilOrigin-Name: 0fdd453c03addb8f5c1e546f7513e3498bccd61266174ce99a61ceebf04e97cf
2025-12-02 12:23:24 +00:00
drh
a4f0592c5d Tweaks to the wcwidth() algorithm in QRF, for better agreement with
the Terminal on Ubuntu.  There is no perfect solution, as different
ttys do things differently, but we should try to get as close as we
can.

FossilOrigin-Name: 35f39f7cb1030b1a57f2921f50ab600496fc1e774593717845e87f2e47dc49ba
2025-11-30 23:09:24 +00:00
drh
cee98b4ced Handle empty string values in columnar modes without NULL pointer
dereferences.

FossilOrigin-Name: 7927dbc5ebc76233325e45bd24181dbc5c3636e271f9352cf530f41dad6ba66d
2025-11-29 18:18:15 +00:00
drh
00bca0b6de Ensure that the split-column transformer in QRF correctly
transforms the abNum[] array.

FossilOrigin-Name: ea67d8b001d1be3b0410ca697ff7ddda71c957c8ecb6d76e75133ba39b754623
2025-11-27 11:29:14 +00:00
drh
9fa8f1d6e0 Improvements to the QRF README.md file to help clarify how to use it.
FossilOrigin-Name: ff589e9e0da99e2248bc7a8bff37e1deb7cbdf8285c18467acd89b65c67401d3
2025-11-26 22:58:26 +00:00
drh
95f643c27d Do not omit the beginning and ending margins when setting bBorder to QRF_Off,
except when the margins need to be squeezed to fit.  Those extra margins give
a more pleasing appearance, and also make the output the same as psql.

FossilOrigin-Name: 2892aaeed9f55ad87791491068493c2e530eeff4194d156f16745d185760797c
2025-11-26 21:56:55 +00:00
drh
9286439c4a In QRF, if the horizontal alignment is QRF_ALIGN_Auto, then use right
alignment for numeric values and left alignment for everything else.

FossilOrigin-Name: 5fdedc69b1ac05bcdc40ee30c1473be75d3afe89e031d750c8fc3dcfa9846d5b
2025-11-26 17:23:11 +00:00
drh
80c1010f88 Add the bBorder option to the QRF spec. Reflect this in the -border
option on the TCL format method, and the --border option to ".mode"
in the CLI.  Also add the "psql" mode to the CLI.

FossilOrigin-Name: 02cbeb69884cd884d9b1b5f59c4168a3dc24b1a5aecc6967586c0be350b10574
2025-11-26 16:21:56 +00:00
drh
6ef15842cd Fix subtle inaccuracies in qrfWrapLine(). Omit an unused variable from shell.c.in.
FossilOrigin-Name: 5804ba4874cc41b11e8bb559d5533283c2895d2b13316830955663575567f911
2025-11-25 18:20:33 +00:00
drh
011c261472 Work around an incorrect compiler warning on Mac.
FossilOrigin-Name: d4c1d3e30b774802a7abd5f61807a690fb5be7617459f3dbd7ec1efceb6125d7
2025-11-25 13:58:36 +00:00
drh
b24048ddce Omit the unused bTextNull flag from the QRF spec object.
FossilOrigin-Name: 4bbf176a87b1bedcce0359b70bbf6831a1e458d48c91dcba49f5e00bb38ecaa1
2025-11-25 10:53:39 +00:00
drh
94b621a15a Add the --blob-quote option to the ".mode" command in the CLI.
FossilOrigin-Name: 76a986b10d284b25915a07b7150ef1b85f4ef7d48d4e5315b13e7d1532cb97f1
2025-11-24 18:31:13 +00:00
drh
4aadef3370 Add the QRF_BLOB_Size encoding for BLOBs in QRF.
FossilOrigin-Name: bafff695d34202377b937cb4ca9f8a7611ae286d9ab927e6c71faa3cd99496e5
2025-11-24 16:46:08 +00:00
drh
58a4e08e3d In QRF in bSplitColumn mode, increase the spacing between columns to be as
wide as five, for improved legibility, if screen width allows.

FossilOrigin-Name: 673648cc812e1549c2b3e7749306e7395d0b7e396a7d5ac432948eb3a6c3713f
2025-11-23 00:45:47 +00:00
drh
d0056d4234 Use the new "split" mode to simplify and improve the implementation of
the ".tables" and ".indexes" commands in the CLI.  Fix a bug in QRF
that this new implementation found.

FossilOrigin-Name: b73df612b621699cd58de6ef327fefdeb8f52eb620f0d2df00d38ff6608a8dd5
2025-11-23 00:10:06 +00:00
drh
946857cfee In QRF, change the name of the bWrapSnglCol flag to bSplitColumn.
Similar changes to the TCL interface.

FossilOrigin-Name: 76512b3b80fdcaae22340cde0b69857e2a4d7e86a63c6759465bd8a0bcbf82bc
2025-11-22 21:34:33 +00:00
drh
f4197be567 Implementation of bWrapSnglCol in QRF.
FossilOrigin-Name: 4bbd3f7ead50c0babd7843f58972e2e1762a84866cc4ed88a2a74375b13da11c
2025-11-22 00:38:17 +00:00
drh
081a877211 Add the bWrapSnglCol flag to the QRF spec, though it is not yet documented
and does not yet work.  Fix column output so that it omits trailing space.

FossilOrigin-Name: a858027fc92727c680b7e984303df7f9e0a2d90c860c547176f290b113a69390
2025-11-21 20:10:12 +00:00
drh
a5e454d11c Need a double-underscore prefix on the cplusplus macro
FossilOrigin-Name: 04394387e626cd99ff98df978c4b7f2d32f65760e0c26e53f1ef4f59e4e91a4f
2025-11-21 19:47:13 +00:00
drh
725e6836d0 Fix the qrf.h header so that it is usable from C++
FossilOrigin-Name: 1105b710934cf4a243c64d37dd147bc9378c0f7aa55a99891b7ac6e8f8f17f88
2025-11-21 19:01:26 +00:00
drh
ac16642cc4 Fix the QRF so that it omits the closing text from styles "json" and "jobject"
when the result set it empty.

FossilOrigin-Name: e1ba175124be83da4db6d5d4e583b9b3b7dcb82e983c6f185d590469dcdc3139
2025-11-21 11:00:29 +00:00
drh
53794ab541 The -textjsonb option is on by default in the standard non-batch mode of
the CLI.  New fast screening test for JSONB.

FossilOrigin-Name: fd09f934d64ec07fd56f1b80ab05dafb28b605d5802ff5758eea17d8ad24e3cc
2025-11-17 18:51:55 +00:00
drh
234d2e51ac CLI comes up in legacy "list" mode if neither stdin or stdout are a tty, or
if "--compat 20251114" or earlier is specified, or if "--batch" is used.
New modes "batch" and "tty" select either legacy "list" mode or the newer
"qbox" mode with limits.
Make CVS output compatible with legacy.  Break out ".import" into a separate
subroutine in anticipation of forthcoming improvements.  General code
cleanup.

FossilOrigin-Name: f6bfcea9a01493af182e9aa0d35df6f81bf9e36220df79139afa287fa43d9aa3
2025-11-17 16:44:13 +00:00
drh
dd3b30ec85 Columnar modes respond to nScreenWidth.
FossilOrigin-Name: 60d26ebb4d91cc885b6b938ef2fc2864ebbf5a18d2e456521ee2f4aa3b22eddf
2025-11-15 15:18:41 +00:00
drh
18c7b4d651 Columnar formats respond to --screenwidth restrictions by removing
cell padding.

FossilOrigin-Name: cbe233ca131118692fd4a84d8fcf0dfca926fa935f66cfb718c235d54084de3d
2025-11-15 12:09:13 +00:00
drh
3338ca5f56 Data structure improvements on columnar layout. Prep work for getting
columnar layouts to respond to nScreenWidth.

FossilOrigin-Name: 777eeb2ed2708faf42559387bd582b9345a794798a0327e4fcd75e37948eac60
2025-11-15 11:28:23 +00:00
drh
7a0d5bdd29 Improve columnar layout in QRF so that it correctly deals with control
characters, and especially tabs.

FossilOrigin-Name: 0650e2b83170b44c1ba944259a96d41e1a14a57004d4f1f80dc5640ae837a81e
2025-11-15 00:23:09 +00:00
drh
c2b9896e50 Enforce the --charlimit constraint in QRF.
FossilOrigin-Name: c25f8fdedd8d68e3551a445e24e1c60e105e18f9cf8f1badcbb77a58974f3381
2025-11-14 21:40:20 +00:00
drh
a7b9a10707 Fix harmless compiler warnings. Incorporate "USAGE:" comments on dot-command
implementations into the CLI ".help" command output.

FossilOrigin-Name: 046bfab4a01e8a7cc58d1bdf0756c90ba354562d79e5453c08202daf648e76a6
2025-11-14 14:59:43 +00:00
drh
d5ee8aa625 Fix various bugs and compiler warnings. All tests now passing on linux, mac,
and windows.  More testing needed, though.

FossilOrigin-Name: 2220cb70c2f1ee30dcdf917a20feacdfcb3789433d0645fea626fd4c5cf0d099
2025-11-14 13:07:45 +00:00
drh
b9a471a745 More details on the format of the QRF_STYLE_Json and QRF_STYLE_JOBject.
FossilOrigin-Name: 2b22321df9c2f51e4b0ab9e4da859c58bb3f194ad69c22b9d32b35831740f9dd
2025-11-12 19:03:05 +00:00
drh
3b847a4040 Rename QRF_STYLE_JsonLine to QRF_STYLE_JObject. Add new convenience modes
to the CLI and generally refactor and improve the ".mode" command.  Some
tests are failing, mostly due to changes in error message output and similar.

FossilOrigin-Name: 4c8109682e3a224fd8e015e73a9c1c7b6d56ad747d7ca7bc387bb92e1c98f731
2025-11-12 12:44:02 +00:00
drh
b43e8920d8 Minor refactoring of some field names in the sqlite3_qrf_spec object, to try
to make the names more intuitive, memorable, and succinct.

FossilOrigin-Name: 3450bc7eecb717abedbaeb56dc824e14eb35ed30322fe3dd3b4b1cbd5fd14c60
2025-11-11 18:07:42 +00:00
drh
71b65c5055 Revamp the internal data structures that the CLI uses for tracking and
managing the display mode.  This is an incremental check-in.  The code
compiles and runs, but not all tests are passing.

FossilOrigin-Name: 8cc581e53c2ab15bd311e082048b7c57b03a754d25c0b4beead08a3362ac1c7a
2025-11-10 23:40:40 +00:00
drh
0c4c0dbc7d Keep explicit NULL values in QRF_STYLE_Json output.
FossilOrigin-Name: cb07f3d441b0b2a3ebdfaa9456891a9c8e33fa07b967532a9edfaf6ff3163cb0
2025-11-10 22:05:42 +00:00
drh
09f16c5ab6 Add the bTextNull field to sqlite3_qrf_spec. Use QRF to implement "tcl"
mode in the CLI.

FossilOrigin-Name: 2ba92320db3c16c3c91e29ea935ae92da546261f25846d242bd2dd27e0b7e032
2025-11-10 12:32:04 +00:00
drh
7f28c6d64e Enforce mxRowHeight in columnar layouts. Code clean-up. Minimum column with
is 2 if there is wrapping, in case there are double-wide characters.

FossilOrigin-Name: 0ee8fc00af4c82da0d597c65dd3d8590c71ea78d8f4a29653bbb21668c6c530d
2025-11-09 17:25:23 +00:00
drh
c1aac60386 Fixes for harmless static analyzer warnings.
FossilOrigin-Name: 37bd136ae842c8f8110c10b0834c804a8af133ce0caff492f37bd567a56ac6c6
2025-11-09 00:37:29 +00:00
drh
edc34bf866 Name changes. QRF_TEXT_Off becomes QRF_TEXT_Plain. mxTotalWidth becomes
nScreenWidth.

FossilOrigin-Name: 871567e377e976e0bb191d466019d1d4abe126f2da1880f1e25cd92b06a666d1
2025-11-08 22:46:29 +00:00
drh
bfa8c7d370 Improvements to QRF_STYLE_Line. Make it responsive to mxTotalWidth and
mxRowHeight.  Indent subsequent lines appropriately.  Add corresponding
test cases.

FossilOrigin-Name: 23ddc38cf19845a385c8b33002805c3c864ab9b2e36c3d609794444b06d20c89
2025-11-08 18:31:57 +00:00
drh
44aea46a07 Fix minor issues with alignment and quoting. All legacy tests are now
passing.

FossilOrigin-Name: 712b890531d351cf19d57d8cc6dced5cdd2c394d69fd1ace98298d79ddca269a
2025-11-08 17:08:19 +00:00
drh
96e47e16e7 Miscellaneous fixes to the new alignment configurations.
FossilOrigin-Name: 787fb4c2ac80db6552bc7a740c3c3c63c0c8414cb4e7db80d367b4b5512519d0
2025-11-08 15:25:07 +00:00
drh
22d6a48ba7 Separate column width specification from cell alignment.
FossilOrigin-Name: 5dadfd7f41764ddfed39bb49bbde3a54d8f282bb494c9c2abbba37d0995a7f8e
2025-11-08 14:04:29 +00:00
drh
ca111b06f3 Minor changes to fix a few legacy test cases. Snapshot prior to yet another
refactor.

FossilOrigin-Name: b429e7882fd630a490350efa38bfce8686d6727f324a60191337a59d5436828b
2025-11-08 10:48:55 +00:00
drh
e8cd0ee61f Make sure columnar outputs always invoke qrfWrite().
FossilOrigin-Name: 21084041196dd6908bb810d8fce80b7f6d5b12ebe474bf62b85128540ad020eb
2025-11-08 03:44:05 +00:00
drh
6eb5f5d9a7 Rewrite the table layout in QRF. Easier to maintain now. Still a few
shell test failures, but much better after this rewrite.

FossilOrigin-Name: 25838d282c5f7a922988245f373edfe8adbe28e929abce83afcda2b08472e685
2025-11-08 03:20:47 +00:00
drh
d2424338b0 Incremental check-in. QRF is working, but there are many test failures
in the shell test modules.

FossilOrigin-Name: de7fc9afc43d4bd5f5995832cd698633e0e7213c190fa044856c9f82512161f9
2025-11-07 17:48:14 +00:00
drh
a6b4039050 Begin the process of integrating QRF into the CLI. Adjust makefiles.
Include the QRF code in shell.c.  But QRF is not yet used by the CLI.

FossilOrigin-Name: 7596fc32b371e5e657e830c2e80e61b0947320a7359833e915a888a438c2e935
2025-11-07 14:31:17 +00:00
drh
eedf226700 Update documentation to clarify that mxTotalWidth and mxLength are not
yet implemented.

FossilOrigin-Name: c25806fc5491554f1cd55174c6cf98b509d619e3011b8e26abdf05b24133a6e8
2025-11-07 13:23:29 +00:00