Hi guys, I would like to upload the content of an sqlitedb into a mysqldb. I can upload single records, but i dont know how to send more than one per each data.
client side example for one line update:
dim qs as Text=""""
dim saveBC(200) as Text
dim saveNAME(200) as Text
dim savePRICE(200) as Text
dim saveCURRENCY(200) as Text
dim saveLATTITUDE(200) as Text
dim saveLONGITUDE(200) as Text
dim saveADDRESS(200) as Text
dim saveSHOP(200) as Text
dim saveDATUM(200) as Text
Dim datab As New SQLiteDatabase
Dim dbFile As FolderItem
dbFile = SpecialFolder.Documents.Child(“hololcsobb.sqlite”)
If dbFile.Exists Then
datab.DatabaseFile = dbFile
If datab.Connect Then
dim sqlcommand as Text
sqlcommand=“SELECT * from product_list”
dim rs as SQLiteRecordSet
rs=datab.SQLSelect(sqlcommand)
eddig=rs.RecordCount
if rs.RecordCount>0 Then
rs.MoveFirst
for i as integer=0 to rs.RecordCount-1
saveBC(i)=rs.Field("bc").TextValue
saveNAME(i)=rs.Field("name").TextValue
savePRICE(i)= rs.Field("price").TextValue
saveCURRENCY(i)=rs.Field("currency").TextValue
saveLATTITUDE(i)=rs.Field("lattitude").TextValue
saveLONGITUDE(i)=rs.Field("longitude").TextValue
saveADDRESS(i)=rs.Field("address").TextValue
saveSHOP(i)=rs.Field("shop").TextValue
saveDATUM(i)=rs.Field("datum").TextValue
rs.MoveNext
next
rs.Close
end if
Else
Dim err As Text = "Could not open the database."
End If
End If
RequestContentArea.text="{""bc"":"+qs+saveBC(0)+qs+",""name"":"+qs+saveNAME(0)+qs+"}"
ResponseArea.Text=""
RSocket.ClearRequestHeaders
Dim sendMethod As Text = "POST"
Dim requestContent As Text = RequestContentArea.Text
If Not requestContent.Empty Then
Dim data As Xojo.Core.MemoryBlock
data = Xojo.Core.TextEncoding.UTF8.ConvertTextToData(requestContent)
RSocket.SetRequestContent(data, "application/x-www-form-urlencoded")
End If
RSocket.Send("POST", "http://192.168.5.48:82/special/CopyAll")
service side example for one line upload:
Dim jsonD As New JSONItem(jsonData)
Dim json_bc As string =jsonD.Value(“bc”)
Dim json_name As string =jsonD.Value(“name”)
'Dim json_price As string =jsonD.Value(“price”)
'Dim json_currency As string =jsonD.Value(“currency”)
'Dim json_lattitude As string =jsonD.Value(“lattitude”)
'Dim json_longitude As string =jsonD.Value(“longitude”)
'Dim json_address As string =jsonD.Value(“address”)
'Dim json_shop As string =jsonD.Value(“shop”)
'Dim json_datum As string =jsonD.Value(“datum”)
Dim sql As String = “INSERT INTO ezkell (bc,name) VALUES (’”+json_bc+"’,’"+json_name+"’)"
Dim ps As MySQLPreparedStatement = db.Prepare(sql)
db.SQLExecute(sql)
if db.Error then
MsgBox db.ErrorMessage
end if
Can someone help me about this problem?