' Used to Add New / Update Existing Notes to Cloud
Sub UploadNotes
Dim cur As Cursor
Dim qry As String
Dim jsn As String
Dim gen As JSONGenerator
Dim L1 As List
Dim M1 As Map
L1.Initialize
Try
qry = "SELECT * FROM MyNotes ORDER BY id"
cur = DB.ExecQuery(qry)
For i = 0 To cur.RowCount - 1
cur.Position = i
M1.Initialize
M1.Put("id", cur.GetInt("id"))
M1.Put("aa", cur.GetString("aa"))
M1.Put("bb", cur.GetString("bb"))
M1.Put("cc", cur.GetString("dd"))
M1.Put("ee", cur.GetInt("ee"))
L1.Add(M1)
Next
gen.Initialize2(L1)
jsn = gen.ToString
Dim HJ As HttpJob
Dim strURL As String
HJ.Initialize("UploadNotes", Me)
strURL = ServerURL & "note-upload.php"
HJ.Download2(strURL, Array As String("ui", gUser, "pw", gPassword, "json", jsn))
Catch
Log("Error: " & LastException.Message)
ToastMessageShow("Error: UploadNotes", False)
End Try
End Sub