com.eg.agent.android.instrumentation.InstrumentSQLite Maven / Gradle / Ivy
The newest version!
package com.eg.agent.android.instrumentation;
import java.util.ArrayList;
import java.util.Arrays;
import com.eg.agent.android.trace.TracerMachine;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.os.CancellationSignal;
public class InstrumentSQLite {
// private static final String queryParams = "";
// private static final String APItype = "SQLiteDataBase";
private static final ArrayList categoryParams = new ArrayList(Arrays.asList("category", MetricType.class.getName(), "SQLiteDataBase"));
public static Cursor query(SQLiteDatabase database, boolean distinct, String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy, String limit) {
TracerMachine.enterMethod("query", categoryParams);
Cursor cursor = database.query(distinct, table, columns, selection, selectionArgs, groupBy, having, orderBy, limit);
TracerMachine.exitMethod();
return cursor;
}
public static Cursor query(SQLiteDatabase database, boolean distinct, String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy, String limit, CancellationSignal cancellationSignal) {
TracerMachine.enterMethod("query", categoryParams);
Cursor cursor = database.query(distinct, table, columns, selection, selectionArgs, groupBy, having, orderBy, limit, cancellationSignal);
TracerMachine.exitMethod();
return cursor;
}
public static Cursor query(SQLiteDatabase database, String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy) {
TracerMachine.enterMethod("query", categoryParams);
Cursor cursor = database.query(table, columns, selection, selectionArgs, groupBy, having, orderBy);
TracerMachine.exitMethod();
return cursor;
}
public static Cursor query(SQLiteDatabase database, String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy, String limit) {
TracerMachine.enterMethod("query", categoryParams);
Cursor cursor = database.query(table, columns, selection, selectionArgs, groupBy, having, orderBy, limit);
TracerMachine.exitMethod();
return cursor;
}
public static Cursor queryWithFactory(SQLiteDatabase database, SQLiteDatabase.CursorFactory cursorFactory, boolean distinct, String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy, String limit) {
TracerMachine.enterMethod("queryWithFactory", categoryParams);
Cursor cursor = database.queryWithFactory(cursorFactory, distinct, table, columns, selection, selectionArgs, groupBy, having, orderBy, limit);
return cursor;
}
public static Cursor queryWithFactory(SQLiteDatabase database, SQLiteDatabase.CursorFactory cursorFactory, boolean distinct, String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy, String limit, CancellationSignal cancellationSignal) {
TracerMachine.enterMethod("queryWithFactory", categoryParams);
Cursor cursor = database.queryWithFactory(cursorFactory, distinct, table, columns, selection, selectionArgs, groupBy, having, orderBy, limit, cancellationSignal);
TracerMachine.exitMethod();
return cursor;
}
public static Cursor rawQuery(SQLiteDatabase database, String sql, String[] selectionArgs) {
// new Throwable().printStackTrace();
// TracerMachine.enterMethod("rawQuery", sql, APItype);
TracerMachine.enterMethod("rawQuery", categoryParams);
Cursor cursor = database.rawQuery(sql, selectionArgs);
TracerMachine.exitMethod();
return cursor;
}
public static Cursor rawQuery(SQLiteDatabase database, String sql, String[] selectionArgs, CancellationSignal cancellationSignal) {
TracerMachine.enterMethod("rawQuery", categoryParams);
Cursor cursor = database.rawQuery(sql, selectionArgs, cancellationSignal);
TracerMachine.exitMethod();
return cursor;
}
public static Cursor rawQueryWithFactory(SQLiteDatabase database, SQLiteDatabase.CursorFactory cursorFactory, String sql, String[] selectionArgs, String editTable) {
// TracerMachine.enterMethod("rawQueryWithFactory", sql, APItype);
TracerMachine.enterMethod("rawQueryWithFactory", categoryParams);
Cursor cursor = database.rawQueryWithFactory(cursorFactory, sql, selectionArgs, editTable);
TracerMachine.exitMethod();
return cursor;
}
public static Cursor rawQueryWithFactory(SQLiteDatabase database, SQLiteDatabase.CursorFactory cursorFactory, String sql, String[] selectionArgs, String editTable, CancellationSignal cancellationSignal) {
// TracerMachine.enterMethod("rawQueryWithFactory", sql, APItype);
TracerMachine.enterMethod("rawQueryWithFactory", categoryParams);
Cursor cursor = database.rawQueryWithFactory(cursorFactory, sql, selectionArgs, editTable, cancellationSignal);
TracerMachine.exitMethod();
return cursor;
}
public static long insert(SQLiteDatabase database, String table, String nullColumnHack, ContentValues values) {
// TracerMachine.enterMethod("query", "insert$" + table, APItype);
TracerMachine.enterMethod("insert", categoryParams);
long result = database.insert(table, nullColumnHack, values);
TracerMachine.exitMethod();
return result;
}
public static long insertOrThrow(SQLiteDatabase database, String table, String nullColumnHack, ContentValues values)
throws SQLException {
TracerMachine.enterMethod("insertOrThrow", categoryParams);
// TracerMachine.enterMethod("insertOrThrow", "insertOrThrow$" + table, APItype);
long result = database.insertOrThrow(table, nullColumnHack, values);
TracerMachine.exitMethod();
return result;
}
public static long insertWithOnConflict(SQLiteDatabase database, String table, String nullColumnHack, ContentValues initialValues, int conflictAlgorithm) {
TracerMachine.enterMethod("insertWithOnConflict", categoryParams);
long result = database.insertWithOnConflict(table, nullColumnHack, initialValues, conflictAlgorithm);
TracerMachine.exitMethod();
return result;
}
public static long replace(SQLiteDatabase database, String table, String nullColumnHack, ContentValues initialValues) {
TracerMachine.enterMethod("replace", categoryParams);
long result = database.replace(table, nullColumnHack, initialValues);
TracerMachine.exitMethod();
return result;
}
public static long replaceOrThrow(SQLiteDatabase database, String table, String nullColumnHack, ContentValues initialValues)
throws SQLException {
TracerMachine.enterMethod("replaceOrThrow", categoryParams);
long result = database.replaceOrThrow(table, nullColumnHack, initialValues);
TracerMachine.exitMethod();
return result;
}
public static int delete(SQLiteDatabase database, String table, String whereClause, String[] whereArgs) {
TracerMachine.enterMethod("delete", categoryParams);
int result = database.delete(table, whereClause, whereArgs);
TracerMachine.exitMethod();
return result;
}
public static int update(SQLiteDatabase database, String table, ContentValues values, String whereClause, String[] whereArgs) {
TracerMachine.enterMethod("update", categoryParams);
int result = database.update(table, values, whereClause, whereArgs);
TracerMachine.exitMethod();
return result;
}
public static int updateWithOnConflict(SQLiteDatabase database, String table, ContentValues values, String whereClause, String[] whereArgs, int conflictAlgorithm) {
TracerMachine.enterMethod("updateWithOnConflict", categoryParams);
int result = database.updateWithOnConflict(table, values, whereClause, whereArgs, conflictAlgorithm);
TracerMachine.exitMethod();
return result;
}
public static void execSQL(SQLiteDatabase database, String sql)
throws SQLException {
TracerMachine.enterMethod("execSQL", categoryParams);
database.execSQL(sql);
TracerMachine.exitMethod();
}
public static void execSQL(SQLiteDatabase database, String sql, Object[] bindArgs)
throws SQLException {
TracerMachine.enterMethod("execSQL", categoryParams);
database.execSQL(sql, bindArgs);
TracerMachine.exitMethod();
}
}