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 final String TABLE_NAME = "dqxx";

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