1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-16 23:02:26 +03:00

Fix bugs in the new query plan instrumention logic. (CVS 2549)

FossilOrigin-Name: 578490c91331a386f84652db0b3bfd74c82046e1
This commit is contained in:
drh
2005-07-15 23:24:23 +00:00
parent 84bfda41db
commit 9042f395cc
5 changed files with 41 additions and 19 deletions

View File

@@ -16,7 +16,7 @@
** so is applicable. Because this module is responsible for selecting
** indices, you might also think of this module as the "query optimizer".
**
** $Id: where.c,v 1.143 2005/07/15 13:05:21 drh Exp $
** $Id: where.c,v 1.144 2005/07/15 23:24:24 drh Exp $
*/
#include "sqliteInt.h"
@@ -968,16 +968,21 @@ WhereInfo *sqlite3WhereBegin(
#ifdef SQLITE_TEST
/* Record in the query plan information about the current table
** and the index used to access it (if any). If the table itself
** is not used, its name is followed by '*'. If no index is used
** is not used, its name is just '{}'. If no index is used
** the index is listed as "{}"
*/
{
int n = strlen(pTab->zName);
char *z = pTabItem->zAlias;
int n;
if( z==0 ) z = pTab->zName;
n = strlen(z);
if( n+nQPlan < sizeof(sqlite3_query_plan)-10 ){
strcpy(&sqlite3_query_plan[nQPlan], pTab->zName);
nQPlan += n;
if( (pLevel->score & 1)==0 ){
sqlite3_query_plan[nQPlan++] = '*';
if( (pLevel->score & 1)!=0 ){
strcpy(&sqlite3_query_plan[nQPlan], "{}");
nQPlan += 2;
}else{
strcpy(&sqlite3_query_plan[nQPlan], z);
nQPlan += n;
}
sqlite3_query_plan[nQPlan++] = ' ';
}