Im developing a web app and need an SQLite DB for a very short time. The process is relatively straightforward. We call to our database to fill a listbox with employee availability records, if the user wants to add dates, we pull the contents of the list box into SQLite and allow them to select a date range to add in a dialog. We loop through the chosen date range and compare the dates in the date range to the dates in SQLite. Any dates that are not in SQLite we write to our database and repopulate the listbox with another select call (just in case).
My question is about what the best practice is for creating the said database. Currently, I dim a folder item and create a database on the fly when the user clicks add and delete it when they cancel out or submit their new date range - it doesnt exist too long, and it is named in a manner that there shouldnt be conflicts. The idea of dimming an in-memory DB instead came up, but I am not sure if this is possible since we change focus to a dialog for date selection. Wouldnt the DB disappear due to falling out of the scope of the calling event?
Not if you keep the in-memory database in scope. Find a better place to store the variable. The best place for it depends entirely on your design, so I can’t make any suggestions other than don’t use a global module for it.
If the data I need to pull is in a listbox on window1 and the place where I need to utilize that data is in dialog1 which is a dialog on window1. Would it still be in scope or would I need to do something like make it a property of window1?
In a desktop app I would store the database as a property on the window, and pass the database to the sheet window for editing. Any changes to the database on the sheet window would reflect on the parent window because they’d both be using the same Database.
Web is funky though, so I’m not sure if the paradigm applies the same.