/** * * @param value * a compatible JSONObject that describe a DBXParameters * @return a fully configured DBXParameters */ public static TParams CreateFrom(TJSONObject value) { TParams parameters = CreateParametersFromMetadata(value .getJSONArray("table")); LoadParametersValues(parameters, value); return parameters; }
public static TDBXReader createFrom(TJSONObject value) { TParams parameters = TParams.CreateParametersFromMetadata(value .getJSONArray("table")); TDBXReader rdr = new TDBXReader(parameters, value); return rdr; }
/** * Create a JSONObject from a DBXReader * @param dbxReader * @return JSONObject */ public static TJSONObject DBXReaderToJSONObject(TDBXReader dbxReader) { TJSONObject json = new TJSONObject(); TJSONArray arr2; TParams columns = dbxReader.getColumns(); try { arr2 = new TJSONArray(); for (int i = 0; i < columns.size(); i++) { arr2.add(columns.getParameter(i).tojson()); // Create the empty JArray for the data. Will be filled after json.addPairs(columns.getParameter(i).getName(), new TJSONArray()); } while (dbxReader.next()) { for (int c = 0; c < columns.size(); c++) { dbxReader.getColumns().getParameter(c).getValue().appendTo( json.getJSONArray(columns.getParameter(c) .getName())); } } json.addPairs("table", arr2); } catch (Exception) { } return(json); }
public static TDBXReader createFrom(TJSONObject value) { TParams parameters = TParams.CreateParametersFromMetadata(value .getJSONArray("table")); TDBXReader rdr = new TDBXReader(parameters, value); return(rdr); }
/** * * @param value * a compatible JSONObject that describe a DBXParameters * @return a fully configured DBXParameters */ public static TParams CreateFrom(TJSONObject value) { TParams parameters = CreateParametersFromMetadata(value .getJSONArray("table")); LoadParametersValues(parameters, value); return(parameters); }
/** * Create a JSONObject from a DBXReader * @param dbxReader * @return JSONObject */ public static TJSONObject DBXReaderToJSONObject(TDBXReader dbxReader) { TJSONObject json = new TJSONObject(); TJSONArray arr2; TParams columns = dbxReader.getColumns(); try { arr2 = new TJSONArray(); for (int i = 0; i < columns.size(); i++) { arr2.add(columns.getParameter(i).tojson()); // Create the empty JArray for the data. Will be filled after json.addPairs(columns.getParameter(i).getName(), new TJSONArray()); } while (dbxReader.next()) { for (int c = 0; c < columns.size(); c++) dbxReader.getColumns().getParameter(c).getValue().appendTo( json.getJSONArray(columns.getParameter(c) .getName())); } json.addPairs("table", arr2); } catch (Exception) { } return json; }