Exemplo n.º 1
0
 /**
  *
  * @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;
 }
Exemplo n.º 2
0
 public static TDBXReader createFrom(TJSONObject value)
 {
     TParams parameters = TParams.CreateParametersFromMetadata(value
             .getJSONArray("table"));
     TDBXReader rdr = new TDBXReader(parameters, value);
     return rdr;
 }
Exemplo n.º 3
0
        /**
         * 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);
        }
Exemplo n.º 4
0
        public static TDBXReader createFrom(TJSONObject value)
        {
            TParams parameters = TParams.CreateParametersFromMetadata(value
                                                                      .getJSONArray("table"));
            TDBXReader rdr = new TDBXReader(parameters, value);

            return(rdr);
        }
Exemplo n.º 5
0
        /**
         *
         * @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);
        }
Exemplo n.º 6
0
        /**
          	 * 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;
        }