Android Question Mysql abfrage in einer klasse

marcusschwertz

Member
Licensed User
Longtime User
B4X:
'Code module
'Subs in this code module will be accessible from all modules.
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Dim req As HttpRequest
    Dim Abfrage_URL As String
    Dim SQL_String As String
    Dim Timer1 As Timer
    Dim LIste As List
    Dim fertig As Boolean
    Dim abfrage_HttpClient As HttpClient
    Dim Thread1 As Thread
    Dim args(0) As Object
End Sub
 
Sub blbub(SQL_String As String) As List
Thread1.Initialise("Thread1")
Thread1.Start(Null,"test_abfrage",args)
fertig = False
Do While fertig = False
    Timer1.Initialize("Timer1",500)
    Timer1.Enabled = True
Loop
Return LIste
End Sub
 
Sub Timer1_Tick
 
End Sub
 
Sub test_abfrage
    Abfrage_URL = "http://url..../abfrage.php"
    abfrage_HttpClient.Initialize("abfrage_HttpClient")
    req.InitializePost2(Abfrage_URL, SQL_String.GetBytes("UTF8"))
    abfrage_HttpClient.Execute(req,1)
End Sub
 
Sub abfrage_HttpClient_responsesuccess (Response As HttpResponse,Taskid As Long)
Dim parser As JSONParser
        parser.Initialize(Response.GetString("UTF8"))
        LIste = parser.NextArray
        fertig = True
End Sub
 
Sub abfrage_HttpClient_ResponseError (Response As HttpResponse, Reason As String, StatusCode As Int, TaskId As Int)
    ToastMessageShow("Fehler: " & Reason & ", StatusCode: " & StatusCode,False)
    fertig = True
End Sub
Why does this not work? I get the error that the sub abfrage_HttpClient_responsesuccess is not found. Or does anyone have another solution? Since I do not always want to write the Subs for each query.
 
Last edited:
Upvote 0

marcusschwertz

Member
Licensed User
Longtime User
Currently I use a recordset and when I use HttpUtils2 I would have to rewrite all my code. The problem is that I can not be higher than 8 set the SDK version when I work with Recordset
 
Upvote 0

marcusschwertz

Member
Licensed User
Longtime User
I'm using MySQL and I have tried in the above code in the sub "blbub" to stay up as long as the result is come. So I can return it in the Sub "blbub"
Why i can´t use HttpUtils 2 in code module classes?
 
Upvote 0
Top