1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Document SQLTester's --print command and add some argument validation to it.

FossilOrigin-Name: ab9c945bb0b4210b3f47e6341f150f8a7cc45f9e4e4c2247e91d2528ed4772a6
This commit is contained in:
stephan
2023-08-09 11:10:48 +00:00
parent e6c29da777
commit 283e87146c
5 changed files with 18 additions and 9 deletions

View File

@ -574,6 +574,9 @@ class OpenDbCommand extends Command {
class PrintCommand extends Command {
public PrintCommand(){}
public void process(SQLTester t, String[] argv, String content) throws Exception{
if( 1==argv.length && null==content ){
Util.badArg(argv[0]," requires at least 1 argument or body content.");
}
if( argv.length > 1 ) t.outln("\t",Util.argvToString(argv));
if( null!=content ) t.outln(content.replaceAll("(?m)^", "\t"));
}

View File

@ -244,3 +244,8 @@ respectively. The difference is that column values are appended to the
result buffer literally, without every enclosing the values in `{...}` or
`"..."` and without escaping any characters in the column value and comparison
is always an exact strcmp() not a GLOB.
### The --print command
The --print command emits both its arguments and its body (if any) to
stdout, indenting each line of output.

View File

@ -18,6 +18,7 @@ select 2;
--oom
--print These are args to the print command.
This is from the print command's body.
--print
Also from the print command.
--- also ignored
--testcase first