mirror of
https://github.com/KeymonSoft/Android_durakelo.git
synced 2026-04-17 19:37:03 +00:00
8/11/23 - Cambios en DBRequestManager y JobDone.
- Cambios para que mande mas informacion al log cuando se carga día.
This commit is contained in:
@@ -4,9 +4,7 @@ ModulesStructureVersion=1
|
||||
Type=Class
|
||||
Version=6.8
|
||||
@EndOfDesignText@
|
||||
'Necesita la libreria RandomAccessFile
|
||||
|
||||
'Class module
|
||||
''Class module
|
||||
Sub Class_Globals
|
||||
Private mTarget As Object
|
||||
Type DBResult (Tag As Object, Columns As Map, Rows As List)
|
||||
@@ -17,7 +15,8 @@ Sub Class_Globals
|
||||
,T_DOUBLE = 6, T_BOOLEAN = 7, T_BLOB = 8 As Byte
|
||||
Private VERSION As Float = 0.9
|
||||
Private tempArray(1) As Object
|
||||
Dim jobTagAnterior As String = "" 'Mod por CHV - 211027
|
||||
Dim jobTagAnterior As String = "" 'Mod por CHV - 211109
|
||||
Dim reqsList As List
|
||||
End Sub
|
||||
|
||||
'Target - The module that handles JobDone (usually Me).
|
||||
@@ -25,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.
|
||||
@@ -35,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)
|
||||
@@ -61,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
|
||||
|
||||
@@ -188,7 +190,7 @@ End Sub
|
||||
|
||||
'Handles the Job result and returns a DBResult.
|
||||
Public Sub HandleJob(Job As HttpJob) As DBResult
|
||||
Dim start As Long = DateTime.Now
|
||||
Dim start As Long = DateTime.Now 'ignore
|
||||
Dim In As InputStream = Job.GetInputStream
|
||||
Dim cs As CompressedStreams
|
||||
In = cs.WrapInputStream(In, "gzip")
|
||||
@@ -199,8 +201,8 @@ Public Sub HandleJob(Job As HttpJob) As DBResult
|
||||
table.Columns.Initialize
|
||||
table.rows.Initialize
|
||||
table.Tag = Job.Tag
|
||||
If jobTagAnterior <> Job.Tag Then LogColor("HandleJob: '"&Job.Tag&"'", Colors.Blue) 'Mod por CHV - 211023
|
||||
jobTagAnterior = Job.Tag 'Mod por CHV - 211023
|
||||
If jobTagAnterior <> Job.Tag Then LogColor("HandleJob: '"&Job.Tag&"'", Colors.Blue) 'Mod por CHV - 211109
|
||||
jobTagAnterior = Job.Tag 'Mod por CHV - 211109
|
||||
If method = "query" Then
|
||||
Dim numberOfColumns As Int = ReadInt(In)
|
||||
For i = 0 To numberOfColumns - 1
|
||||
@@ -222,7 +224,7 @@ Public Sub HandleJob(Job As HttpJob) As DBResult
|
||||
Next
|
||||
End If
|
||||
In.Close
|
||||
' Log("HandleJob: " & (DateTime.Now - start))
|
||||
' Log("HandleJob: " & (DateTime.Now - start))'Comentado por CHV - 211112
|
||||
Return table
|
||||
End Sub
|
||||
'Reads a file and returns the file as a bytes array.
|
||||
@@ -234,7 +236,6 @@ Public Sub FileToBytes(Dir As String, FileName As String) As Byte()
|
||||
out.Close
|
||||
Return out.ToBytesArray
|
||||
End Sub
|
||||
|
||||
'Converts an image to a bytes array (for BLOB fields).
|
||||
Public Sub ImageToBytes(Image As Bitmap) As Byte()
|
||||
Dim out As OutputStream
|
||||
@@ -243,7 +244,6 @@ Public Sub ImageToBytes(Image As Bitmap) As Byte()
|
||||
out.Close
|
||||
Return out.ToBytesArray
|
||||
End Sub
|
||||
|
||||
'Converts a bytes array to an image (for BLOB fields).
|
||||
Public Sub BytesToImage(bytes() As Byte) As Bitmap
|
||||
Dim In As InputStream
|
||||
@@ -252,7 +252,6 @@ Public Sub BytesToImage(bytes() As Byte) As Bitmap
|
||||
bmp.Initialize2(In)
|
||||
Return bmp
|
||||
End Sub
|
||||
|
||||
'Prints the table to the logs.
|
||||
Public Sub PrintTable(Table As DBResult)
|
||||
Log("Tag: " & Table.Tag & ", Columns: " & Table.Columns.Size & ", Rows: " & Table.Rows.Size)
|
||||
|
||||
@@ -73,6 +73,6 @@ ModuleClosedNodes6=
|
||||
ModuleClosedNodes7=
|
||||
ModuleClosedNodes8=
|
||||
ModuleClosedNodes9=2,5,6,8,10,11,12,13,22,24,36,37
|
||||
NavigationStack=Starter,Process_Globals,17,0,Tracker,StartFLP,85,0,Main,Activity_Resume,191,0,Main,ListView1_ItemClick,527,0,Main,B_SERVER_Click,509,0,Main,B_FECHA_Click,521,0,Main,ImageView4_Click,506,0,DBRequestManager,HandleJob,195,0,seleccion,JobDone,1801,2,seleccion,connecta_Click,2009,0,MAPA_RUTAS,MapFragment1_Ready,136,0
|
||||
NavigationStack=Main,ImageView4_Click,506,0,DBRequestManager,HandleJob,195,0,seleccion,connecta_Click,2009,0,MAPA_RUTAS,MapFragment1_Ready,135,0,DBRequestManager,Initialize,20,0,DBRequestManager,PrintTable,267,0,DBRequestManager,Class_Globals,12,0,seleccion,Subir_Click,862,0,seleccion,JobDone,1105,6,seleccion,cargar_Click,924,5
|
||||
SelectedBuild=0
|
||||
VisibleModules=21,20,12,4,5,9,8,24,6,14
|
||||
|
||||
@@ -928,6 +928,8 @@ Sub cargar_Click
|
||||
c.Position = 0
|
||||
usuario = c.GetString("USUARIO")
|
||||
|
||||
reqManager.reqsList.Initialize 'inicializamos lista de requests.
|
||||
|
||||
Dim cmd As DBCommand
|
||||
cmd.Initialize
|
||||
cmd.Name ="insert_drop2_DUR"
|
||||
@@ -1101,7 +1103,16 @@ Sub cargar_Click
|
||||
ToastMessageShow("Se Actualizaran los datos, Este proceso podria tardar hasta un minuto, gracias" , True)
|
||||
End Sub
|
||||
Sub JobDone(Job As HttpJob)
|
||||
If Job.Success = False Then
|
||||
If reqManager.reqsList.IsInitialized Then 'Si tenemos lista de requests, la procesamos.
|
||||
LogColor($">>>>>> Llega "${Job.tag}""$, Colors.RGB(170, 174, 0))
|
||||
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
|
||||
' ToastMessageShow("Error: " & Job.ErrorMessage, True)
|
||||
'End If
|
||||
|
||||
Reference in New Issue
Block a user