Android examples for Database:SQL Query
raw Fetch Long from database
/*//from w ww . j a v a 2 s . c om * Copyright (c) 2012 Denis Solonenko. * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Public License v2.0 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html */ import android.database.Cursor; public class Main{ private static long rawFetchLong(DatabaseAdapter db, String query, String[] selectionArgs, long defaultValue) { Cursor c = db.db().rawQuery(query, selectionArgs); try { if (c.moveToFirst()) { return c.getLong(0); } } finally { c.close(); } return defaultValue; } }