I try to get through the demos and the manuals, but it´s difficult. Most of the demos crashing on start, i don´t know if there is any java-issue - but in fact they are not running ...
So i try to made it with the manuals - but this is also difficult. Example: sqlight
The manual describes on page 8 how to init
SQLite Databases Guide for Android, iOS, Java & Arduino / ESP8266 Programming (b4x.com)
So i try it in B4J
Ok, i´m wondering why there is no .eof at the resultset, but when i finaly come to the sql-syntax everything is fine.
The Manual says the init is different between b4j and b4a / i. I copy/past it, but i got an exeption in b4a... in b4j it works like expected. i have no idea why.
Fehlerbeschreibung: Array erwartet.
Fehler in Zeile: 21
sql1.Initialize(File.DirInternal("test"), "Test.db", True)
Word: (
The lib in b4j called jSQL, in b4a only SQL. Is it the same?
Regards
Matze
So i try to made it with the manuals - but this is also difficult. Example: sqlight
The manual describes on page 8 how to init
SQLite Databases Guide for Android, iOS, Java & Arduino / ESP8266 Programming (b4x.com)
So i try it in B4J
B4X:
Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Private sql1 As SQL
End Sub
Private Sub B4XPage_Created (Root1 As B4XView)
#if B4J
sql1.Initializesqlite(File.DirData("test") ,"Test.db",True)
#end if
#if B4A
sql1.Initialize(File.DirInternal("test"), "Test.db", True)
#end if
CreateTabIfNotExist("Test2","[Name] TEXT,[Ort] TEXT,[ID] INTEGER,PRIMARY KEY([ID] AUTOINCREMENT)")
sql1.ExecNonQuery("Insert into test2(name,ort) values('hugo egon','bochum')")
Dim resultset As ResultSet = sql1.ExecQuery("select * from test2 order by [name] asc")
Do While resultset.NextRow
Log(resultset.GetString("Name") & TAB & resultset.getstring("ort") & TAB & resultset.getint("id"))
Loop
Root = Root1
Root.LoadLayout("MainPage")
End Sub
Sub CreateTabIfNotExist(TabName As String, TabDefinition As String)
Dim resultSet As ResultSet = sql1.ExecQuery("select name from sqlite_master where type='table' and name='" & TabName & "'")
If resultSet.NextRow=False Then
Log("Tabelle " & TabName & " wird erzeugt..."): sql1.ExecNonQuery("Create Table [" & TabName & "] (" & TabDefinition & ")")
Else
Log("Tabelle " & TabName & " gefunden!")
End If
End Sub
Ok, i´m wondering why there is no .eof at the resultset, but when i finaly come to the sql-syntax everything is fine.
The Manual says the init is different between b4j and b4a / i. I copy/past it, but i got an exeption in b4a... in b4j it works like expected. i have no idea why.
Fehlerbeschreibung: Array erwartet.
Fehler in Zeile: 21
sql1.Initialize(File.DirInternal("test"), "Test.db", True)
Word: (
The lib in b4j called jSQL, in b4a only SQL. Is it the same?
Regards
Matze