public Cursor getSurveyAnswer(DatabaseOperations dop) {

    SQLiteDatabase SQ = dop.getReadableDatabase();
    String selectQuery = "SELECT * FROM " + TableInfo_Survey_Answer.TABLE_NAME;
    Cursor c = SQ.rawQuery(selectQuery, null);
    return c;
  }
  public Cursor getFieldTable(DatabaseOperations dop) {

    SQLiteDatabase SQ = dop.getReadableDatabase();
    String selectQuery = "SELECT * FROM " + Table_Info_Field_Table.TABLE_NAME;
    Cursor c = SQ.rawQuery(selectQuery, null);
    return c;
  }
  public Cursor getSurveyQuestions(DatabaseOperations dop, String questionnaireID) {

    SQLiteDatabase SQ = dop.getReadableDatabase();
    String selectQuery =
        "SELECT * FROM "
            + TableInfo_Survey_Question.TABLE_NAME
            + " WHERE "
            + TableInfo_Survey_Question.QUESTIONNAIRE_ID
            + " = "
            + questionnaireID
            + " ORDER BY "
            + TableInfo_Survey_Question.DISPLAY_ORDER
            + " ASC";
    Cursor c = SQ.rawQuery(selectQuery, null);

    return c;
  }
  public Cursor getQuestionnaireFieldAssociation(DatabaseOperations dop, String questionnaireId) {

    SQLiteDatabase SQ = dop.getReadableDatabase();
    String selectQuery =
        "SELECT "
            + Table_Info_Questionnaire_Field_Association.TABLE_NAME
            + ".* ,"
            + Table_Info_Field_Table.TABLE_NAME
            + "."
            + Table_Info_Field_Table.FIELD_NAME
            + " FROM "
            + Table_Info_Questionnaire_Field_Association.TABLE_NAME
            + " INNER JOIN "
            + Table_Info_Field_Table.TABLE_NAME
            + " ON "
            + Table_Info_Questionnaire_Field_Association.TABLE_NAME
            + "."
            + Table_Info_Field_Table.FIELD_ID
            + " = "
            + Table_Info_Field_Table.TABLE_NAME
            + "."
            + Table_Info_Questionnaire_Field_Association.FIELD_ID
            + " WHERE "
            + Table_Info_Questionnaire_Field_Association.TABLE_NAME
            + "."
            + Table_Info_Questionnaire_Field_Association.QUESTIONNAIRE_ID
            + "= '"
            + questionnaireId
            + "' ORDER BY "
            + Table_Info_Questionnaire_Field_Association.ORDER
            + " ASC";

    Log.i("database join", selectQuery);
    Cursor c = SQ.rawQuery(selectQuery, null);
    return c;
  }
  public int getFieldId(DatabaseOperations dop, String field_name) {

    field_name = field_name.replace("'", "''");
    int id;
    SQLiteDatabase SQ = dop.getReadableDatabase();
    String selectQuery =
        "SELECT "
            + Table_Info_Field_Table.FIELD_ID
            + " FROM "
            + Table_Info_Field_Table.TABLE_NAME
            + " WHERE "
            + Table_Info_Field_Table.FIELD_NAME
            + " = '"
            + field_name
            + "'";
    // String selectQuery = "SELECT " +  "* FROM " + Table_Info_Field_Table.TABLE_NAME ;
    Cursor c = SQ.rawQuery(selectQuery, null);
    if (c.moveToFirst()) {
      id = c.getInt(c.getColumnIndex(Table_Info_Field_Table.FIELD_ID));
    } else {
      id = -1;
    }
    return id;
  }