F Firpas Active Member Licensed User Longtime User Sep 10, 2018 #1 Hi to everybody I've found this post about this cuestión: https://www.b4x.com/android/forum/t...ent-access-to-sqlite-databases.39904/#content - Use a single SQL object that is shared by all classes. Don't use a ConnectionPool with SQLite database. Click to expand... And i have a question about If my WebApp uses varius SQLite databases i must use a only one single sql object for all of then … or can i use one sql object for each one shared by all classes? Thanks in advance
Hi to everybody I've found this post about this cuestión: https://www.b4x.com/android/forum/t...ent-access-to-sqlite-databases.39904/#content - Use a single SQL object that is shared by all classes. Don't use a ConnectionPool with SQLite database. Click to expand... And i have a question about If my WebApp uses varius SQLite databases i must use a only one single sql object for all of then … or can i use one sql object for each one shared by all classes? Thanks in advance
EnriqueGonzalez Expert Licensed User Longtime User Sep 10, 2018 #2 Firpas said: Hi to everybody I've found this post about this cuestión: https://www.b4x.com/android/forum/t...ent-access-to-sqlite-databases.39904/#content And i have a question about If my WebApp uses varius SQLite databases i must use a only one single sql object for all of then … or can i use one sql object for each one shared by all classes? Thanks in advance Click to expand... One object per each database, Upvote 0
Firpas said: Hi to everybody I've found this post about this cuestión: https://www.b4x.com/android/forum/t...ent-access-to-sqlite-databases.39904/#content And i have a question about If my WebApp uses varius SQLite databases i must use a only one single sql object for all of then … or can i use one sql object for each one shared by all classes? Thanks in advance Click to expand... One object per each database,
F Firpas Active Member Licensed User Longtime User Sep 17, 2018 #4 Hi to everybody As i said in my last post, i have a webApp (B4j non UI App) that work with varius SQLite databases Code: Sub Process_Globals Public BD1 As SQL Public BD2 As SQL ... End Sub All Updates operations (Insert, Update and Delete) are made by Transaction (like this) Code: Sub LoginClear BD1.BeginTransaction Try BD1.ExecNonQuery("DELETE FROM LOGINS") BD1.TransactionSuccessful Catch Log(LastException) BD1.Rollback End Try End Sub And before stop the server, i close all the connections Code: Public Sub AppClose BD1.Close BD2.Close … ExitApplication End Sub But i have two questions: Must i do StopMessageLoop before ExitApplication? And what will happen if any user is updating any database when i stop de app? Thanks in advance Upvote 0
Hi to everybody As i said in my last post, i have a webApp (B4j non UI App) that work with varius SQLite databases Code: Sub Process_Globals Public BD1 As SQL Public BD2 As SQL ... End Sub All Updates operations (Insert, Update and Delete) are made by Transaction (like this) Code: Sub LoginClear BD1.BeginTransaction Try BD1.ExecNonQuery("DELETE FROM LOGINS") BD1.TransactionSuccessful Catch Log(LastException) BD1.Rollback End Try End Sub And before stop the server, i close all the connections Code: Public Sub AppClose BD1.Close BD2.Close … ExitApplication End Sub But i have two questions: Must i do StopMessageLoop before ExitApplication? And what will happen if any user is updating any database when i stop de app? Thanks in advance
Erel B4X founder Staff member Licensed User Longtime User Sep 18, 2018 #5 Firpas said: Must i do StopMessageLoop before ExitApplication? Click to expand... No. Firpas said: And what will happen if any user is updating any database when i stop de app? Click to expand... If the transaction was not committed then the data will be lost. If you are worried about this case then you can do something like: Code: Sub AppClose Main.ServerIsStopping = True Sleep(3000) BD1.Close BD2.Close ExitApplication End Sub You should check this flag value before you start updating the database. Upvote 0
Firpas said: Must i do StopMessageLoop before ExitApplication? Click to expand... No. Firpas said: And what will happen if any user is updating any database when i stop de app? Click to expand... If the transaction was not committed then the data will be lost. If you are worried about this case then you can do something like: Code: Sub AppClose Main.ServerIsStopping = True Sleep(3000) BD1.Close BD2.Close ExitApplication End Sub You should check this flag value before you start updating the database.
F Firpas Active Member Licensed User Longtime User Sep 18, 2018 #6 Thanks for your replay but ... Where is this flag value?? Attachments Sin título-1.png 13.5 KB · Views: 515 Sin título-2.png 7.4 KB · Views: 551 Sin título-3.png 14.1 KB · Views: 518 Upvote 0
F Firpas Active Member Licensed User Longtime User Sep 18, 2018 #7 Sorry for my clumsiness. Now I understand what you want to say, but ... there are many sites where databases are updated. I think I'd better set a parameter to block new incoming connections and wait until all users have logged out. This will be the time to stop the server without risk to the databases. Thank you very much for your cooperation regards Upvote 0
Sorry for my clumsiness. Now I understand what you want to say, but ... there are many sites where databases are updated. I think I'd better set a parameter to block new incoming connections and wait until all users have logged out. This will be the time to stop the server without risk to the databases. Thank you very much for your cooperation regards
OliverA Expert Licensed User Longtime User Sep 18, 2018 #8 Firpas said: wait until all users have logged out. Click to expand... I hope you include timing out people, else you might wait for quite awhile . I've had plenty of cases where folks just wander off, without ever logging out. Usually sites will post notifications of outages and if you just happen to be using them into that period, oh well. Plus, if it is a WebApp (traditional, not WebSocket), then it is also non-persistent and you can't be 100 percent sure if someone is actually, right at the moment, using your site (you can infer by keeping state server side, but that is all you can do). Upvote 0
Firpas said: wait until all users have logged out. Click to expand... I hope you include timing out people, else you might wait for quite awhile . I've had plenty of cases where folks just wander off, without ever logging out. Usually sites will post notifications of outages and if you just happen to be using them into that period, oh well. Plus, if it is a WebApp (traditional, not WebSocket), then it is also non-persistent and you can't be 100 percent sure if someone is actually, right at the moment, using your site (you can infer by keeping state server side, but that is all you can do).
F Firpas Active Member Licensed User Longtime User Sep 19, 2018 #9 Thanks for your suggestion but it is not a traditional web application. This application only answers data extracted and processed in JSON format. The client for this webapp is not an internet browser but rather a desktop application (B4J UI), in which all users must be registered to access it (private web), and its disconnection is also recorded. . Upvote 0
Thanks for your suggestion but it is not a traditional web application. This application only answers data extracted and processed in JSON format. The client for this webapp is not an internet browser but rather a desktop application (B4J UI), in which all users must be registered to access it (private web), and its disconnection is also recorded. .
KMatle Expert Licensed User Longtime User Sep 20, 2018 #10 This is the same as a Web App Just store a timestamp (last activity), log them out and close the connection. Upvote 0
This is the same as a Web App Just store a timestamp (last activity), log them out and close the connection.