Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim db As MSMaria
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private Button1 As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("1")
If FirstTime=True Then
db.DisableReconnect
db.Initialize("MySQL","192.168.168.3:3306","myroot","mypass","mydatabase")
End If
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub MySQL_Status(Connected As Boolean, ReConnecting As Boolean, RetriesLeft As Int)
Log($"Connected = ${Connected}"$)
If Connected=True Then
'i will have a simple routine to remove escape chars
db.QueryASync("select * from cars WHERE id='myid' AND password='test';","login") 'The right one is test - but i am getting strange error
db.EnableReconnect
End If
End Sub
Sub MySQL_QueryResult(data As List, meta As Map)
Log(meta)
Dim m As Map = meta
Select Case m.Get("TaskID")
Case "login"
If data.size > 0 Then
ToastMessageShow("ok!",True)
db.ExecuteASync("UPDATE INTO cars SET login=1, lastdate='"& DateTime.Date(DateTime.Now) &"', lasttime='"& DateTime.time(DateTime.Now) & "' WHERE id='myid';","")
Else
ToastMessageShow("wrong user/pass",True)
End If
End Select
End Sub