Insert getNullColumnHack
The method takes the name of the table, a representing the columns and replacement values to use, an optional clause, and an optional list of parameters to fill into the clause, to replace any embedded question marks (). Since replaces only columns with fixed values, versus ones computed based on other information, you may need to use to accomplish some ends.
The clause and parameter list work akin to the positional SQL parameters you may be used to from other SQL APIs. Consider this example:
New
Update
The method works akin to , taking the name of the table, the optional clause, and the corresponding parameters to fill into the clause.
What Goes Around Comes Around
As with , , and , you have two main options for retrieving data from a SQLite database using :
• You can use to invoke a statement directly.
• You can use to build up a query from its component parts.
Confounding matters is the class and the issue of cursors and cursor factories. Let’s take all of this one piece at a time.
Raw Queries
The simplest solution, at least in terms of the API, is . Simply call it with your SQL statement. The statement can include positional parameters; the array of these forms your second parameter to . So, we wind up with this:
Дата добавления: 2015-05-16; просмотров: 828;