Android Question Adding records to sqlite from sqlite via jRDC

Discussion in 'Android Questions' started by kgf, Aug 13, 2018.

  1. kgf

    kgf Member Licensed User

    I have got Jrdc working and would like to copy records from sqlite tables on the host to matching sqlite tables on the device. I need to do this for a number of tables and looking for the best way to do this. I can log a result using req.PrintTable(res) and was thinking of using DBUtils.InsertMaps(SQL, "table", ListOfMaps) to add the records but unsure of the best way of turning the result into a list of maps.
    Is DBUtils a good way of doing this and if so what is the best way to turn the result into a ListOfMaps. Will be copying a number of tables with varying amounts of columns.

    Thanks
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    DBUtils.InsertMaps is a good option.

    Something like:
    Code:
    Dim maps As List
    maps.Initialize
    For Each row() As Object In res.Rows
     maps.Add(CreateMap(
    "column1": row(res.Columns.Get("column1")), "column2": row(res.Columns.Get("column2")))
    Next
    'now insert maps
     
    Peter Simpson likes this.
  3. kgf

    kgf Member Licensed User

    Thanks, make sense now I see an example
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice