Code example for SQLiteDatabase

Methods: rawQuery

0
	} 
 
	private static String getTypeString(final SQLiteDatabase db, final String table, final String column) {
 
		final String sql = "SELECT typeof(" + column + ") FROM " + table;
		final Cursor cur = db.rawQuery(sql, null);
		if (cur == null) return null;
		cur.moveToFirst();
		try { 
			return cur.getString(0);
		} finally { 
			cur.close();
		} 
	} 
 
	private static boolean isTypeCompatible(final String old_type, final String new_type,
			final boolean treat_null_as_compatible) {
		if (old_type != null && new_type != null) {
			final int old_idx = old_type.contains("(") ? old_type.indexOf("(") : old_type.indexOf(" ");
			final int new_idx = new_type.contains("(") ? new_type.indexOf("(") : new_type.indexOf(" ");
			final String old_type_main = old_idx > -1 ? old_type.substring(0, old_idx) : old_type;