i need to get column name from the json array and ccompare with the column name with the sqlite table and have to alter the table when the column name dowsnot exists.
i use the code to fetch the column and column name from sqlite by this code
String searchQuery = "SELECT * FROM " + myTable;
Cursor cursor = myDataBase.rawQuery(searchQuery, null );
JSONArray resultSet = new JSONArray();
cursor.moveToFirst();
while (cursor.isAfterLast() == false) {
int totalColumn = cursor.getColumnCount();
JSONObject rowObject = new JSONObject();
for( int i=0 ; i< totalColumn ; i++){
cursor.getColumnName(i);
here i use "cursor.getColumnName() " to get the column name from the sqlitetable.
like this is this possible to fetch the column name from the JSONArray example
cursor.getColumnName(resultSet.getJSONArray(i);
is this possible, else give me solution to get the column name of JSONArray value. i have to compare the column names of JSONArray and the sqlite table.
Aucun commentaire:
Enregistrer un commentaire