Region Project Attributes
#MainFormWidth: 600
#MainFormHeight: 400
#AdditionalJar: sqlite-jdbc-3.7.2
#End Region
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private TableView1 As TableView
Dim ASUtils As ApacheSU
Dim SQL1 As SQL
Dim n As Long = DateTime.Now
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("Main")
MainForm.SetFormStyle("UTILITY")
MainForm.Title = "B4J HowTo Test"
MainForm.Show
SQL1.InitializeSQLite(File.DirApp & "\SQL_Datenbank\","Schlaf_gut_Test.db", True)
SQL1.ExecNonQuery("CREATE TABLE IF NOT EXISTS BRP (Datum_Aufzeichnung Text, Datum TEXT, Uhrzeit TEXT, Plus_Zeit Text, Flow_Rate Text, Mask_Pressure Text)")
AppInit
' Daten_To_DB
End Sub
'Init controls, settings etc.
Sub AppInit
FillTableView
End Sub
Sub FillTableView
Dim DB_Daten(3) As String
Dim su As StringUtils
Dim l As List
Dim csvString As String
Dim csVArray() As String
csvString = File.ReadString(File.DirApp , "BRP.txt")
csVArray = ASUtils.SplitWithSeparator(csvString,",")
Log(csVArray.Length)
For i = 0 To csVArray.Length- 1 Step 3
SQL1.AddNonQueryToBatch("INSERT INTO BRP VALUES (?,?,?,?,?,?)", Array As Object("1", "2", "3",csVArray(i) ,csVArray(i+1) , csVArray(i+2)))
Next
SQL1.ExecNonQueryBatch("Query")
Log((DateTime.Now - n)/1000) 'ms
'SQL1.Close
End Sub
'Close the app - add any specifics here
Sub AppClose
MainForm.Close
End Sub
'Handle form closing via system close (top right X button)
Sub MainForm_CloseRequest (EventData As Event)
AppClose
End Sub
Sub Query_NonQueryComplete(success As Boolean)
Log(success)
Log(((DateTime.Now - n)/1000))
End Sub