ciao ragazzi,
che mi spiega l'uso e l'utilità dei vari callsub .. callsub2... callsubdelayd.. ecc.
possibilmente con esempi in B4J
che mi spiega l'uso e l'utilità dei vari callsub .. callsub2... callsubdelayd.. ecc.
possibilmente con esempi in B4J
Sub RoutinePrincipale
log(1)
CallSubDelayed(Me, "RoutineSecondaria") ' Me se RoutineSecondaria è nello stesso modulo
log(2)
End Sub
Sub RoutineSecondaria
log(3)
End Sub
CallSubDelayed2(Me, "Visualizza", "Ciao") ' oppure CallSub2
'''''
Sub Visualizza(Parola As String)
CallSubDelayed3(Me, "Somma", 50, 25)
'''
Sub Somma(A As Int, B As Int)
CallSubDelayed2(Me, "VisualizzaTutto", Array As Object(1,"ciao",2))
'''''
Sub VisualizzaTutto(Dati() As Object)
For i = 0 To Dati.Length - 1
Log(i & TAB & Dati(i))
Next
End Sub
Dim Reader As TextReader
Reader.Initialize(File.OpenInput(PathLocale, NomeFile))
Dim line As String
Try
Main.sqlt.BeginTransaction
line = Reader.ReadLine
Do While line <> Null
Main.sqlt.ExecNonQuery(line)
line = Reader.ReadLine
Loop
Reader.Close
Main.sqlt.TransactionSuccessful
Catch
Log(LastException.Message)
End Try
ops, non esiste nulla del genere? peccato.....in B4J non esiste DoEvents
Main.sqlt.ExecNonQuery(line)
Main.sqlt.AddNonQueryToBatch(line,Null): 'qui è velocissimoooooooo!
Dim now As Long
now = DateTime.Now
Log(DateTime.Time(now)):'visulizza orario di inizio "update"
sql1.ExecNonQueryBatch("SQL"):' come se eseguisse TUTTE le query in background o servizio
...
...
...
Sub SQL_NonQueryComplete (Success As Boolean)
If Success=True Then
Dim now As Long
now=DateTime.Now
Log(DateTime.Time(now)):'visulizza orario di fine "update"
Else
Log("ERRORE")
Log(LastException)
End If
End Sub
AddNonQueryToBatch (Statement As String, Args As List)
Adds a non-query statement to the batch of statements.
The statements are (asynchronously) executed when you call ExecNonQueryBatch.
Args parameter can be Null if it is not needed.
Example:
For i = 1 To 10000
sql1.AddNonQueryToBatch("INSERT INTO table1 VALUES (?)", Array As Object(Rnd(0, 100000)))
Next
sql1.ExecNonQueryBatch("SQL")
...
Sub SQL_NonQueryComplete (Success As Boolean)
Log("NonQuery: " & Success)
If Success = False Then Log(LastException)
End Sub
che sudata!!!!Se non sbaglio, potresti intanto leggere tutte le query dal file di testo usando:
Dim lstQueries As List = File.ReadList(...)