From cc1a3d3d85d2655fb5131fd637ab2d5a0a408f1c Mon Sep 17 00:00:00 2001 From: drh <> Date: Thu, 23 Oct 2025 17:09:03 +0000 Subject: [PATCH] Add CSV mode. FossilOrigin-Name: bf0fec0d4961bd4df3ff874bf8d32b28df48a1739e107ffb0b7bf57affe5f0b6 --- ext/qrf/qrf-tester.c | 1 + ext/qrf/qrf.c | 8 ++++++++ ext/qrf/qrf.h | 19 ++++++++++--------- manifest | 16 ++++++++-------- manifest.uuid | 2 +- 5 files changed, 28 insertions(+), 18 deletions(-) diff --git a/ext/qrf/qrf-tester.c b/ext/qrf/qrf-tester.c index 6d194be8af..6c57bb3ddd 100644 --- a/ext/qrf/qrf-tester.c +++ b/ext/qrf/qrf-tester.c @@ -186,6 +186,7 @@ int main(int argc, char **argv){ if( strncmp(zLine, "--eFormat=", 10)==0 ){ const struct { const char *z; int e; } aFmt[] = { { "box", QRF_MODE_Box, }, + { "csv", QRF_MODE_Csv, }, { "column", QRF_MODE_Column, }, { "count", QRF_MODE_Count, }, { "eqp", QRF_MODE_EQP, }, diff --git a/ext/qrf/qrf.c b/ext/qrf/qrf.c index fc1d8cc3a2..3f063894e7 100644 --- a/ext/qrf/qrf.c +++ b/ext/qrf/qrf.c @@ -1158,6 +1158,14 @@ static void qrfInitialize( } break; } + case QRF_MODE_Csv: { + p->spec.eFormat = QRF_MODE_List; + p->spec.eQuote = QRF_TXT_Csv; + p->spec.eBlob = QRF_BLOB_Tcl; + p->spec.zColumnSep = ","; + p->spec.zRowSep = "\r\n"; + break; + } } if( p->spec.eBlob==QRF_BLOB_Auto ){ switch( p->spec.eQuote ){ diff --git a/ext/qrf/qrf.h b/ext/qrf/qrf.h index abe3b37506..d40d02e24b 100644 --- a/ext/qrf/qrf.h +++ b/ext/qrf/qrf.h @@ -67,15 +67,16 @@ int sqlite3_format_query_result( #define QRF_MODE_Html 2 /* Generate an XHTML table */ #define QRF_MODE_Json 3 /* Output is a list of JSON objects */ #define QRF_MODE_Insert 4 /* Generate SQL "insert" statements */ -#define QRF_MODE_Explain 5 /* EXPLAIN output */ -#define QRF_MODE_ScanExp 6 /* EXPLAIN output with vm stats */ -#define QRF_MODE_EQP 7 /* Format EXPLAIN QUERY PLAN output */ -#define QRF_MODE_Markdown 8 /* Markdown formatting */ -#define QRF_MODE_Column 9 /* One record per line in neat columns */ -#define QRF_MODE_Table 10 /* MySQL-style table formatting */ -#define QRF_MODE_Box 11 /* Unicode box-drawing characters */ -#define QRF_MODE_Count 12 /* Output only a count of the rows of output */ -#define QRF_MODE_Off 13 /* No query output shown */ +#define QRF_MODE_Csv 5 /* Comma-separated-value */ +#define QRF_MODE_Explain 6 /* EXPLAIN output */ +#define QRF_MODE_ScanExp 7 /* EXPLAIN output with vm stats */ +#define QRF_MODE_EQP 8 /* Format EXPLAIN QUERY PLAN output */ +#define QRF_MODE_Markdown 9 /* Markdown formatting */ +#define QRF_MODE_Column 10 /* One record per line in neat columns */ +#define QRF_MODE_Table 11 /* MySQL-style table formatting */ +#define QRF_MODE_Box 12 /* Unicode box-drawing characters */ +#define QRF_MODE_Count 13 /* Output only a count of the rows of output */ +#define QRF_MODE_Off 14 /* No query output shown */ /* ** Quoting styles for text. diff --git a/manifest b/manifest index 9436980603..b617bbbbeb 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Implement\sLINE\smode. -D 2025-10-23T16:57:57.397 +C Add\sCSV\smode. +D 2025-10-23T17:09:03.667 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -416,9 +416,9 @@ F ext/misc/wholenumber.c 0fa0c082676b7868bf2fa918e911133f2b349bcdceabd1198bba5f6 F ext/misc/windirent.h 02211ce51f3034c675f2dbf4d228194d51b3ee05734678bad5106fff6292e60c F ext/misc/zipfile.c 09e6e3a3ff40a99677de3c0bc6569bd5f4709b1844ac3d1c1452a456c5a62f1c F ext/misc/zorder.c bddff2e1b9661a90c95c2a9a9c7ecd8908afab5763256294dd12d609d4664eee -F ext/qrf/qrf-tester.c 4212d01e1408591c6e6b081d119e125c97efea5a2f97f4ff05c28b8a5e1272bc -F ext/qrf/qrf.c 8f233d4fa1d2297f0bafdbec9eef6d88f4ec6cdf2e7af3ce49121358ba693678 -F ext/qrf/qrf.h 8ad45ac2a8661010c936778bb017cb691fddf2fe27546feb28ca67a0f88967e3 +F ext/qrf/qrf-tester.c b35585d96e36cdefa0dcef5716830d0bac123b0c776e27622744216c16d213da +F ext/qrf/qrf.c aee2a93792fdd6119556913f8137ca3850225776d4266e765f32b20476664065 +F ext/qrf/qrf.h 8b4a6ee36c38778fc9cec6f34b555b3d33cc4d388babade6de0f64cda6a24d73 F ext/qrf/qrf.md 4eea619191dab7bbf483eff3fe3b074a07d7c8c50bc86070a4485797d386d1ff F ext/rbu/rbu.c 801450b24eaf14440d8fd20385aacc751d5c9d6123398df41b1b5aa804bf4ce8 F ext/rbu/rbu1.test 25870dd7db7eb5597e2b4d6e29e7a7e095abf332660f67d89959552ce8f8f255 @@ -2175,8 +2175,8 @@ F tool/version-info.c 33d0390ef484b3b1cb685d59362be891ea162123cea181cb8e6d2cf6dd F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 6d695ecdfdc5dca78b430263fc298bb6c8182a2406dc79b70f159abd37463f1e -R 84cb7350edc1eb542c2ce2b06c63220a +P b4c4ba0ad53c6685410700aa332ebec75c9e32848f881b31bc257f86f7befe2c +R 59b93cb40c4a2ac476e1a8b29c03e47d U drh -Z 05eec1b9c8d3ba664d59bb59be097c36 +Z dc9c4073a97d2b240adb1466269536be # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 0ef1605e84..212d6cf894 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b4c4ba0ad53c6685410700aa332ebec75c9e32848f881b31bc257f86f7befe2c +bf0fec0d4961bd4df3ff874bf8d32b28df48a1739e107ffb0b7bf57affe5f0b6 -- 2.47.3