Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch tclMode Excluding Merge-Ins
This is equivalent to a diff from 7d5fc1a339 to 41fd9dd290
2012-12-04
| ||
00:59 | Improvements to the 'tcl' shell output mode. Escape doublequotes, set separator to space when mode is set, and skip separator after final column. (check-in: 487ba75313 user: drh tags: trunk) | |
00:37 | Fix an out-of-order function declaration when compiled with MEMDEBUG. (check-in: 6d31557837 user: mistachkin tags: trunk) | |
00:23 | Improvements to the 'tcl' shell output mode. Escape double quotes, set separator to space when mode is set, and skip separator after final column. (Closed-Leaf check-in: 41fd9dd290 user: mistachkin tags: tclMode) | |
2012-12-03
| ||
19:42 | Remove an unreachable condition. Replace it with an assert(). (check-in: 7d5fc1a339 user: drh tags: trunk) | |
17:04 | Make sure that the optimization that set the maximum column that will be used on a particular query does not mistakenly change an opcode other than OP_OpenRead or OP_OpenWrite. In particular, make sure it does not overwrite the P4 field of an OP_SorterOpen. (check-in: b0c1ba655d user: drh tags: trunk) | |
Changes to src/shell.c.
︙ | ︙ | |||
537 538 539 540 541 542 543 544 545 546 547 548 549 550 | static void output_c_string(FILE *out, const char *z){ unsigned int c; fputc('"', out); while( (c = *(z++))!=0 ){ if( c=='\\' ){ fputc(c, out); fputc(c, out); }else if( c=='\t' ){ fputc('\\', out); fputc('t', out); }else if( c=='\n' ){ fputc('\\', out); fputc('n', out); }else if( c=='\r' ){ | > > > | 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 | static void output_c_string(FILE *out, const char *z){ unsigned int c; fputc('"', out); while( (c = *(z++))!=0 ){ if( c=='\\' ){ fputc(c, out); fputc(c, out); }else if( c=='"' ){ fputc('\\', out); fputc('"', out); }else if( c=='\t' ){ fputc('\\', out); fputc('t', out); }else if( c=='\n' ){ fputc('\\', out); fputc('n', out); }else if( c=='\r' ){ |
︙ | ︙ | |||
792 793 794 795 796 797 798 | fprintf(p->out,"</TR>\n"); break; } case MODE_Tcl: { if( p->cnt++==0 && p->showHeader ){ for(i=0; i<nArg; i++){ output_c_string(p->out,azCol[i] ? azCol[i] : ""); | | | | 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 | fprintf(p->out,"</TR>\n"); break; } case MODE_Tcl: { if( p->cnt++==0 && p->showHeader ){ for(i=0; i<nArg; i++){ output_c_string(p->out,azCol[i] ? azCol[i] : ""); if(i<nArg-1) fprintf(p->out, "%s", p->separator); } fprintf(p->out,"\n"); } if( azArg==0 ) break; for(i=0; i<nArg; i++){ output_c_string(p->out, azArg[i] ? azArg[i] : p->nullvalue); if(i<nArg-1) fprintf(p->out, "%s", p->separator); } fprintf(p->out,"\n"); break; } case MODE_Csv: { if( p->cnt++==0 && p->showHeader ){ for(i=0; i<nArg; i++){ |
︙ | ︙ | |||
2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 | p->mode = MODE_Column; }else if( n2==4 && strncmp(azArg[1],"list",n2)==0 ){ p->mode = MODE_List; }else if( n2==4 && strncmp(azArg[1],"html",n2)==0 ){ p->mode = MODE_Html; }else if( n2==3 && strncmp(azArg[1],"tcl",n2)==0 ){ p->mode = MODE_Tcl; }else if( n2==3 && strncmp(azArg[1],"csv",n2)==0 ){ p->mode = MODE_Csv; sqlite3_snprintf(sizeof(p->separator), p->separator, ","); }else if( n2==4 && strncmp(azArg[1],"tabs",n2)==0 ){ p->mode = MODE_List; sqlite3_snprintf(sizeof(p->separator), p->separator, "\t"); }else if( n2==6 && strncmp(azArg[1],"insert",n2)==0 ){ | > | 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 | p->mode = MODE_Column; }else if( n2==4 && strncmp(azArg[1],"list",n2)==0 ){ p->mode = MODE_List; }else if( n2==4 && strncmp(azArg[1],"html",n2)==0 ){ p->mode = MODE_Html; }else if( n2==3 && strncmp(azArg[1],"tcl",n2)==0 ){ p->mode = MODE_Tcl; sqlite3_snprintf(sizeof(p->separator), p->separator, " "); }else if( n2==3 && strncmp(azArg[1],"csv",n2)==0 ){ p->mode = MODE_Csv; sqlite3_snprintf(sizeof(p->separator), p->separator, ","); }else if( n2==4 && strncmp(azArg[1],"tabs",n2)==0 ){ p->mode = MODE_List; sqlite3_snprintf(sizeof(p->separator), p->separator, "\t"); }else if( n2==6 && strncmp(azArg[1],"insert",n2)==0 ){ |
︙ | ︙ |
Changes to test/shell1.test.
︙ | ︙ | |||
715 716 717 718 719 720 721 | } {0 {this is a test}} # Test the output of the ".dump" command # do_test shell1-4.1 { db eval { CREATE TABLE t1(x); | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 | } {0 {this is a test}} # Test the output of the ".dump" command # do_test shell1-4.1 { db eval { CREATE TABLE t1(x); INSERT INTO t1 VALUES(null), (''), (1), (2.25), ('hello'), (x'807f'); } catchcmd test.db {.dump} } {0 {PRAGMA foreign_keys=OFF; BEGIN TRANSACTION; CREATE TABLE t1(x); INSERT INTO "t1" VALUES(NULL); INSERT INTO "t1" VALUES(''); INSERT INTO "t1" VALUES(1); INSERT INTO "t1" VALUES(2.25); INSERT INTO "t1" VALUES('hello'); INSERT INTO "t1" VALUES(X'807F'); COMMIT;}} # Test the output of ".mode insert" # do_test shell1-4.2 { catchcmd test.db ".mode insert t1\nselect * from t1;" } {0 {INSERT INTO t1 VALUES(NULL); INSERT INTO t1 VALUES(''); INSERT INTO t1 VALUES(1); INSERT INTO t1 VALUES(2.25); INSERT INTO t1 VALUES('hello'); INSERT INTO t1 VALUES(X'807f');}} # Test the output of ".mode tcl" # do_test shell1-4.3 { catchcmd test.db ".mode tcl\nselect * from t1;" } {0 {"" "" "1" "2.25" "hello" "\200\177"}} # Test the output of ".mode tcl" with multiple columns # do_test shell1-4.4 { db eval { CREATE TABLE t2(x,y); INSERT INTO t2 VALUES(null, ''), (1, 2.25), ('hello', x'807f'); } catchcmd test.db ".mode tcl\nselect * from t2;" } {0 {"" "" "1" "2.25" "hello" "\200\177"}} # Test the output of ".mode tcl" with ".nullvalue" # do_test shell1-4.5 { catchcmd test.db ".mode tcl\n.nullvalue NULL\nselect * from t2;" } {0 {"NULL" "" "1" "2.25" "hello" "\200\177"}} # Test the output of ".mode tcl" with Tcl reserved characters # do_test shell1-4.6 { db eval { CREATE TABLE tcl1(x); INSERT INTO tcl1 VALUES('"'), ('['), (']'), ('\{'), ('\}'), (';'), ('$'); } foreach {x y} [catchcmd test.db ".mode tcl\nselect * from tcl1;"] break list $x $y [llength $y] } {0 {"\"" "[" "]" "\\{" "\\}" ";" "$"} 7} finish_test |