Android Question Create JdbcResultSet on the fly

netsistemas

Active Member
Licensed User
Longtime User
it is posible create a JdbcResultset by code (on the fly / on the go)

I'm trying to get a xml from .net and transform to json (doit), and now i need replace in all my previous code a JdbcResulst to list, but, may be, i can transform xml/json to jdbcresulset.
attach a sample with the resultset from webservice in .net
I need to, get the fields, and the data.

Can you, community, say a 'magic solution' (good ideas)

B4X:
{
  "Envelope": {
    "Body": {
      "getComandoResponse": {
        "getComandoResult": {
          "schema": {
            "Attributes": {
              "id": "NewDataSet"
            },
            "element": {
              "Attributes": {
                "name": "NewDataSet",
                "IsDataSet": "true",
                "MainDataTable": "DataSet",
                "UseCurrentLocale": "true"
              },
              "complexType": {
                "choice": {
                  "Attributes": {
                    "minOccurs": "0",
                    "maxOccurs": "unbounded"
                  },
                  "element": {
                    "Attributes": {
                      "name": "DataSet"
                    },
                    "complexType": {
                      "sequence": {
                        "element": [
                          {
                            "Attributes": {
                              "name": "CAMPO1"
                            },
                            "simpleType": {
                              "restriction": {
                                "Attributes": {
                                  "base": "xs:string"
                                },
                                "maxLength": {
                                  "Attributes": {
                                    "value": "10"
                                  },
                                  "Text": ""
                                }
                              }
                            }
                          },
                          {
                            "Attributes": {
                              "name": "CAMPO2",
                              "minOccurs": "0"
                            },
                            "simpleType": {
                              "restriction": {
                                "Attributes": {
                                  "base": "xs:string"
                                },
                                "maxLength": {
                                  "Attributes": {
                                    "value": "20"
                                  },
                                  "Text": ""
                                }
                              }
                            }
                          },
                          {
                            "Attributes": {
                              "name": "CAMPO3",
                              "minOccurs": "0"
                            },
                            "simpleType": {
                              "restriction": {
                                "Attributes": {
                                  "base": "xs:string"
                                },
                                "maxLength": {
                                  "Attributes": {
                                    "value": "20"
                                  },
                                  "Text": ""
                                }
                              }
                            }
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "diffgram": {
            "DocumentElement": {
              "DataSet": [
                {
                  "Attributes": {
                    "id": "DataSet1",
                    "rowOrder": "0"
                  },
                  "CAMPO1": "AAAA"
                },
                {
                  "Attributes": {
                    "id": "DataSet2",
                    "rowOrder": "1"
                  },
                  "CAMPO1": "BBBB",
                  "CAMPO2": "DASDG",
                  "CAMPO3": "ASDG"
                }
              ]
            }
          }
        }
      }
    }
  }
}
 

DonManfred

Expert
Licensed User
Longtime User
I don´t see how a ResultSet will help you with this Datastructure?

A Resultset may have only the TOP Level of your Data.

It is easier to parse the json to get the wanted Results instead on trying to build a ResultSet.
 
Upvote 0

netsistemas

Active Member
Licensed User
Longtime User
all my proyect use jdbcresult.
change all by webservice are very job. May be if i can to this, the code changed be little.



(
Attach this code for other person. This code get a sub-entry in xml map (beta)
thist sample, get the zone in xml with field definition.

Be careful, if there are NULL values from WebService, the data are nos include in XML.

Call with this:
B4X:
    Dim Campos As Map
             Campos = GetSubEntry(ParsedData,"Envelope.Body.getComandoResponse.getComandoResult.schema.element.complexType.choice.element.complexType.sequence.element")


B4X:
private Sub GetSubEntry(Entrada As Map, SubEntrada As String ) As Map
 
 
    Try
     

        Dim MP() As String
        MP =  Regex.Split("\.",SubEntrada)
        Dim F As Int
        Dim Map1 As Map
        Dim Corte As String
        Map1 = Entrada
        'punto cero: ENVELOPE, es la raiz
        For f = 0 To MP.Length -1
            Corte = MP(F)
            Dim MapRt As Map
            MapRt = Map1.Get(Corte)
            Log (MapRt)
            If f = MP.Length-1 Then
                'fin
                Return Map1
            Else
             
            End If
            Map1 = MapRt
        Next
    Catch
        Log(LastException)
    End Try
End Sub
)
 
Last edited:
Upvote 0
Top