Android SqliteDatabase Command getRowsCount(SQLiteDatabase sqlitedatabase, String s, String s1, String as[])

Here you can find the source of getRowsCount(SQLiteDatabase sqlitedatabase, String s, String s1, String as[])

Description

get Rows Count

Declaration

static long getRowsCount(SQLiteDatabase sqlitedatabase, String s,
            String s1, String as[]) 

Method Source Code

//package com.java2s;

import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

public class Main {
    static long getRowsCount(SQLiteDatabase sqlitedatabase, String s,
            String s1, String as[]) {
        Cursor cursor = null;/*from   w w  w .  ja  va 2s.  co m*/
        try {
            cursor = sqlitedatabase.query(s, new String[] { "COUNT(*)" },
                    null, null, null, null, null);
            if (!cursor.moveToFirst())
                return 0L;
            else
                return cursor.getLong(0);
        } finally {
            if (null != cursor) {
                cursor.close();
            }
        }
    }
}

Related

  1. insertTour(SQLiteDatabase db, String tourName)
  2. isCompanyInTour(SQLiteDatabase db, long companyId, long tourId)
  3. tourNameExists(SQLiteDatabase db, String tourName)
  4. getColumns(SQLiteDatabase db, String tableName)
  5. dropAllViews(SQLiteDatabase sqlitedatabase)
  6. formatCalendarForSQLite(Calendar calendar)
  7. getCalendarFromSqlite(String dateString)
  8. execMultipleSQL(SQLiteDatabase db, ArrayList sqlStatements)