Reputation: 11782
Hi guys i am trying to use a custom sqlite queries in android.
i am experiencing following problems :
1- My primary key consists of multiple columns. How can i place data in Db sqlite in android? Does
ContentValues initialValues = new ContentValues();
This process will work?
2- Custom queries
String queryString = "SELECT MAX(accountId) FROM MAAccounts WHERE userId = ? AND accountType = ?";
i want to pass two parameters
String userId, AccountType accountType
Note that userId is string type and accoutType is int or AccountType.
Please tell me if this is possible in sqlite android to pass custom queries and arguments or not? If so then how?
3- Also, in Iphone we use FMD Database
library , is there any library which we can use in android just like Iphone one?
Upvotes: 1
Views: 1120
Reputation: 29199
For custom query use method:
db.rawQuery("MAX(accountId) FROM MAAccounts WHERE userId = ? AND accountType = ?", new String[]{value1,value2});
here value1 and value2 are values to be passed.
Upvotes: 2