Android SqliteDatabase Command isCompanyInTour(SQLiteDatabase db, long companyId, long tourId)

Here you can find the source of isCompanyInTour(SQLiteDatabase db, long companyId, long tourId)

Description

is Company In Tour

Declaration

public static boolean isCompanyInTour(SQLiteDatabase db,
            long companyId, long tourId) 

Method Source Code

//package com.java2s;

import android.database.Cursor;

import android.database.sqlite.SQLiteDatabase;

public class Main {
    protected final static String TOUR_POINT_TABLE_NAME = "TourPoint";
    protected final static String TOUR_POINT_TOUR_ID = "tourId";
    protected final static String TOUR_POINT_COMPANY_ID = "companyId";

    public static boolean isCompanyInTour(SQLiteDatabase db,
            long companyId, long tourId) {

        Cursor cursor = db.query(
                true,//from w w w .j  a  v  a2s. c o  m
                TOUR_POINT_TABLE_NAME,
                new String[] { TOUR_POINT_TOUR_ID, TOUR_POINT_COMPANY_ID },
                TOUR_POINT_TOUR_ID + "=? " + " AND "
                        + TOUR_POINT_COMPANY_ID + "=?",
                new String[] { Long.toString(tourId),
                        Long.toString(companyId) }, null, null, null, null);
        cursor.moveToFirst();
        if (cursor.getCount() >= 1) {
            return true;
        } else {
            return false;
        }

    }
}

Related

  1. SQLiteSanitize(String input)
  2. getFreeTourName(SQLiteDatabase db, String tourName)
  3. getNewTourPointPosition(SQLiteDatabase db, long tourId)
  4. getTourNames(SQLiteDatabase db)
  5. insertTour(SQLiteDatabase db, String tourName)
  6. tourNameExists(SQLiteDatabase db, String tourName)
  7. getColumns(SQLiteDatabase db, String tableName)
  8. dropAllViews(SQLiteDatabase sqlitedatabase)
  9. getRowsCount(SQLiteDatabase sqlitedatabase, String s, String s1, String as[])