Add infrastructure for the ANALYZE command. Does not yet actually
do anything. (CVS 2537)
FossilOrigin-Name: 05b6ac9a76fd5765c50e81588f8e71c59fe35ce4
diff --git a/src/analyze.c b/src/analyze.c
new file mode 100644
index 0000000..bb6941e
--- /dev/null
+++ b/src/analyze.c
@@ -0,0 +1,34 @@
+/*
+** 2005 July 8
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+** This file contains code associated with the ANALYZE command.
+**
+** @(#) $Id: analyze.c,v 1.1 2005/07/08 12:13:05 drh Exp $
+*/
+#ifndef SQLITE_OMIT_ANALYZE
+#include "sqliteInt.h"
+
+/*
+** Generate code for the ANALYZE command
+**
+** ANALYZE -- 1
+** ANALYZE <database > -- 2
+** ANALYZE ?<database>.?<tablename> -- 3
+**
+** Form 1 causes all indices in all attached databases to be analyzed.
+** Form 2 analyzes all indices the single database named.
+** Form 3 analyzes all indices associated with the named table.
+*/
+void sqlite3Analyze(Parse *pParse, Token *pName1, Token *pName2){
+}
+
+
+#endif /* SQLITE_OMIT_ANALYZE */
diff --git a/src/parse.y b/src/parse.y
index f35e336..750f8a4 100644
--- a/src/parse.y
+++ b/src/parse.y
@@ -14,7 +14,7 @@
** the parser. Lemon will also generate a header file containing
** numeric codes for all of the tokens.
**
-** @(#) $Id: parse.y,v 1.174 2005/06/30 17:04:21 drh Exp $
+** @(#) $Id: parse.y,v 1.175 2005/07/08 12:13:05 drh Exp $
*/
// All token codes are small integers with #defines that begin with "TK_"
@@ -170,7 +170,7 @@
// This obviates the need for the "id" nonterminal.
//
%fallback ID
- ABORT AFTER ASC ATTACH BEFORE BEGIN CASCADE CAST CONFLICT
+ ABORT AFTER ANALYZE ASC ATTACH BEFORE BEGIN CASCADE CAST CONFLICT
DATABASE DEFERRED DESC DETACH EACH END EXCLUSIVE EXPLAIN FAIL FOR
IGNORE IMMEDIATE INITIALLY INSTEAD LIKE_KW MATCH KEY
OF OFFSET PRAGMA RAISE REPLACE RESTRICT ROW STATEMENT
@@ -1020,6 +1020,12 @@
cmd ::= REINDEX nm(X) dbnm(Y). {sqlite3Reindex(pParse, &X, &Y);}
%endif
+/////////////////////////////////// ANALYZE ///////////////////////////////////
+%ifndef SQLITE_OMIT_ANALYZE
+cmd ::= ANALYZE. {sqlite3Analyze(pParse, 0, 0);}
+cmd ::= ANALYZE nm(X) dbnm(Y). {sqlite3Analyze(pParse, &X, &Y);}
+%endif
+
//////////////////////// ALTER TABLE table ... ////////////////////////////////
%ifndef SQLITE_OMIT_ALTERTABLE
cmd ::= ALTER TABLE fullname(X) RENAME TO nm(Z). {
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index 5579ca0..d7f304b 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -11,7 +11,7 @@
*************************************************************************
** Internal interface definitions for SQLite.
**
-** @(#) $Id: sqliteInt.h,v 1.389 2005/06/30 17:04:21 drh Exp $
+** @(#) $Id: sqliteInt.h,v 1.390 2005/07/08 12:13:05 drh Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_
@@ -1565,6 +1565,7 @@
const char *sqlite3TestErrorName(int);
CollSeq *sqlite3GetCollSeq(sqlite3*, CollSeq *, const char *, int);
char sqlite3AffinityType(const Token*);
+void sqlite3Analyze(Parse*, Token*, Token*);
#ifdef SQLITE_SSE
#include "sseInt.h"
diff --git a/src/test1.c b/src/test1.c
index eade26e..e32fedf 100644
--- a/src/test1.c
+++ b/src/test1.c
@@ -13,7 +13,7 @@
** is not included in the SQLite library. It is used for automated
** testing of the SQLite library.
**
-** $Id: test1.c,v 1.146 2005/06/25 19:31:48 drh Exp $
+** $Id: test1.c,v 1.147 2005/07/08 12:13:05 drh Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
@@ -2759,12 +2759,24 @@
Tcl_SetVar2(interp, "sqlite_options", "rowid32", "0", TCL_GLOBAL_ONLY);
#endif
+#ifdef SQLITE_CASE_SENSITIVE_LIKE
+ Tcl_SetVar2(interp, "sqlite_options","casesensitivelike","1",TCL_GLOBAL_ONLY);
+#else
+ Tcl_SetVar2(interp, "sqlite_options","casesensitivelike","0",TCL_GLOBAL_ONLY);
+#endif
+
#ifdef SQLITE_OMIT_ALTERTABLE
Tcl_SetVar2(interp, "sqlite_options", "altertable", "0", TCL_GLOBAL_ONLY);
#else
Tcl_SetVar2(interp, "sqlite_options", "altertable", "1", TCL_GLOBAL_ONLY);
#endif
+#ifdef SQLITE_OMIT_ANALYZE
+ Tcl_SetVar2(interp, "sqlite_options", "analyze", "0", TCL_GLOBAL_ONLY);
+#else
+ Tcl_SetVar2(interp, "sqlite_options", "analyze", "1", TCL_GLOBAL_ONLY);
+#endif
+
#ifdef SQLITE_OMIT_AUTHORIZATION
Tcl_SetVar2(interp, "sqlite_options", "auth", "0", TCL_GLOBAL_ONLY);
#else