Android Question multiplatform data base code

developer_123

Active Member
Licensed User
Longtime User
I want to know if there is any code multiplatform to use data base ( for example .db) . I'm was searching inside the forums and, for each platform I found diferents codes, is say all can use sqlite but each one with a diferent library (I'm not found b4x SQLite library), and the only common that I found is the b4xtable, but this is only for a just one table. Someone can tell me if exist any metod or b4x library that can be use databases with the same code estructure to use in B4a, B4i and B4J.

Thanks!



I appreciate your comments!
 

aeric

Expert
Licensed User
Longtime User
The SQL library for 3 platforms are equivalent. They are just name differently as SQL, iSQL and jSQL.

 
Upvote 0

developer_123

Active Member
Licensed User
Longtime User
Aeric thanks! initially I was conffused because in B4A works the variable Cursor but in b4J and B4i works with ResultSet, and I thought the same would happen with all others commands, but testing I realized that this have the same properties betwen three platforms
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
Aeric thanks! initially I was conffused because in B4A works the variable Cursor but in b4J and B4i works with ResultSet, and I thought the same would happen with all others commands, but testing I realized that this have the same properties betwen three platforms
Cursor is still supported (in B4A only) if I am not mistaken. As Erel suggested, we should use Resultset instead so the code can be shared among the 3 platforms.
 
Upvote 0

developer_123

Active Member
Licensed User
Longtime User
It is also possible to include the following code for the declaration and thus be able to use it on the 3 platforms:

B4X:
    #if b4a
    Dim Cursor1 As Cursor
    #else
    Dim Cursor1 As ResultSet
    #end if

but is better use the same declaration ResultSet, not to be confused.
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
It is also possible to include the following code for the declaration and thus be able to use it on the 3 platforms:

B4X:
    #if b4a
    Dim Cursor1 As Cursor
    #else
    Dim Cursor1 As ResultSet
    #end if

but is better use the same declaration ResultSet, not to be confused.
If you use Resultset then you don't need this.
Just write something like this:
B4X:
Dim Res As ResultSet
 
Upvote 0
Top