Android SqliteDatabase Command getNewTourPointPosition(SQLiteDatabase db, long tourId)

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

Description

get New Tour Point Position

Declaration

private static int getNewTourPointPosition(SQLiteDatabase db,
            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_POSITION = "position";

    private static int getNewTourPointPosition(SQLiteDatabase db,
            long tourId) {
        Cursor cursor = db.query(TOUR_POINT_TABLE_NAME,
                new String[] { "max(" + TOUR_POINT_POSITION + ")" },
                TOUR_POINT_TOUR_ID + "=" + tourId, null, null, null, null);
        cursor.moveToFirst();/*  w w  w .ja  v  a2  s  . com*/
        int position = cursor.getInt(0);
        cursor.close();
        return ++position;
    }
}

Related

  1. selectFromTable(SQLiteDatabase db, String table, String sample)
  2. updateTable(SQLiteDatabase database, String table, String id, String[] newValues)
  3. getTaskCursor(SQLiteDatabase database, String name)
  4. SQLiteSanitize(String input)
  5. getFreeTourName(SQLiteDatabase db, String tourName)
  6. getTourNames(SQLiteDatabase db)
  7. insertTour(SQLiteDatabase db, String tourName)
  8. isCompanyInTour(SQLiteDatabase db, long companyId, long tourId)
  9. tourNameExists(SQLiteDatabase db, String tourName)