Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.gawst.asyncdb.source.typed;
 
 import  android.content.ContentValues;
 import  android.database.Cursor;
 import  android.support.annotation.NonNull;
 import  android.support.annotation.Nullable;

Interface for classes that read/write data in SQL queries

Parameters:
<INSERT_ID> Type of element returned by insert()
<DATABASE_ID> Type of the ID needed to use org.gawst.asyncdb.AsyncDatabaseHandler
<CURSOR> Wrapper around the raw Cursor read
Author(s):
Created by robUx4 on 11/01/2015.
public interface TypedDatabaseSource<INSERT_ID, DATABASE_ID, CURSOR extends Cursor> {
Query the org.gawst.asyncdb.source.DatabaseSource with an SQL-like syntax.

Parameters:
columns A list of which columns to return. Passing null will return all columns, which is inefficient.
selection A filter declaring which rows to return, formatted as an SQL WHERE clause (excluding the WHERE itself). Passing null will return all rows.
selectionArgs You may include ?s in selection, which will be replaced by the values from selectionArgs, in the order that they appear in the selection. The values will be bound as Strings.
groupBy A filter declaring how to group rows, formatted as an SQL GROUP BY clause (excluding the GROUP BY itself). Passing null will cause the rows to not be grouped.
having A filter declare which row groups to include in the cursor, if row grouping is being used, formatted as an SQL HAVING clause (excluding the HAVING itself). Passing null will cause all row groups to be included, and is required when row grouping is not being used.
orderBy How to order the rows, formatted as an SQL ORDER BY clause (excluding the ORDER BY itself). Passing null will use the default sort order, which may be unordered.
limit Limits the number of rows returned by the query, formatted as LIMIT clause. Passing null denotes no LIMIT clause.
Returns:
a android.database.Cursor containing the result of the selection.
	CURSOR query(@Nullable String[] columns, @Nullable String selection, @Nullable String[] selectionArgs,
	             @Nullable String groupBy, @Nullable String having, @Nullable String orderBy, @Nullable String limit);

Insert a raw in the database.

Parameters:
values The initial values for the newly inserted row. The key is the column name for the field. Passing an empty ContentValues will create an empty row.
Returns:
a INSERT_ID specific to the org.gawst.asyncdb.source.DatabaseSource
Throws:
RuntimeException
	INSERT_ID insert(@NonNull ContentValues valuesthrows RuntimeException;

Update row(s) in the org.gawst.asyncdb.source.DatabaseSource.

Parameters:
updateValues The new field values. The key is the column name for the field. A null value will remove an existing field value.
selection A filter to apply to rows before updating, formatted as an SQL WHERE clause (excluding the WHERE itself).
selectionArgs You may include ?s in the selection clause, which will be replaced by the values from whereArgs. The values will be bound as Strings.
Returns:
the number of rows updated.
	int update(@NonNull ContentValues updateValues, @Nullable String selection, @Nullable String[] selectionArgs);

Delete row(s) from the org.gawst.asyncdb.source.DatabaseSource.

Parameters:
selection A filter to apply to rows before deleting, formatted as an SQL WHERE clause (excluding the WHERE itself).
selectionArgs You may include ?s in the selection clause, which will be replaced by the values from whereArgs. The values will be bound as Strings.
Returns:
	int delete(@Nullable String selection, @Nullable String[] selectionArgs);

Returns:
The database ID needed to use org.gawst.asyncdb.AsyncDatabaseHandler
	DATABASE_ID getDatabaseId();

Returns:
the raw android.database.Cursor read from the database turned into a more friendly CURSOR.
	CURSOR wrapCursor(Cursor cursor);
New to GrepCode? Check out our FAQ X