List of usage examples for android.database Cursor isNull
boolean isNull(int columnIndex);
true
if the value in the indicated column is null. From source file:com.rener.sea.DBHelper.java
private JSONArray getCategory() { JSONArray data;//from ww w . j a va 2s . c o m data = new JSONArray(); SQLiteDatabase db = getReadableDatabase(); Cursor cursor = db.query(DBSchema.TABLE_CATEGORY, new String[] { DBSchema.CATEGORY_ID, DBSchema.CATEGORY_NAME }, DBSchema.MODIFIED + "=?", new String[] { DBSchema.MODIFIED_YES }, null, null, null, null); if (cursor.moveToFirst()) { if ((cursor != null) && (cursor.getCount() > 0)) for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) { JSONObject map = new JSONObject(); try { if (!cursor.isNull(0)) map.put(DBSchema.CATEGORY_ID, cursor.getString(0)); } catch (JSONException e) { e.printStackTrace(); } try { if (!cursor.isNull(1)) map.put(DBSchema.CATEGORY_NAME, cursor.getString(1)); } catch (JSONException e) { e.printStackTrace(); } data.put(map); } } db.close(); cursor.close(); return data; }
From source file:com.rener.sea.DBHelper.java
private JSONArray getSpecialization() { JSONArray data;//w w w. j a v a 2 s . c o m data = new JSONArray(); SQLiteDatabase db = getReadableDatabase(); Cursor cursor = db.query(DBSchema.TABLE_SPECIALIZATION, new String[] { DBSchema.SPECIALIZATION_ID, DBSchema.SPECIALIZATION_NAME }, DBSchema.MODIFIED + "=?", new String[] { DBSchema.MODIFIED_YES }, null, null, null, null); if (cursor.moveToFirst()) { if ((cursor != null) && (cursor.getCount() > 0)) for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) { JSONObject map = new JSONObject(); try { if (!cursor.isNull(0)) map.put(DBSchema.SPECIALIZATION_ID, cursor.getString(0)); } catch (JSONException e) { e.printStackTrace(); } try { if (!cursor.isNull(1)) map.put(DBSchema.SPECIALIZATION_NAME, cursor.getString(1)); } catch (JSONException e) { e.printStackTrace(); } data.put(map); } } db.close(); cursor.close(); return data; }
From source file:com.rener.sea.DBHelper.java
private JSONArray getLocation_category() { JSONArray data;//from w w w . j a va 2 s . c o m data = new JSONArray(); SQLiteDatabase db = getReadableDatabase(); Cursor cursor = db.query(DBSchema.TABLE_LOCATION_CATEGORY, new String[] { DBSchema.LOCATION_CATEGORY_LOCATION_ID, DBSchema.LOCATION_CATEGORY_CATEGORY_ID }, DBSchema.MODIFIED + "=?", new String[] { DBSchema.MODIFIED_YES }, null, null, null, null); if (cursor.moveToFirst()) { if ((cursor != null) && (cursor.getCount() > 0)) for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) { JSONObject map = new JSONObject(); try { if (!cursor.isNull(0)) map.put(DBSchema.LOCATION_CATEGORY_LOCATION_ID, cursor.getString(0)); } catch (JSONException e) { e.printStackTrace(); } try { if (!cursor.isNull(1)) map.put(DBSchema.LOCATION_CATEGORY_CATEGORY_ID, cursor.getString(1)); } catch (JSONException e) { e.printStackTrace(); } data.put(map); } } db.close(); cursor.close(); return data; }
From source file:com.rener.sea.DBHelper.java
private JSONArray getItem() { JSONArray data;//from w ww.j a v a 2 s .c o m data = new JSONArray(); SQLiteDatabase db = getReadableDatabase(); Cursor cursor = db.query(DBSchema.TABLE_ITEM, new String[] { DBSchema.ITEM_ID, DBSchema.ITEM_FLOWCHART_ID, DBSchema.ITEM_LABEL, DBSchema.ITEM_TYPE }, DBSchema.MODIFIED + "=?", new String[] { DBSchema.MODIFIED_YES }, null, null, null, null); if (cursor.moveToFirst()) { if ((cursor != null) && (cursor.getCount() > 0)) for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) { JSONObject map = new JSONObject(); try { if (!cursor.isNull(0)) map.put(DBSchema.ITEM_ID, cursor.getString(0)); } catch (JSONException e) { e.printStackTrace(); } try { if (!cursor.isNull(1)) map.put(DBSchema.ITEM_FLOWCHART_ID, cursor.getString(1)); } catch (JSONException e) { e.printStackTrace(); } try { if (!cursor.isNull(2)) map.put(DBSchema.ITEM_LABEL, cursor.getString(2)); } catch (JSONException e) { e.printStackTrace(); } try { if (!cursor.isNull(3)) map.put(DBSchema.ITEM_TYPE, cursor.getString(3)); } catch (JSONException e) { e.printStackTrace(); } data.put(map); } } db.close(); cursor.close(); return data; }
From source file:com.rener.sea.DBHelper.java
private JSONArray getUsers_specialization() { JSONArray data;/*from ww w. j ava 2s. c o m*/ data = new JSONArray(); SQLiteDatabase db = getReadableDatabase(); Cursor cursor = db.query(DBSchema.TABLE_USERS_SPECIALIZATION, new String[] { DBSchema.USERS_SPECIALIZATION_USER_ID, DBSchema.USERS_SPECIALIZATION_SPECIALIZATION_ID }, DBSchema.MODIFIED + "=?", new String[] { DBSchema.MODIFIED_YES }, null, null, null, null); if (cursor.moveToFirst()) { if ((cursor != null) && (cursor.getCount() > 0)) for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) { JSONObject map = new JSONObject(); try { if (!cursor.isNull(0))// map.put(DBSchema.USERS_SPECIALIZATION_USER_ID, cursor.getString(0)); } catch (JSONException e) { e.printStackTrace(); } try { if (!cursor.isNull(1))// map.put(DBSchema.USERS_SPECIALIZATION_SPECIALIZATION_ID, cursor.getString(1)); } catch (JSONException e) { e.printStackTrace(); } data.put(map); } } db.close(); cursor.close(); return data; }
From source file:com.rener.sea.DBHelper.java
private JSONArray getPath() { JSONArray data;//from w w w .ja va 2 s . c o m data = new JSONArray(); SQLiteDatabase db = getReadableDatabase(); Cursor cursor = db.query(DBSchema.TABLE_PATH, new String[] { DBSchema.PATH_REPORT_ID, DBSchema.PATH_OPTION_ID, DBSchema.PATH_DATA, DBSchema.PATH_SEQUENCE }, DBSchema.MODIFIED + "=?", new String[] { DBSchema.MODIFIED_YES }, null, null, null, null); if (cursor.moveToFirst()) { if ((cursor != null) && (cursor.getCount() > 0)) for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) { JSONObject map = new JSONObject(); try { if (!cursor.isNull(0)) map.put(DBSchema.PATH_REPORT_ID, cursor.getString(0)); } catch (JSONException e) { e.printStackTrace(); } try { if (!cursor.isNull(1)) map.put(DBSchema.PATH_OPTION_ID, cursor.getString(1)); } catch (JSONException e) { e.printStackTrace(); } try { if (!cursor.isNull(2)) map.put(DBSchema.PATH_DATA, cursor.getString(2)); } catch (JSONException e) { e.printStackTrace(); } try { if (!cursor.isNull(3)) map.put(DBSchema.PATH_SEQUENCE, cursor.getString(3)); } catch (JSONException e) { e.printStackTrace(); } data.put(map); } } db.close(); cursor.close(); return data; }
From source file:com.rener.sea.DBHelper.java
private JSONArray getOption() { JSONArray data;/*from w ww .ja va 2 s . com*/ data = new JSONArray(); SQLiteDatabase db = getReadableDatabase(); Cursor cursor = db.query(DBSchema.TABLE_OPTION, new String[] { DBSchema.OPTION_ID, DBSchema.OPTION_PARENT_ID, DBSchema.OPTION_NEXT_ID, DBSchema.OPTION_LABEL }, DBSchema.MODIFIED + "=?", new String[] { DBSchema.MODIFIED_YES }, null, null, null, null); if (cursor.moveToFirst()) { if ((cursor != null) && (cursor.getCount() > 0)) for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) { JSONObject map = new JSONObject(); try { if (!cursor.isNull(0)) map.put(DBSchema.OPTION_ID, cursor.getString(0)); } catch (JSONException e) { e.printStackTrace(); } try { if (!cursor.isNull(1)) map.put(DBSchema.OPTION_PARENT_ID, cursor.getString(1)); } catch (JSONException e) { e.printStackTrace(); } try { if (!cursor.isNull(2)) map.put(DBSchema.OPTION_NEXT_ID, cursor.getString(2)); } catch (JSONException e) { e.printStackTrace(); } try { if (!cursor.isNull(3)) map.put(DBSchema.OPTION_LABEL, cursor.getString(3)); } catch (JSONException e) { e.printStackTrace(); } data.put(map); } } db.close(); cursor.close(); return data; }
From source file:com.rener.sea.DBHelper.java
private JSONArray getUsers() { JSONArray data;//from www . j a va2 s . co m data = new JSONArray(); SQLiteDatabase db = getReadableDatabase(); Cursor cursor = db.query(DBSchema.TABLE_USERS, new String[] { DBSchema.USER_ID, DBSchema.USER_USERNAME, DBSchema.USER_PASSHASH, DBSchema.USER_PERSON_ID, DBSchema.USER_SALT }, DBSchema.MODIFIED + "=?", new String[] { DBSchema.MODIFIED_YES }, null, null, null, null); if (cursor.moveToFirst()) { if ((cursor != null) && (cursor.getCount() > 0)) for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) { JSONObject map = new JSONObject(); try { if (!cursor.isNull(0)) map.put(DBSchema.USER_ID, cursor.getString(0)); } catch (JSONException e) { e.printStackTrace(); } try { if (!cursor.isNull(1)) map.put(DBSchema.USER_USERNAME, cursor.getString(1)); } catch (JSONException e) { e.printStackTrace(); } try { if (!cursor.isNull(2)) map.put(DBSchema.USER_PASSHASH, cursor.getString(2)); } catch (JSONException e) { e.printStackTrace(); } try { if (!cursor.isNull(3)) map.put(DBSchema.USER_PERSON_ID, cursor.getString(3)); } catch (JSONException e) { e.printStackTrace(); } try { if (!cursor.isNull(4)) map.put(DBSchema.USER_SALT, cursor.getString(4)); } catch (JSONException e) { e.printStackTrace(); } data.put(map); } } db.close(); cursor.close(); return data; }
From source file:com.rener.sea.DBHelper.java
private JSONArray getAddress() { JSONArray data;//from ww w . j a v a2 s . c o m data = new JSONArray(); SQLiteDatabase db = getReadableDatabase(); Cursor cursor = db.query(DBSchema.TABLE_ADDRESS, new String[] { DBSchema.ADDRESS_ID, DBSchema.ADDRESS_LINE1, DBSchema.ADDRESS_CITY, DBSchema.ADDRESS_ZIPCODE, DBSchema.ADDRESS_LINE2 }, DBSchema.MODIFIED + "=?", new String[] { DBSchema.MODIFIED_YES }, null, null, null, null); if (cursor.moveToFirst()) { if ((cursor != null) && (cursor.getCount() > 0)) for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) { JSONObject map = new JSONObject(); try { if (!cursor.isNull(0)) map.put(DBSchema.ADDRESS_ID, cursor.getString(0)); } catch (JSONException e) { e.printStackTrace(); } try { if (!cursor.isNull(1)) map.put(DBSchema.ADDRESS_LINE1, cursor.getString(1)); } catch (JSONException e) { e.printStackTrace(); } try { if (!cursor.isNull(2)) map.put(DBSchema.ADDRESS_CITY, cursor.getString(2)); } catch (JSONException e) { e.printStackTrace(); } try { if (!cursor.isNull(3)) map.put(DBSchema.ADDRESS_ZIPCODE, cursor.getString(3)); } catch (JSONException e) { e.printStackTrace(); } try { if (!cursor.isNull(4)) map.put(DBSchema.ADDRESS_LINE2, cursor.getString(4)); } catch (JSONException e) { e.printStackTrace(); } data.put(map); } } db.close(); cursor.close(); return data; }
From source file:com.rener.sea.DBHelper.java
private JSONArray getDevices() { JSONArray data;//from ww w . j av a 2s .c om data = new JSONArray(); SQLiteDatabase db = getReadableDatabase(); Cursor cursor = db.query(DBSchema.TABLE_DEVICES, new String[] { DBSchema.DEVICE_ID, DBSchema.DEVICE_NAME, DBSchema.DEVICE_ID_NUMBER, DBSchema.DEVICE_USER_ID, DBSchema.DEVICE_LATEST_SYNC }, DBSchema.MODIFIED + "=?", new String[] { DBSchema.MODIFIED_YES }, null, null, null, null); if (cursor.moveToFirst()) { if ((cursor != null) && (cursor.getCount() > 0)) for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) { JSONObject map = new JSONObject(); try { if (!cursor.isNull(0)) map.put(DBSchema.DEVICE_ID, cursor.getString(0)); } catch (JSONException e) { e.printStackTrace(); } try { if (!cursor.isNull(1)) map.put(DBSchema.DEVICE_NAME, cursor.getString(1)); } catch (JSONException e) { e.printStackTrace(); } try { if (!cursor.isNull(2)) map.put(DBSchema.DEVICE_ID_NUMBER, cursor.getString(2)); } catch (JSONException e) { e.printStackTrace(); } try { if (!cursor.isNull(3)) map.put(DBSchema.DEVICE_USER_ID, cursor.getString(3)); } catch (JSONException e) { e.printStackTrace(); } try { if (!cursor.isNull(4)) map.put(DBSchema.DEVICE_LATEST_SYNC, cursor.getString(4)); } catch (JSONException e) { e.printStackTrace(); } data.put(map); } } db.close(); cursor.close(); return data; }