]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
A few simple test cases added.
authordrh <>
Wed, 5 Nov 2025 16:29:06 +0000 (16:29 +0000)
committerdrh <>
Wed, 5 Nov 2025 16:29:06 +0000 (16:29 +0000)
FossilOrigin-Name: 7200372ed2424d1ac4c88644e0b17a224539f170b9111ced9c88774edbd75261

ext/qrf/qrf.c
manifest
manifest.uuid
test/qrf01.test [new file with mode: 0644]

index 0facd658b550edf2fffcedc79e246837b6897dbb..e0574e21169b173bdc4d79db31a82aacb0ba4643 100644 (file)
@@ -1515,6 +1515,7 @@ qrf_reinit:
     case QRF_STYLE_Insert: {
       p->spec.eText = QRF_TEXT_Sql;
       p->spec.eBlob = QRF_BLOB_Sql;
+      p->spec.zNull = "NULL";
       if( p->spec.zTableName==0 || p->spec.zTableName[0]==0 ){
         p->spec.zTableName = "tab";
       }
@@ -1531,6 +1532,7 @@ qrf_reinit:
     case QRF_STYLE_Quote: {
       p->spec.eText = QRF_TEXT_Sql;
       p->spec.eBlob = QRF_BLOB_Sql;
+      p->spec.zNull = "NULL";
       p->spec.zColumnSep = ",";
       p->spec.zRowSep = "\n";
       break;
index 65737981cdfb0e9bdc1fd178d900481999c800e7..658304e1104de2e09371fe7d6c5e078d0d7eea46 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C New\sstyle\ssetting\sQRF_STYLE_Auto\swhich\schooses\sbox,\sexplain,\sor\sEQP\sdepending\non\sthe\sstatement\sto\sbe\srendered.\s\sImprovements\sto\smemory\smanagement.\nUpdates\sto\sthe\sdocumentation.
-D 2025-11-05T15:44:11.056
+C A\sfew\ssimple\stest\scases\sadded.
+D 2025-11-05T16:29:06.224
 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
@@ -418,7 +418,7 @@ F ext/misc/zipfile.c 09e6e3a3ff40a99677de3c0bc6569bd5f4709b1844ac3d1c1452a456c5a
 F ext/misc/zorder.c bddff2e1b9661a90c95c2a9a9c7ecd8908afab5763256294dd12d609d4664eee
 F ext/qrf/README.md 6bfe3047478b8901694cab91ccc98b35a8e14678f38475dc726be485190d4433
 F ext/qrf/qrf-tester.c 3a733b25a25ba7390cd3df055edd76ac72f488a9c5d9eb523a7508b0b8ac8900
-F ext/qrf/qrf.c 75cbdde120e336b10190d7d1a90aa4855e25eb2e733bbdd44321b489167a816b
+F ext/qrf/qrf.c e45c181d031f71da73c7d605f56ff62640985a9bbb154f0221c5324bbc1b1167
 F ext/qrf/qrf.h 4542c723805550b48ca81ed53e3beea95e793ecc7d2b01d34a780fbea366323f
 F ext/rbu/rbu.c 801450b24eaf14440d8fd20385aacc751d5c9d6123398df41b1b5aa804bf4ce8
 F ext/rbu/rbu1.test 25870dd7db7eb5597e2b4d6e29e7a7e095abf332660f67d89959552ce8f8f255
@@ -1507,6 +1507,7 @@ F test/printf2.test 3f55c1871a5a65507416076f6eb97e738d5210aeda7595a74ee895f2224c
 F test/progress.test ebab27f670bd0d4eb9d20d49cef96e68141d92fb
 F test/ptrchng.test ef1aa72d6cf35a2bbd0869a649b744e9d84977fc
 F test/pushdown.test 46a626ef1c0ca79b85296ff2e078b9da20a50e9b804b38f441590c3987580ddd
+F test/qrf01.test 6b912e5ceb34fb288d47ade071249b8dcd6df40735ee3a7733af99e77e504c25
 F test/queryonly.test 5f653159e0f552f0552d43259890c1089391dcca
 F test/quick.test 1681febc928d686362d50057c642f77a02c62e57
 F test/quickcheck.test a4b7e878cd97e46108291c409b0bf8214f29e18fddd68a42bc5c1375ad1fb80a
@@ -2172,8 +2173,8 @@ F tool/version-info.c 33d0390ef484b3b1cb685d59362be891ea162123cea181cb8e6d2cf6dd
 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
 F tool/warnings.sh d924598cf2f55a4ecbc2aeb055c10bd5f48114793e7ba25f9585435da29e7e98
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P ace1ebda08740bb248c009cc4a6c99da318a2bba3e43ef20bd0c365c5021705f
-R c324dd72d4cef65f02505ddc83f97922
+P 468ba188f034b23398e1f07b915cf7c8b337dcf7f56a13511947c5322ae98722
+R 83d792277e49d25b00c0094481fa71d7
 U drh
-Z 32bacd6d63b86433ef5068a18f2ed528
+Z 7f22080d0311b852cf62e1bdb7405410
 # Remove this line to create a well-formed Fossil manifest.
index ba92ccfbbddefde763b9531db2ea8d6214e6812a..2c029eefa250eee270acf5eea299c578bd178b2d 100644 (file)
@@ -1 +1 @@
-468ba188f034b23398e1f07b915cf7c8b337dcf7f56a13511947c5322ae98722
+7200372ed2424d1ac4c88644e0b17a224539f170b9111ced9c88774edbd75261
diff --git a/test/qrf01.test b/test/qrf01.test
new file mode 100644 (file)
index 0000000..490687f
--- /dev/null
@@ -0,0 +1,136 @@
+# 2025-11-05
+#
+# The author disclaims copyright to this source code.  In place of
+# a legal notice, here is a blessing:
+#
+#    May you do good and not evil.
+#    May you find forgiveness for yourself and forgive others.
+#    May you share freely, never taking more than you give.
+#
+#***********************************************************************
+#
+# Test cases for the Query Result Formatter (QRF)
+#
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+set testprefix qrf01
+
+do_execsql_test 1.0 {
+  CREATE TABLE t1(a, b, c);
+  INSERT INTO t1 VALUES(1,2.5,'three'),(x'424c4f42',NULL,'Ἀμήν');
+}
+
+do_test 1.10 {
+  set result "\n[db format {SELECT * FROM t1}]"
+} {
+┌──────┬─────┬───────┐
+│  a   │  b  │   c   │
+├──────┼─────┼───────┤
+│ 1    │ 2.5 │ three │
+│ BLOB │     │ Ἀμήν  │
+└──────┴─────┴───────┘
+}
+
+do_test 1.20 {
+  set result "\n[db format -style box {SELECT * FROM t1}]"
+} {
+┌──────┬─────┬───────┐
+│  a   │  b  │   c   │
+├──────┼─────┼───────┤
+│ 1    │ 2.5 │ three │
+│ BLOB │     │ Ἀμήν  │
+└──────┴─────┴───────┘
+}
+
+do_test 1.30 {
+  set result "\n[db format -style table {SELECT * FROM t1}]"
+} {
++------+-----+-------+
+|  a   |  b  |   c   |
++------+-----+-------+
+| 1    | 2.5 | three |
+| BLOB |     | Ἀμήν  |
++------+-----+-------+
+}
+
+do_test 1.40 {
+  set result "\n[db format -style column {SELECT * FROM t1}]"
+} {
+1     2.5  three
+BLOB       Ἀμήν 
+}
+
+do_test 1.50 {
+  db format -style count {SELECT * FROM t1}
+} 2
+
+do_test 1.60 {
+  db format -style csv {SELECT * FROM t1}
+} "1,2.5,three\r\n\"\\102\\114\\117\\102\",,\"Ἀμήν\"\r\n"
+
+do_test 1.70 {
+  set result "\n[db format -style html {SELECT * FROM t1}]"
+} {
+<TR>
+<TD>1
+<TD>2.5
+<TD>three
+</TR>
+<TR>
+<TD>BLOB
+<TD>null
+<TD>Ἀμήν
+</TR>
+}
+
+do_test 1.80 {
+  set result "\n[db format -style insert {SELECT * FROM t1}]"
+} {
+INSERT INTO tab VALUES(1,2.5,'three');
+INSERT INTO tab VALUES(x'424c4f42',NULL,'Ἀμήν');
+}
+
+do_test 1.90 {
+  set result "\n[db format -style json {SELECT * FROM t1}]"
+} {
+[{"a":1,"b":2.5,"c":"three"},
+{"a":"\u0042\u004c\u004f\u0042","b":null,"c":"Ἀμήν"}]
+}
+
+do_test 1.100 {
+  set result "\n[db format -style line {SELECT * FROM t1}]"
+} {
+a = 1
+b = 2.5
+c = three
+
+a = BLOB
+b = 
+c = Ἀμήν
+}
+
+do_test 1.110 {
+  set result "\n[db format -style list {SELECT * FROM t1}]"
+} {
+1|2.5|three
+BLOB||Ἀμήν
+}
+
+do_test 1.120 {
+  set result "\n[db format -style markdown {SELECT * FROM t1}]"
+} {
+|  a   |  b  |   c   |
+|------|-----|-------|
+| 1    | 2.5 | three |
+| BLOB |     | Ἀμήν  |
+}
+
+do_test 1.130 {
+  set result "\n[db format -style quote {SELECT * FROM t1}]"
+} {
+1,2.5,'three'
+x'424c4f42',NULL,'Ἀμήν'
+}
+
+finish_test