mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
Have SQLITE_FTS5_ENABLE_TEST_MI builds avoid reading the database schema from
within sqlite3_open(). FossilOrigin-Name: 15dc524fd4113026cc542140c39c1c8f9e052d36946f0c599f282d9ac27efdab
This commit is contained in:
@ -3801,8 +3801,8 @@ static int fts5Init(sqlite3 *db){
|
||||
** its entry point to enable the matchinfo() demo. */
|
||||
#ifdef SQLITE_FTS5_ENABLE_TEST_MI
|
||||
if( rc==SQLITE_OK ){
|
||||
extern int sqlite3Fts5TestRegisterMatchinfo(sqlite3*);
|
||||
rc = sqlite3Fts5TestRegisterMatchinfo(db);
|
||||
extern int sqlite3Fts5TestRegisterMatchinfoAPI(fts5_api*);
|
||||
rc = sqlite3Fts5TestRegisterMatchinfoAPI(&pGlobal->api);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -393,17 +393,13 @@ static void fts5MatchinfoFunc(
|
||||
}
|
||||
}
|
||||
|
||||
int sqlite3Fts5TestRegisterMatchinfo(sqlite3 *db){
|
||||
int rc; /* Return code */
|
||||
fts5_api *pApi; /* FTS5 API functions */
|
||||
/*
|
||||
** Register "matchinfo" with global API object pApi.
|
||||
*/
|
||||
int sqlite3Fts5TestRegisterMatchinfoAPI(fts5_api *pApi){
|
||||
int rc;
|
||||
|
||||
/* Extract the FTS5 API pointer from the database handle. The
|
||||
** fts5_api_from_db() function above is copied verbatim from the
|
||||
** FTS5 documentation. Refer there for details. */
|
||||
rc = fts5_api_from_db(db, &pApi);
|
||||
if( rc!=SQLITE_OK ) return rc;
|
||||
|
||||
/* If fts5_api_from_db() returns NULL, then either FTS5 is not registered
|
||||
/* If fts5_api_from_db() returned NULL, then either FTS5 is not registered
|
||||
** with this database handle, or an error (OOM perhaps?) has occurred.
|
||||
**
|
||||
** Also check that the fts5_api object is version 2 or newer.
|
||||
@ -418,4 +414,20 @@ int sqlite3Fts5TestRegisterMatchinfo(sqlite3 *db){
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
** Register "matchinfo" with database handle db.
|
||||
*/
|
||||
int sqlite3Fts5TestRegisterMatchinfo(sqlite3 *db){
|
||||
int rc; /* Return code */
|
||||
fts5_api *pApi; /* FTS5 API functions */
|
||||
|
||||
/* Extract the FTS5 API pointer from the database handle. The
|
||||
** fts5_api_from_db() function above is copied verbatim from the
|
||||
** FTS5 documentation. Refer there for details. */
|
||||
rc = fts5_api_from_db(db, &pApi);
|
||||
if( rc!=SQLITE_OK ) return rc;
|
||||
|
||||
return sqlite3Fts5TestRegisterMatchinfoAPI(pApi);
|
||||
}
|
||||
|
||||
#endif /* SQLITE_ENABLE_FTS5 */
|
||||
|
@ -520,4 +520,26 @@ do_execsql_test 15.3 {
|
||||
{columnsize {1 1} columntext {c d} columntotalsize {2 2} poslist {} tokenize {c d} rowcount 2}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
reset_db
|
||||
do_execsql_test 16.0 {
|
||||
CREATE TABLE t1(x);
|
||||
BEGIN EXCLUSIVE;
|
||||
}
|
||||
|
||||
sqlite3 db2 test.db
|
||||
do_test 16.1 {
|
||||
catchsql { SELECT * FROM t1 } db2
|
||||
} {1 {database is locked}}
|
||||
|
||||
do_execsql_test 16.2 {
|
||||
ROLLBACK;
|
||||
}
|
||||
|
||||
do_test 16.3 {
|
||||
catchsql { SELECT * FROM t1 } db2
|
||||
} {0 {}}
|
||||
|
||||
finish_test
|
||||
|
||||
|
Reference in New Issue
Block a user