public Local getLocal(Event event) { SQLiteDatabase sqliteDB = dbHelper.getReadableDatabase(); String s = "SELECT * FROM " + TABLE + " WHERE " + _ID + "=" + event.getId_local(); Cursor crsr = sqliteDB.rawQuery(s, null); crsr.moveToFirst(); Local local = new Local(crsr.getDouble(1), crsr.getDouble(2), crsr.getString(3)); local.setId(crsr.getInt(0)); crsr.close(); return local; }
public Local getLocalByName(String name) { SQLiteDatabase sqliteDB = dbHelper.getReadableDatabase(); String s = "SELECT * FROM " + TABLE + " WHERE " + NAME + "='" + name + "'"; Cursor crsr2 = sqliteDB.rawQuery(s, null); if (crsr2.getCount() > 0) { crsr2.moveToFirst(); Local local = new Local(crsr2.getDouble(1), crsr2.getDouble(2), crsr2.getString(3)); local.setId(crsr2.getInt(0)); crsr2.close(); return local; } return null; }