summaryrefslogtreecommitdiffstats
path: root/ext/expert
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:07:40 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:07:40 +0000
commit9d2c15192c890a8876bcb9a2ef918756d03718b6 (patch)
tree8340f6a53cda0ba296d162c8c8d767086a337ff9 /ext/expert
parentAdding upstream version 3.46.0. (diff)
downloadsqlite3-upstream.tar.xz
sqlite3-upstream.zip
Adding upstream version 3.46.1.upstream/3.46.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ext/expert')
-rw-r--r--ext/expert/expert1.test7
-rw-r--r--ext/expert/sqlite3expert.c20
2 files changed, 19 insertions, 8 deletions
diff --git a/ext/expert/expert1.test b/ext/expert/expert1.test
index c456c30..72c4fd7 100644
--- a/ext/expert/expert1.test
+++ b/ext/expert/expert1.test
@@ -465,6 +465,13 @@ do_execsql_test 5.3 {
t2 t2_idx_0001295b {100 20 5}
}
+do_catchsql_test 5.4 {
+ SELECT sqlite_expert_rem(123, 123);
+} {1 {no such function: sqlite_expert_rem}}
+do_catchsql_test 5.5 {
+ SELECT sqlite_expert_sample();
+} {1 {no such function: sqlite_expert_sample}}
+
if 0 {
do_test expert1-6.0 {
catchcmd :memory: {
diff --git a/ext/expert/sqlite3expert.c b/ext/expert/sqlite3expert.c
index 276c2cc..b59a597 100644
--- a/ext/expert/sqlite3expert.c
+++ b/ext/expert/sqlite3expert.c
@@ -626,7 +626,7 @@ static int expertFilter(
pCsr->pData = 0;
if( rc==SQLITE_OK ){
rc = idxPrintfPrepareStmt(pExpert->db, &pCsr->pData, &pVtab->base.zErrMsg,
- "SELECT * FROM main.%Q WHERE sample()", pVtab->pTab->zName
+ "SELECT * FROM main.%Q WHERE sqlite_expert_sample()", pVtab->pTab->zName
);
}
@@ -1500,7 +1500,7 @@ struct IdxRemCtx {
};
/*
-** Implementation of scalar function rem().
+** Implementation of scalar function sqlite_expert_rem().
*/
static void idxRemFunc(
sqlite3_context *pCtx,
@@ -1513,7 +1513,7 @@ static void idxRemFunc(
assert( argc==2 );
iSlot = sqlite3_value_int(argv[0]);
- assert( iSlot<=p->nSlot );
+ assert( iSlot<p->nSlot );
pSlot = &p->aSlot[iSlot];
switch( pSlot->eType ){
@@ -1624,7 +1624,8 @@ static int idxPopulateOneStat1(
const char *zName = (const char*)sqlite3_column_text(pIndexXInfo, 0);
const char *zColl = (const char*)sqlite3_column_text(pIndexXInfo, 1);
zCols = idxAppendText(&rc, zCols,
- "%sx.%Q IS rem(%d, x.%Q) COLLATE %s", zComma, zName, nCol, zName, zColl
+ "%sx.%Q IS sqlite_expert_rem(%d, x.%Q) COLLATE %s",
+ zComma, zName, nCol, zName, zColl
);
zOrder = idxAppendText(&rc, zOrder, "%s%d", zComma, ++nCol);
}
@@ -1757,13 +1758,13 @@ static int idxPopulateStat1(sqlite3expert *p, char **pzErr){
if( rc==SQLITE_OK ){
sqlite3 *dbrem = (p->iSample==100 ? p->db : p->dbv);
- rc = sqlite3_create_function(
- dbrem, "rem", 2, SQLITE_UTF8, (void*)pCtx, idxRemFunc, 0, 0
+ rc = sqlite3_create_function(dbrem, "sqlite_expert_rem",
+ 2, SQLITE_UTF8, (void*)pCtx, idxRemFunc, 0, 0
);
}
if( rc==SQLITE_OK ){
- rc = sqlite3_create_function(
- p->db, "sample", 0, SQLITE_UTF8, (void*)&samplectx, idxSampleFunc, 0, 0
+ rc = sqlite3_create_function(p->db, "sqlite_expert_sample",
+ 0, SQLITE_UTF8, (void*)&samplectx, idxSampleFunc, 0, 0
);
}
@@ -1815,6 +1816,9 @@ static int idxPopulateStat1(sqlite3expert *p, char **pzErr){
rc = sqlite3_exec(p->dbm, "ANALYZE sqlite_schema", 0, 0, 0);
}
+ sqlite3_create_function(p->db, "sqlite_expert_rem", 2, SQLITE_UTF8, 0,0,0,0);
+ sqlite3_create_function(p->db, "sqlite_expert_sample", 0,SQLITE_UTF8,0,0,0,0);
+
sqlite3_exec(p->db, "DROP TABLE IF EXISTS temp."UNIQUE_TABLE_NAME,0,0,0);
return rc;
}