/* * Copyright (C) 2015 Actor LLC. <https://actor.im> */ package im.actor.runtime.android.storage; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; public class SQLiteHelpers { public static boolean isTableExists(SQLiteDatabase db, String tableName) { Cursor cursor = db.rawQuery("select DISTINCT tbl_name from sqlite_master where tbl_name = '" + tableName + "'", null); if (cursor != null) { if (cursor.getCount() > 0) { cursor.close(); return true; } cursor.close(); } return false; } }