Exemple #1
0
 public static TDBXReader createFrom(TJSONObject value)
 {
     TParams parameters = TParams.CreateParametersFromMetadata(value
             .getJSONArray("table"));
     TDBXReader rdr = new TDBXReader(parameters, value);
     return rdr;
 }
Exemple #2
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);
        }
Exemple #3
0
        public static TDBXReader createFrom(TJSONObject value)
        {
            TParams parameters = TParams.CreateParametersFromMetadata(value
                                                                      .getJSONArray("table"));
            TDBXReader rdr = new TDBXReader(parameters, value);

            return(rdr);
        }
Exemple #4
0
 /**
  * @param param is an InputOutput, Output or ReturnValue (JSONValueType)
  * @param value is a generic object readed from the json result array
  * @return an Object that rapresent the result JSON or the JSONObject itself
  */
 public static Object JSONToTableType(Object value, String DBXTypeName)
 {
     if (DBXTypeName.Equals("TParams"))
     {
         return(TParams.CreateFrom(new TJSONObject((JObject)value)));
     }
     else
     {
         if ((DBXTypeName.Equals("TDBXReader")) ||
             (DBXTypeName.Equals("TDBXReaderValue")))
         {
             return(TDBXReader.createFrom(new TJSONObject((JObject)value)));
         }
         else
         {
             if (DBXTypeName.Equals("TDataSet"))
             {
                 return(TDataSet.createFrom(new TJSONObject((JObject)value)));
             }
         }
     }
     throw new DBXException(DBXTypeName + " is not a table type");
 }
        /**
          	 * 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;
        }
Exemple #6
0
 public void DropServerMethods(TDBXReader MethodReader, DropServerMethodsCallback callback = null, ExceptionCallback ExCal = null)
 {
     DSRESTCommand cmd = getConnection().CreateCommand();
     cmd.setRequestType(DSHTTPRequestType.POST);
     cmd.setText("DSAdmin.DropServerMethods");
     cmd.prepare(get_DSAdmin_DropServerMethods_Metadata());
     DropServerMethodsDelegate DropServerMethodsDel = () => {
       if (callback != null)
       {
     callback.DynamicInvoke();
       }
     };
     cmd.getParameter(0).getValue().SetAsTable(MethodReader);
     getConnection().execute(cmd, this, DropServerMethodsDel, ExCal);
 }