| | |
| | | import java.sql.*; |
| | | import java.util.*; |
| | | import org.json.*; |
| | | |
| | | |
| | | |
| | | |
| | | import org.json.JSONArray; |
| | | |
| | | |
| | | public class DBSession implements AutoCloseable { |
| | |
| | | JSONObject obj=new JSONObject(); |
| | | int idx=1; |
| | | do{ |
| | | JSONArray a=this.resultToJson(false); |
| | | org.json.JSONArray a=this.resultToJson(false); |
| | | obj.put("Table"+idx,a); |
| | | idx++; |
| | | }while(this.nextResult()); |
| | |
| | | } |
| | | |
| | | //����ǰ�Ľ����ֱ������JSON���� |
| | | public JSONArray resultToJson(boolean RowAsObject) throws SQLException, JSONException{ |
| | | public org.json.JSONArray resultToJson(boolean RowAsObject) throws SQLException, JSONException{ |
| | | return DBHelper.resultToJson(this.getCurrentResult(), RowAsObject); |
| | | } |
| | | |
| | | public JSONArray resultToJson(String[] fields,boolean RowAsObject) throws SQLException, JSONException{ |
| | | public org.json.JSONArray resultToJson(String[] fields, boolean RowAsObject) throws SQLException, JSONException{ |
| | | return DBHelper.resultToJson(fields,this.getCurrentResult(), RowAsObject); |
| | | } |
| | | |
| | | |
| | | public List<JSONArray> allToJson(boolean RowAsObject) throws SQLException, JSONException{ |
| | | List<JSONArray> arrs=new ArrayList<JSONArray>(); |
| | | public List<org.json.JSONArray> allToJson(boolean RowAsObject) throws SQLException, JSONException{ |
| | | List<org.json.JSONArray> arrs=new ArrayList<JSONArray>(); |
| | | do{ |
| | | arrs.add(DBHelper.resultToJson(this.getCurrentResult(), RowAsObject)); |
| | | }while(this.nextResult()); |