|
@@ -1163,7 +1163,7 @@ static unsigned char *SHA3Final(SHA3Context *p){
|
|
|
** Implementation of the sha3(X,SIZE) function.
|
|
** Implementation of the sha3(X,SIZE) function.
|
|
|
**
|
|
**
|
|
|
** Return a BLOB which is the SIZE-bit SHA3 hash of X. The default
|
|
** Return a BLOB which is the SIZE-bit SHA3 hash of X. The default
|
|
|
-** size is 256. If X is a BLOB, it is hashed as is.
|
|
|
|
|
|
|
+** size is 256. If X is a BLOB, it is hashed as is.
|
|
|
** For all other non-NULL types of input, X is converted into a UTF-8 string
|
|
** For all other non-NULL types of input, X is converted into a UTF-8 string
|
|
|
** and the string is hashed without the trailing 0x00 terminator. The hash
|
|
** and the string is hashed without the trailing 0x00 terminator. The hash
|
|
|
** of a NULL value is NULL.
|
|
** of a NULL value is NULL.
|
|
@@ -2997,7 +2997,7 @@ static char **tableColumnList(ShellState *p, const char *zTab){
|
|
|
nPK++;
|
|
nPK++;
|
|
|
if( nPK==1
|
|
if( nPK==1
|
|
|
&& sqlite3_stricmp((const char*)sqlite3_column_text(pStmt,2),
|
|
&& sqlite3_stricmp((const char*)sqlite3_column_text(pStmt,2),
|
|
|
- "INTEGER")==0
|
|
|
|
|
|
|
+ "INTEGER")==0
|
|
|
){
|
|
){
|
|
|
isIPK = 1;
|
|
isIPK = 1;
|
|
|
}else{
|
|
}else{
|
|
@@ -3345,8 +3345,8 @@ static int process_input(ShellState *p, FILE *in);
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
|
** Read the content of file zName into memory obtained from sqlite3_malloc64()
|
|
** Read the content of file zName into memory obtained from sqlite3_malloc64()
|
|
|
-** and return a pointer to the buffer. The caller is responsible for freeing
|
|
|
|
|
-** the memory.
|
|
|
|
|
|
|
+** and return a pointer to the buffer. The caller is responsible for freeing
|
|
|
|
|
+** the memory.
|
|
|
**
|
|
**
|
|
|
** If parameter pnByte is not NULL, (*pnByte) is set to the number of bytes
|
|
** If parameter pnByte is not NULL, (*pnByte) is set to the number of bytes
|
|
|
** read.
|
|
** read.
|
|
@@ -4353,15 +4353,15 @@ int shellDeleteFile(const char *zFilename){
|
|
|
** fkey_collate_clause('parent-tab', 'parent-col', 'child-tab', 'child-col')
|
|
** fkey_collate_clause('parent-tab', 'parent-col', 'child-tab', 'child-col')
|
|
|
**
|
|
**
|
|
|
** If either of the named tables or columns do not exist, this function
|
|
** If either of the named tables or columns do not exist, this function
|
|
|
-** returns an empty string. An empty string is also returned if both tables
|
|
|
|
|
|
|
+** returns an empty string. An empty string is also returned if both tables
|
|
|
** and columns exist but have the same default collation sequence. Or,
|
|
** and columns exist but have the same default collation sequence. Or,
|
|
|
** if both exist but the default collation sequences are different, this
|
|
** if both exist but the default collation sequences are different, this
|
|
|
** function returns the string " COLLATE <parent-collation>", where
|
|
** function returns the string " COLLATE <parent-collation>", where
|
|
|
** <parent-collation> is the default collation sequence of the parent column.
|
|
** <parent-collation> is the default collation sequence of the parent column.
|
|
|
*/
|
|
*/
|
|
|
static void shellFkeyCollateClause(
|
|
static void shellFkeyCollateClause(
|
|
|
- sqlite3_context *pCtx,
|
|
|
|
|
- int nVal,
|
|
|
|
|
|
|
+ sqlite3_context *pCtx,
|
|
|
|
|
+ int nVal,
|
|
|
sqlite3_value **apVal
|
|
sqlite3_value **apVal
|
|
|
){
|
|
){
|
|
|
sqlite3 *db = sqlite3_context_db_handle(pCtx);
|
|
sqlite3 *db = sqlite3_context_db_handle(pCtx);
|
|
@@ -4372,7 +4372,7 @@ static void shellFkeyCollateClause(
|
|
|
const char *zChildCol;
|
|
const char *zChildCol;
|
|
|
const char *zChildSeq = 0; /* Initialize to avoid false-positive warning */
|
|
const char *zChildSeq = 0; /* Initialize to avoid false-positive warning */
|
|
|
int rc;
|
|
int rc;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
assert( nVal==4 );
|
|
assert( nVal==4 );
|
|
|
zParent = (const char*)sqlite3_value_text(apVal[0]);
|
|
zParent = (const char*)sqlite3_value_text(apVal[0]);
|
|
|
zParentCol = (const char*)sqlite3_value_text(apVal[1]);
|
|
zParentCol = (const char*)sqlite3_value_text(apVal[1]);
|
|
@@ -4494,7 +4494,7 @@ static int lintFkeyIndexes(
|
|
|
return SQLITE_ERROR;
|
|
return SQLITE_ERROR;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/* Register the fkey_collate_clause() SQL function */
|
|
/* Register the fkey_collate_clause() SQL function */
|
|
|
rc = sqlite3_create_function(db, "fkey_collate_clause", 4, SQLITE_UTF8,
|
|
rc = sqlite3_create_function(db, "fkey_collate_clause", 4, SQLITE_UTF8,
|
|
|
0, shellFkeyCollateClause, 0, 0
|
|
0, shellFkeyCollateClause, 0, 0
|
|
@@ -4537,9 +4537,9 @@ static int lintFkeyIndexes(
|
|
|
raw_printf(stderr, "Error: internal error");
|
|
raw_printf(stderr, "Error: internal error");
|
|
|
break;
|
|
break;
|
|
|
}else{
|
|
}else{
|
|
|
- if( bGroupByParent
|
|
|
|
|
|
|
+ if( bGroupByParent
|
|
|
&& (bVerbose || res==0)
|
|
&& (bVerbose || res==0)
|
|
|
- && (zPrev==0 || sqlite3_stricmp(zParent, zPrev))
|
|
|
|
|
|
|
+ && (zPrev==0 || sqlite3_stricmp(zParent, zPrev))
|
|
|
){
|
|
){
|
|
|
raw_printf(out, "-- Parent table %s\n", zParent);
|
|
raw_printf(out, "-- Parent table %s\n", zParent);
|
|
|
sqlite3_free(zPrev);
|
|
sqlite3_free(zPrev);
|
|
@@ -4549,7 +4549,7 @@ static int lintFkeyIndexes(
|
|
|
if( res==0 ){
|
|
if( res==0 ){
|
|
|
raw_printf(out, "%s%s --> %s\n", zIndent, zCI, zTarget);
|
|
raw_printf(out, "%s%s --> %s\n", zIndent, zCI, zTarget);
|
|
|
}else if( bVerbose ){
|
|
}else if( bVerbose ){
|
|
|
- raw_printf(out, "%s/* no extra indexes required for %s -> %s */\n",
|
|
|
|
|
|
|
+ raw_printf(out, "%s/* no extra indexes required for %s -> %s */\n",
|
|
|
zIndent, zFrom, zTarget
|
|
zIndent, zFrom, zTarget
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
@@ -5997,7 +5997,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
|
|
bSelftestExists = 1;
|
|
bSelftestExists = 1;
|
|
|
}
|
|
}
|
|
|
if( bSelftestExists ){
|
|
if( bSelftestExists ){
|
|
|
- rc = sqlite3_get_table(p->db,
|
|
|
|
|
|
|
+ rc = sqlite3_get_table(p->db,
|
|
|
"SELECT tno,op,cmd,ans FROM selftest ORDER BY tno",
|
|
"SELECT tno,op,cmd,ans FROM selftest ORDER BY tno",
|
|
|
&azTest, &nRow, &nCol, 0);
|
|
&azTest, &nRow, &nCol, 0);
|
|
|
if( rc ){
|
|
if( rc ){
|
|
@@ -6021,7 +6021,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
|
|
const char *zOp = azTest[i*nCol+1];
|
|
const char *zOp = azTest[i*nCol+1];
|
|
|
const char *zSql = azTest[i*nCol+2];
|
|
const char *zSql = azTest[i*nCol+2];
|
|
|
const char *zAns = azTest[i*nCol+3];
|
|
const char *zAns = azTest[i*nCol+3];
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if( bVerbose>0 ){
|
|
if( bVerbose>0 ){
|
|
|
char *zQuote = sqlite3_mprintf("%q", zSql);
|
|
char *zQuote = sqlite3_mprintf("%q", zSql);
|
|
|
printf("%d: %s %s\n", tno, zOp, zSql);
|
|
printf("%d: %s %s\n", tno, zOp, zSql);
|
|
@@ -6099,8 +6099,8 @@ static int do_meta_command(char *zLine, ShellState *p){
|
|
|
if( strcmp(z,"schema")==0 ){
|
|
if( strcmp(z,"schema")==0 ){
|
|
|
bSchema = 1;
|
|
bSchema = 1;
|
|
|
}else
|
|
}else
|
|
|
- if( strcmp(z,"sha3-224")==0 || strcmp(z,"sha3-256")==0
|
|
|
|
|
- || strcmp(z,"sha3-384")==0 || strcmp(z,"sha3-512")==0
|
|
|
|
|
|
|
+ if( strcmp(z,"sha3-224")==0 || strcmp(z,"sha3-256")==0
|
|
|
|
|
+ || strcmp(z,"sha3-384")==0 || strcmp(z,"sha3-512")==0
|
|
|
){
|
|
){
|
|
|
iSize = atoi(&z[5]);
|
|
iSize = atoi(&z[5]);
|
|
|
}else
|
|
}else
|