mirror of
https://github.com/sqlite/sqlite.git
synced 2025-10-21 11:13:54 +03:00
Convert the ShellText object in the CLI to use sqlite3_malloc64() rather than
plain malloc(). Avoid unnecessary quoting of table names in .dump output and similar. Improved detection of OOM in set_table_name(). FossilOrigin-Name: 6ce4f6dc15a575c318669051fe6590ad114b52ff3f3e260cdf7accccdd922d63
This commit is contained in:
@@ -950,45 +950,45 @@ do_test shell1-4.1.6 {
|
||||
#
|
||||
do_test shell1-4.2.1 {
|
||||
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');}}
|
||||
} {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 insert" with headers
|
||||
#
|
||||
do_test shell1-4.2.2 {
|
||||
catchcmd test.db ".mode insert t1\n.headers on\nselect * from t1;"
|
||||
} {0 {INSERT INTO "t1"(x) VALUES(NULL);
|
||||
INSERT INTO "t1"(x) VALUES('');
|
||||
INSERT INTO "t1"(x) VALUES(1);
|
||||
INSERT INTO "t1"(x) VALUES(2.25);
|
||||
INSERT INTO "t1"(x) VALUES('hello');
|
||||
INSERT INTO "t1"(x) VALUES(X'807f');}}
|
||||
} {0 {INSERT INTO t1(x) VALUES(NULL);
|
||||
INSERT INTO t1(x) VALUES('');
|
||||
INSERT INTO t1(x) VALUES(1);
|
||||
INSERT INTO t1(x) VALUES(2.25);
|
||||
INSERT INTO t1(x) VALUES('hello');
|
||||
INSERT INTO t1(x) VALUES(X'807f');}}
|
||||
|
||||
# Test the output of ".mode insert"
|
||||
#
|
||||
do_test shell1-4.2.3 {
|
||||
catchcmd test.db ".mode insert t3\nselect * from t3;"
|
||||
} {0 {INSERT INTO "t3" VALUES(1,NULL);
|
||||
INSERT INTO "t3" VALUES(2,'');
|
||||
INSERT INTO "t3" VALUES(3,1);
|
||||
INSERT INTO "t3" VALUES(4,2.25);
|
||||
INSERT INTO "t3" VALUES(5,'hello');
|
||||
INSERT INTO "t3" VALUES(6,X'807f');}}
|
||||
} {0 {INSERT INTO t3 VALUES(1,NULL);
|
||||
INSERT INTO t3 VALUES(2,'');
|
||||
INSERT INTO t3 VALUES(3,1);
|
||||
INSERT INTO t3 VALUES(4,2.25);
|
||||
INSERT INTO t3 VALUES(5,'hello');
|
||||
INSERT INTO t3 VALUES(6,X'807f');}}
|
||||
|
||||
# Test the output of ".mode insert" with headers
|
||||
#
|
||||
do_test shell1-4.2.4 {
|
||||
catchcmd test.db ".mode insert t3\n.headers on\nselect * from t3;"
|
||||
} {0 {INSERT INTO "t3"(x,y) VALUES(1,NULL);
|
||||
INSERT INTO "t3"(x,y) VALUES(2,'');
|
||||
INSERT INTO "t3"(x,y) VALUES(3,1);
|
||||
INSERT INTO "t3"(x,y) VALUES(4,2.25);
|
||||
INSERT INTO "t3"(x,y) VALUES(5,'hello');
|
||||
INSERT INTO "t3"(x,y) VALUES(6,X'807f');}}
|
||||
} {0 {INSERT INTO t3(x,y) VALUES(1,NULL);
|
||||
INSERT INTO t3(x,y) VALUES(2,'');
|
||||
INSERT INTO t3(x,y) VALUES(3,1);
|
||||
INSERT INTO t3(x,y) VALUES(4,2.25);
|
||||
INSERT INTO t3(x,y) VALUES(5,'hello');
|
||||
INSERT INTO t3(x,y) VALUES(6,X'807f');}}
|
||||
|
||||
# Test the output of ".mode tcl"
|
||||
#
|
||||
|
@@ -219,23 +219,23 @@ do_test_with_ansi_output shellA-4.2 {
|
||||
#
|
||||
do_test shellA-5.1 {
|
||||
exec {*}$CLI test.db {.mode insert t1 --escape ascii} \
|
||||
{SELECT a, x FROM "t1" WHERE a IN (1,2,6,7,8)}
|
||||
{SELECT a, x FROM t1 WHERE a IN (1,2,6,7,8)}
|
||||
} {
|
||||
INSERT INTO "t1" VALUES(1,'line with '' single quote');
|
||||
INSERT INTO "t1" VALUES(2,unistr('\u001b[31mVT-100 codes\u001b[0m'));
|
||||
INSERT INTO "t1" VALUES(6,unistr('new\u000aline'));
|
||||
INSERT INTO "t1" VALUES(7,unistr('carriage\u000dreturn'));
|
||||
INSERT INTO "t1" VALUES(8,'last line');
|
||||
INSERT INTO t1 VALUES(1,'line with '' single quote');
|
||||
INSERT INTO t1 VALUES(2,unistr('\u001b[31mVT-100 codes\u001b[0m'));
|
||||
INSERT INTO t1 VALUES(6,unistr('new\u000aline'));
|
||||
INSERT INTO t1 VALUES(7,unistr('carriage\u000dreturn'));
|
||||
INSERT INTO t1 VALUES(8,'last line');
|
||||
}
|
||||
do_test shellA-5.2 {
|
||||
exec {*}$CLI test.db {.mode insert t1 --escape symbol} \
|
||||
{SELECT a, x FROM t1 WHERE a IN (1,2,6,7,8)}
|
||||
} {
|
||||
INSERT INTO "t1" VALUES(1,'line with '' single quote');
|
||||
INSERT INTO "t1" VALUES(2,unistr('\u001b[31mVT-100 codes\u001b[0m'));
|
||||
INSERT INTO "t1" VALUES(6,unistr('new\u000aline'));
|
||||
INSERT INTO "t1" VALUES(7,unistr('carriage\u000dreturn'));
|
||||
INSERT INTO "t1" VALUES(8,'last line');
|
||||
INSERT INTO t1 VALUES(1,'line with '' single quote');
|
||||
INSERT INTO t1 VALUES(2,unistr('\u001b[31mVT-100 codes\u001b[0m'));
|
||||
INSERT INTO t1 VALUES(6,unistr('new\u000aline'));
|
||||
INSERT INTO t1 VALUES(7,unistr('carriage\u000dreturn'));
|
||||
INSERT INTO t1 VALUES(8,'last line');
|
||||
}
|
||||
do_test shellA-5.3 {
|
||||
file delete -force out.txt
|
||||
@@ -246,12 +246,12 @@ do_test shellA-5.3 {
|
||||
close $fd
|
||||
string trim [string map [list \r\n \n] $res]
|
||||
} "
|
||||
INSERT INTO \"t1\" VALUES(1,'line with '' single quote');
|
||||
INSERT INTO \"t1\" VALUES(2,'\033\13331mVT-100 codes\033\1330m');
|
||||
INSERT INTO \"t1\" VALUES(6,'new
|
||||
INSERT INTO t1 VALUES(1,'line with '' single quote');
|
||||
INSERT INTO t1 VALUES(2,'\033\13331mVT-100 codes\033\1330m');
|
||||
INSERT INTO t1 VALUES(6,'new
|
||||
line');
|
||||
INSERT INTO \"t1\" VALUES(7,'carriage\rreturn');
|
||||
INSERT INTO \"t1\" VALUES(8,'last line');
|
||||
INSERT INTO t1 VALUES(7,'carriage\rreturn');
|
||||
INSERT INTO t1 VALUES(8,'last line');
|
||||
"
|
||||
|
||||
finish_test
|
||||
|
Reference in New Issue
Block a user