[chargeable] MSMySQL - Yet another MySQL-Library (but a FAST one :-))

benji

Active Member
Licensed User
Longtime User
if i have more than one queryasync in the same activity, how can i differentiate each query_Result?
need three different connections?
 

benji

Active Member
Licensed User
Longtime User
OK, i have this example(from here)...
B4X:
Sub MySQL_QueryResult(data As List, meta As Map)
    ToastMessageShow(meta.Get("RecordCount") & " rows retrieved in " & meta.Get("ms") & " milliseconds", True)

    For i = 0 To data.Size - 1
        Log(data.Get(i))
    Next
    Log(data.Size) 
    Log(meta.Size) 
End Sub

in which part can i differentiate the task?
 

Peter Simpson

Expert
Licensed User
Longtime User
@benji here you go.
B4X:
'First run your MySQL query using QueryASync and set your TaskID
     MySQLExe.QueryASync("SELECT * FROM ????", "Login") 'Set your TaskID. 'Login' = TaskID

'Second get your filtered TaskID results using the meta Map
Sub Query_QueryResult(data As List, meta As Map)
    Select meta.Get("TaskID") 'Get the TaskID
        Case "No"
            Log("No")
        Case "No Way"
            Log("No Way")
        Case "Login"     ''Login' is the TaskID
            Log("Login") ''Login' is now in the logs tab
        Case "Hell No"
            Log("Hell No")
    End Select
End Sub
Using Select means that you can filter multiple MySQL queries results with ease...
 
Last edited:

jahswant

Well-Known Member
Licensed User
Longtime User
I'm coming back to this lib and i'm wondering how to do INSERT , UPDATE ,and DELETE ???
 

jahswant

Well-Known Member
Licensed User
Longtime User
This means they does n't have task identifiers like SELECTSs and what about feedbacks since they are nonqueries ???
 

DonManfred

Expert
Licensed User
Longtime User
s the dropbox automatically updated ???
i DID upload the files to my dropbox. But it does not happen automatically.
I also posted a new post in the "Subscribe to Library-Updates thread" and updated the documentation in Post #1 of the lib with the new Version on wednesday.
When i do this post i already updated the files in my Dropbox.
 
Last edited:

swarupsengupto

Member
Licensed User
Longtime User
i have bought your db and i am trying to run a small program and trying to retrieve records from a mysql table. but the app is closing down. unfortunately app has stopped.
I am using basic4android 2.47

#Region Project Attributes
#ApplicationLabel:MS MYSQL
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region

#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region

Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.

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.
Dim db As MySQL
Dim lstvw As ListView

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("Layout1")
'lstvw.Initialize("lstvw")
'Activity.AddView(lstvw, 0 , 0, 40%x, 100%y)
DisableStrictMode
'Event Database Host Username Password Databasename
'db.Initialize("sql","host.com","dbuser","dbpassword","database")
db.Initialize("MySQL","192.168.1.103","root","SUBSOUSWA2000","suncity")
End Sub
Sub Activity_Resume
Log("Activity_Resume()")
'db.ListTablesAsync
'db.queryasync("select * from ufo_trainer LIMIT 0,1 ;")
db.QueryASync("select * from saleitem ","saleitem")
' Dim batch As List
' batch.Initialize
' For i=1 To 100
' batch.Add("INSERT INTO b4alog SET log_value='Test"&i&"', log_time="&DateTime.Now&";")
' Next
' 'db.ExecuteBatchASync(batch)
' db.ExecuteASync("INSERT INTO b4alog SET log_value='only one query', log_time="&DateTime.Now&";")
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub

Sub MySQL_ExecResult(meta As Map)
Log(meta)
End Sub
Sub MySQL_BatchResult(batch As Map)
Log(batch)
End Sub
Sub MySQL_QueryResult(data As List, meta As Map)
'Dim m As Map = meta
Msgbox("MySQL_QueryResult("&meta&")", "")
For i=0 To data.Size-1
Dim cur As Map
ToastMessageShow(cur.Get("TRAN0") , "")
ToastMessageShow(cur.Get("LOCCODE") , "")
Next
End Sub
Sub MySQL_ListTables(tables As List, ms As Long)
Log("MySQL_ListTables("&ms&"ms)")
For i=0 To tables.Size-1
Msgbox("Table "&tables.Get(i), "")
Next
End Sub

Sub DisableStrictMode
Dim jo As JavaObject
jo.InitializeStatic("android.os.Build.VERSION")
Msgbox(jo.GetField("SDK_INT"), "")
If jo.GetField("SDK_INT") > 9 Then

Dim policy As JavaObject
policy = policy.InitializeNewInstance("android.os.StrictMode.ThreadPolicy.Builder", Null)
policy = policy.RunMethodJO("permitAll", Null).RunMethodJO("build", Null)
Dim sm As JavaObject
sm.InitializeStatic("android.os.StrictMode").RunMethod("setThreadPolicy", Array As Object(policy))
End If
End Sub

Please help
 

DonManfred

Expert
Licensed User
Longtime User
unfortunately app has stopped.
You should post the error log while debugging.
Maybe the unfiltered

I am using basic4android 2.47
I´m not sure if the library and/or the native connector will work with this b4a-version.

I´m not sure at all if all the commands i used are compatible with this b4a-version. I dont have such an old b4a version.
I started developing with b4a 2 years ago. With version 2.78
I suggest considering updating your b4a version


Posting the error log will be the best to give us any hints on what´s going wrong.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…