Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

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

public class Main {
    public static int findPrimaryKey(SQLiteDatabase db, String tableName, String address) {
        int key = -1;
        Cursor cursor = db.query(tableName, new String[] { "DQXX01" }, "DQXX05=?", new String[] { address }, null,
                null, null);
        if (cursor != null) {
            if (cursor.moveToNext()) {
                key = cursor.getInt(0);
            }
        }
        return key;
    }
}