Change ".fkey_missing_indexes" to ".lint fkey-indexes".

FossilOrigin-Name: ee621ade38c11806e1df57c459da5f018a6d0670
This commit is contained in:
dan 2016-12-16 17:28:56 +00:00
parent dd9e0be46a
commit 3c7ebeb548
4 changed files with 41 additions and 25 deletions

View File

@ -1,5 +1,5 @@
C Update\s.fkey_missing_indexes\sto\suse\sthe\sbuilt-in\spragma\svtabs.
D 2016-12-16T16:44:27.209
C Change\s".fkey_missing_indexes"\sto\s".lint\sfkey-indexes".
D 2016-12-16T17:28:56.295
F Makefile.in c194b58fe00c370a48ac6ae6945e92a7781db1c8
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc b8ca53350ae545e3562403d5da2a69cec79308da
@ -389,7 +389,7 @@ F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
F src/resolve.c bb070cf5f23611c44ab7e4788803684e385fc3fb
F src/rowset.c 7b7e7e479212e65b723bf40128c7b36dc5afdfac
F src/select.c 204491a5e09a66380a067943d8651af8bda1d358
F src/shell.c 667382b94e1ba301960cbf34db96d25afe219892
F src/shell.c 0f1f7935f9a18b5458fd8279d7995c2e1743bdc2
F src/sqlite.h.in e8e2d108d82647f0a812fdb74accf91c1ec08ddc
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 8648034aa702469afb553231677306cc6492a1ae
@ -1094,7 +1094,7 @@ F test/shell2.test e242a9912f44f4c23c3d1d802a83e934e84c853b
F test/shell3.test 9b95ba643eaa228376f06a898fb410ee9b6e57c1
F test/shell4.test 89ad573879a745974ff2df20ff97c5d6ffffbd5d
F test/shell5.test 50a732c1c2158b1cd62cf53975ce1ea7ce6b9dc9
F test/shell6.test e9ea06630bcd9ea10e14109f0e62c41571bcc1ae
F test/shell6.test 806472f6ffdd31d632e27dbe8515c0c45f68f3ec
F test/shortread1.test bb591ef20f0fd9ed26d0d12e80eee6d7ac8897a3
F test/show_speedtest1_rtree.tcl 32e6c5f073d7426148a6936a0408f4b5b169aba5
F test/shrink.test 1b4330b1fd9e818c04726d45cb28db73087535ce
@ -1537,7 +1537,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 4ba45e722371ca4343e3563e7e1c2896b48c9a87
R 5944ad7aef550b0c7873733cf5d30c76
P 3ab05987b0cc12af64bf32d885d04aff45d7a77c
R 17b5d854673e0a0adb6375b01c294779
U dan
Z 1d6e2ebe082c25e976b4f2822f56282f
Z 080e8bf78fe63c73094cbd3615b790ed

View File

@ -1 +1 @@
3ab05987b0cc12af64bf32d885d04aff45d7a77c
ee621ade38c11806e1df57c459da5f018a6d0670

View File

@ -3255,13 +3255,9 @@ int shellDeleteFile(const char *zFilename){
}
/**************************************************************************
** Beginning of implementation of .fkey_missing_indexes
*/
/*
** The implementation of SQL scalar function fkey_collate_clause(), used
** by the ".fkey_missing_indexes" command. This scalar function is always
** by the ".lint fkey-indexes" command. This scalar function is always
** called with four arguments - the parent table name, the parent column name,
** the child table name and the child column name.
**
@ -3313,9 +3309,9 @@ static void shellFkeyCollateClause(
/*
** The implementation of dot-command ".fkey_missing_indexes".
** The implementation of dot-command ".lint fkey-indexes".
*/
static int shellFkeyMissingIndexes(
static int lintFkeyIndexes(
ShellState *pState, /* Current shell tool state */
char **azArg, /* Array of arguments passed to dot command */
int nArg /* Number of entries in azArg[] */
@ -3392,7 +3388,7 @@ static int shellFkeyMissingIndexes(
"ORDER BY (CASE WHEN ? THEN f.[table] ELSE s.name END)"
;
for(i=1; i<nArg; i++){
for(i=2; i<nArg; i++){
int n = strlen(azArg[i]);
if( n>1 && sqlite3_strnicmp("-verbose", azArg[i], n)==0 ){
bVerbose = 1;
@ -3402,7 +3398,9 @@ static int shellFkeyMissingIndexes(
zIndent = " ";
}
else{
raw_printf(stderr, "Usage: .fkey_lint ?-verbose? ?-groupbyparent?\n");
raw_printf(stderr, "Usage: %s %s ?-verbose? ?-groupbyparent?\n",
azArg[0], azArg[1]
);
return SQLITE_ERROR;
}
}
@ -3481,9 +3479,27 @@ static int shellFkeyMissingIndexes(
return rc;
}
/*
** End of implementation of .fkey_missing_indexes
**************************************************************************/
** Implementation of ".lint" dot command.
*/
static int lintDotCommand(
ShellState *pState, /* Current shell tool state */
char **azArg, /* Array of arguments passed to dot command */
int nArg /* Number of entries in azArg[] */
){
int n;
n = (nArg>=1 ? strlen(azArg[1]) : 0);
if( n<1 || sqlite3_strnicmp(azArg[1], "fkey-indexes", n) ) goto usage;
return lintFkeyIndexes(pState, azArg, nArg);
usage:
raw_printf(stderr, "Usage %s sub-command ?switches...?\n", azArg[0]);
raw_printf(stderr, "Where sub-commands are:\n");
raw_printf(stderr, " fkey-indexes\n");
return SQLITE_ERROR;
}
/*
** If an input line begins with "." then invoke this routine to
@ -3798,10 +3814,6 @@ static int do_meta_command(char *zLine, ShellState *p){
}
}else
if( c=='f' && strncmp(azArg[0], "fkey_missing_indexes", n)==0 ){
shellFkeyMissingIndexes(p, azArg, nArg);
}else
if( c=='f' && strncmp(azArg[0], "fullschema", n)==0 ){
ShellState data;
char *zErrMsg = 0;
@ -4269,6 +4281,10 @@ static int do_meta_command(char *zLine, ShellState *p){
}
}else
if( c=='l' && n>2 && strncmp(azArg[0], "lint", n)==0 ){
lintDotCommand(p, azArg, nArg);
}else
#ifndef SQLITE_OMIT_LOAD_EXTENSION
if( c=='l' && strncmp(azArg[0], "load", n)==0 ){
const char *zFile, *zProc;

View File

@ -84,12 +84,12 @@ foreach {tn schema output} {
}
do_test 1.$tn.1 {
set RES [catchcmd test.db .fkey_missing_indexes]
set RES [catchcmd test.db [list .lint fkey-indexes]]
} [list 0 [string trim $expected]]
do_test 1.$tn.2 {
execsql [lindex $RES 1]
catchcmd test.db .fkey_missing_indexes
catchcmd test.db [list .lint fkey-indexes]
} {0 {}}
db close