sql - Android: SQLite query with multiple OR wildcard operators -


i working on app pulling data sql server using stored procedure in webservice. i'm dumping data sqlite database , running queries on database display in different list views in app. applying filter these views users have option of searching lists. field using primary key field contains ids not need views. therefore, using queries not display particular records when required.

most of ids in categories , have similar names beginning letters can include in wildcard queries. way can include wildcard in query using not , or operators , not have include specific id names make query pretty long. code have below.

the first method filter method (public cursor fetchschedulebydate(string inputtext, string newconfdate)). second method called when view displayed (public cursor getallschedulesbyconfdate(string newconfdate)). using multiple not , or operators in queries not working , results set indicates these statements being ignored. if use 1 not operator works. can't figure out.

public cursor fetchschedulebydate(string inputtext, string newconfdate) throws sqlexception {            log.w(tag, inputtext);            cursor mcursor = null;            if (inputtext == null  ||  inputtext.length () == 0)  {             mcursor = db.query(sqlite_table, new string[] {                     key_id, key_functiontitle, key_fucntioindate, key_functionstarttime, key_functionendtime, key_functiondescription, key_locationname},                     key_fucntioindate + " = " + newconfdate + " , (" + key_id + " not 'exhx%' or " + key_id + " not 'exhv%')", null, null, null, null, null);            }            else {             mcursor = db.query(true, sqlite_table, new string[] {                     key_id, key_functiontitle, key_fucntioindate, key_functionstarttime, key_functionendtime, key_functiondescription, key_locationname},                     key_functiontitle + " '%" + inputtext + "%' , " + key_fucntioindate + " = " + newconfdate + " , (" + key_id + " not 'exhx%' or " + key_id + " not 'exhv%')", null, null, null, null, null);            }            if (mcursor != null) {             mcursor.movetofirst();            }            return mcursor;            }   public cursor getallschedulesbyconfdate(string newconfdate){              cursor mcursor = db.query(sqlite_table,  new string[] {                      key_id, key_functiontitle, key_fucntioindate, key_functionstarttime, key_functionendtime, key_functiondescription, key_locationname },                      key_fucntioindate + " = " + newconfdate + " , (" + key_id + " not 'exhx%' or " + key_id + " not 'exhv%')", null, null, null, null, null);              if (mcursor != null) {                  mcursor.movetofirst();               }              return mcursor;           } 


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -