8/11/23 - Cambios en DBRequestManager

This commit is contained in:
2023-11-08 13:55:27 -06:00
parent ed1e2b5a34
commit 326c0e7d7b
3 changed files with 18 additions and 7 deletions

View File

@@ -833,8 +833,15 @@ End Sub
Sub JobDone(Job As HttpJob)
' LogColor("JobDone: "&Job.Tag & " Success:" & Job.Success , Colors.Magenta) ' Mod by CHV - 211116
If inicioContador = "" Then inicioContador = 0
If Job.Success = False Then
If logger Then LogColor("** " & Job.Tag & " Error: " & Job.ErrorMessage, Colors.Red) ' Mod by CHV - 211116
If reqManager.reqsList.IsInitialized Then 'Si tenemos lista de requests, la procesamos.
If reqManager.reqsList.IndexOf(Job.tag) <> -1 Then
reqManager.reqsList.RemoveAt(reqManager.reqsList.IndexOf(Job.tag))
' LogColor($">>>>>> Quitamos ${Job.tag}"$, Colors.Blue)
End If
LogColor(">>>>>> " & reqManager.reqsList.Size & " - " & reqManager.reqsList, Colors.Blue)
End If
If Not(Job.Success) Then
LogColor("Error: " & Job.tag & " : " & Job.ErrorMessage, Colors.red)
If Job.ErrorMessage = "STREAM" Then
contador_strem = contador_strem +1
If CARGA = "SUBIR" Then

View File

@@ -16,6 +16,7 @@ Sub Class_Globals
Private VERSION As Float = 0.9
Private tempArray(1) As Object
Dim jobTagAnterior As String = "" 'Mod por CHV - 211109
Dim reqsList As List
End Sub
'Target - The module that handles JobDone (usually Me).
@@ -23,6 +24,7 @@ End Sub
Public Sub Initialize (Target As Object, ConnectorLink As String)
mTarget = Target
link = ConnectorLink
reqsList.Initialize
End Sub
'Sends a query request.
@@ -33,7 +35,8 @@ Public Sub ExecuteQuery(Command As DBCommand, Limit As Int, Tag As Object)
Dim j As HttpJob
Dim ms As OutputStream
Dim out2 As OutputStream = StartJob(j,ms, Tag)
If reqsList.IsInitialized Then reqsList.Add(Tag)
WriteObject(Command.Name, out2)
WriteInt(Limit, out2)
WriteList(Command.Parameters, out2)
@@ -59,6 +62,7 @@ End Sub
'Similar to ExecuteBatch. Sends a single command.
Public Sub ExecuteCommand(Command As DBCommand, Tag As Object)
If reqsList.IsInitialized Then reqsList.Add(Tag)
ExecuteBatch(Array As DBCommand(Command), Tag)
End Sub
@@ -113,7 +117,7 @@ Private Sub WriteObject(o As Object, out As OutputStream)
Else If GetType(tempArray(0)) = "[B" Then
data = o
out.WriteBytes(Array As Byte(T_BLOB), 0, 1)
WriteInt(data.Length, out)
WriteInt(data.Length, out)
Else 'If o Is String Then (treat all other values as string)
out.WriteBytes(Array As Byte(T_STRING), 0, 1)
data = bc.StringToBytes(o, "UTF8")

View File

@@ -57,7 +57,7 @@ ModuleBreakpoints9=
ModuleClosedNodes0=
ModuleClosedNodes1=
ModuleClosedNodes10=
ModuleClosedNodes11=
ModuleClosedNodes11=1,3,4
ModuleClosedNodes12=
ModuleClosedNodes13=
ModuleClosedNodes14=
@@ -82,6 +82,6 @@ ModuleClosedNodes6=
ModuleClosedNodes7=
ModuleClosedNodes8=
ModuleClosedNodes9=
NavigationStack=DBRequestManager,HandleJob,193,0,DBRequestManager,ReadByte,179,0,B4XMainPage,ImageView4_Click,531,1,Starter,Service_Create,69,0,C_Cliente,B4XPage_Created,374,0,C_Cliente,GPS_LocationChanged,746,6,C_Cliente,Class_Globals,291,0,Diseñador Visual,cliente.bal,-100,5,C_Cliente,B4XPage_Appear,436,6
NavigationStack=B4XMainPage,ImageView4_Click,531,1,Starter,Service_Create,69,0,C_Cliente,B4XPage_Created,374,0,C_Cliente,GPS_LocationChanged,746,6,C_Cliente,Class_Globals,291,0,C_Cliente,B4XPage_Appear,436,6,DBRequestManager,ExecuteQuery,30,0,DBRequestManager,PrintTable,267,0,C_Principal,Class_Globals,0,0,C_Principal,cargar_Click,461,0,C_Principal,JobDone,837,0
SelectedBuild=0
VisibleModules=1,2,3,4,5,6,7,8,9,10,25,17
VisibleModules=1,2,3,4,5,6,7,8,9,10,17,11