SQLite returning "no such table" using FMDB and RTree on iOS

المشرف العام

Administrator
طاقم الإدارة
I am building an iOS app and using SQLite using R*Tree indexing and FMDB for client-side data. When I run executeQuery against one of my virtual tables SQLite is returning DB Error: 1 "no such table: HuntEvent_index". However, I am able to insert records into the virtual table without any trouble (see code and image below) so I know it exists. Here's my code:

Table creation

CREATE VIRTUAL TABLE IF NOT EXISTS HuntEvent_index USING rtree( ID, minX, maxX, minY, maxY );CREATE TABLE IF NOT EXISTS "HuntEvent_index_rowid"(rowid INTEGER PRIMARY KEY, nodeno INTEGER);CREATE TABLE IF NOT EXISTS "HuntEvent_index_parent"(nodeno INTEGER PRIMARY KEY, parentnode INTEGER);CREATE TABLE IF NOT EXISTS "HuntEvent_index_node"(nodeno INTEGER PRIMARY KEY, data BLOB);Insert statement

INSERT INTO HuntEvent_index VALUES (1,SomeValue,SomeValue,SomeValue,SomeValue)As I said, I am confident that both the CREATE statement and the INSERT statement are functioning properly because I can see the table and record inside the database I created on the device (Actual values removed):

Query method

-(void)getEventsWithinBoundingBox:(WSBoundingBox*)boundingBox withCompletion:(SearchCompletionBlock)completion{ FMDatabase* db = [[WSSQLiteHelper sharedHelper] getFMAppDB]; if (![db openWithFlags:SQLITE_OPEN_READONLY]) { completion(nil, [NSError errorWithDomain:mad:"WSHP" code:0 userInfo:[NSDictionary dictionaryWithObject:mad:"Could not open User Database." forKey:mad:"message"]]); } //Find events IDs within the bounding box // NSMutableArray *activeEventIDs = [NSMutableArray array]; NSMutableString* query = [NSMutableString string]; [query appendString:mad:"SELECT ID FROM HuntEvent_index "]; [query appendFormat:mad:"WHERE minX >= %f AND maxX = %f AND maxY
 
أعلى