android - Using join with Content Provider to query from multiple tables -
i trying retrieve data 7 tables , needs join them retrieve data , , trying implement content provider project. got lots of sample follow single table execution using content provider, can't strong sample follow join case. , in advance need pass string parameter query joining table on base of string parameter.
for sample trying 2 tables not of luck pass parameter
case join_for_all_event_table: //it used id need string parameter pass //it here, , don't know how can achieve that. //this works case of id not string. // , event_id in case string needs have - symbol //on it. _id = contenturis.parseid(uri); log.e("************* args ",_id + ""); retcursor = db.rawquery( "select * " + "from " + "event_info" + " left join " + "wild_animal_info" + " on " + "event_info.event_id" + " = " + "wild_animal_info.event_id"+" "+"event_info.event_id"+" ="+ args[0] ,null); break; default:
and dbhelper looks join
/** * method data using join */ public void getalldatafromeventid(string eventid){ cursor cursor = mycr.query(contenturis.withappendedid( tigercontract.content_uri_relationship_join, id),null,null,null,null); if(cursor.movetofirst()){ log.v("***********","size of crsor "+cursor.getcount()); cursor.movetofirst(); log.v("********new ",cursor.getstring(1)); log.v("********new ",cursor.getstring(2)); log.v("********new ",cursor.getstring(4)); log.v("********new ",cursor.getstring(5)); }else{ cursor.close(); log.v("*********new ","didn't got there"); }
and other thing did in contract class join are
public static final string path_join_for_all_event_talbe = "join_for_all_event_table"; public static final uri content_uri_relationship_join= base_content_uri.buildupon().appendpath(path_join_for_all_event_talbe).build(); public static final string content_type_join = "vnd.android.cursor.item/" + content_authority +"/"+ path_join_for_all_event_talbe;
so, waiting strong sample follow on join case in content provider. , in advance people out there.
Comments
Post a Comment