I have a database and a selection of modules which all want to access the database.
What is the correct or best method of doing so?
Should I ;
a) Define the database and cursors and initialise in the Main Module
then in each activity refer to the database initialised in Main
OR
b)
Initialise the database in each activity by the following process
close the database when calling another acttivity, re-open it in the next activity, manipulate data / user requests etc
close the database
exit the activity
go back to Main and initialise the database again for use there again
All comments suggestions etc are welcome
Joe
What is the correct or best method of doing so?
Should I ;
a) Define the database and cursors and initialise in the Main Module
B4X:
Dim SQL As SQL
Dim Cursor1 As Cursor
Sub Activity_Create(FirstTime As Boolean)
If FirstTime=True Then
SQL.Initialize(File.DirInternal, "database.db", True)
end if
then in each activity refer to the database initialised in Main
B4X:
Main.Cursor1 = Main.SQL.ExecQuery("SELECT Customer FROM Customers")
OR
b)
Initialise the database in each activity by the following process
close the database when calling another acttivity, re-open it in the next activity, manipulate data / user requests etc
close the database
exit the activity
go back to Main and initialise the database again for use there again
All comments suggestions etc are welcome
Joe