Wish [Cross-Platform] SQL Library Suggestions

LWGShane

Well-Known Member
Licensed User
Longtime User
With the existence of RDC, I'm suggesting the following for the SQL library:

- Replace "InitializeSQLite" with "Initialize" and remove the MySQL functions. (So the libraries do the same thing across B4A, B4i, and B4J.)
- Rename all SQL libraries to B4XSQLite
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
B4J jSQL library can work with any database that provides a JDBC driver (all popular databases). There isn't any method specific to MySQL.
The only method specific to a single db engine is InitializeSQLite. It has two purposes:
1. To make it easier to work with SQLite database which is a common database.
2. It allows SQLite databases to be accessed concurrently: https://www.b4x.com/android/forum/t...ent-access-to-sqlite-databases.39904/#content

Other than that the library is cross platform compatible.
 

LWGShane

Well-Known Member
Licensed User
Longtime User
I have a solution that would satisfy both of us. (These wouldn't require any code-base changes or removal of features.)

- Rename "Initialize" and "Initialize2" to "InitializeWithDriver" and "InitializeWithDriver2", respectively.
- Rename "InitializeSQLite" to "Initialize". (Would allow for easier code portability.)

I do understand that the library is cross-platform compatible, I was talking about code portability.

Ex:

Instead of this:

B4X:
Dim SQL As SQL
#If B4J
SQL.InitializeSQLite("","")
#Else
SQL.Initialize("","")
#End If

You could have this:
B4X:
Dim SQL As SQL
SQL.Initialize("","")

If you need to use another database:
B4X:
Dim SQL As SQL
SQL.InitializeWithDriver("", "") 'No Auth Required
SQL.InitializeWithDriver2("","","","") 'Auth Required

Thus you wouldn't need to use the conditional statements to determine the IDE.
 

jmon

Well-Known Member
Licensed User
Longtime User
Replace "InitializeSQLite" with "Initialize"
for your info, you can initialize Sqlite this way:
B4X:
Dim SQL As SQL
Dim dbPath As String = File.Combine(File.DirApp, "temp3.db")
SQL.Initialize("org.sqlite.JDBC", "jdbc:sqlite:" & dbPath)
 
Top