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?
I hope that all makes sense.
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?
how many records are you estimating to need to be holding?
Perhaps an array of custom classes might suffice
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.
@Dave S I assume you mean in SQLite. The theoretical maximum for records would be 180.
I would not waste my time with a DB for 180 records that don’t need to “live” that long
What data type would you utilize? An array? I really only need to store a single value from each row.
yes… and if only a single value per row, I would most decidely not bother with the overhead of a DB
That’s fair, it does seem a little like trying to hunt with a Howitzer now that I think about it.
I’ve gone ahead and made the array a property of the dialog which I seem to be able to write to from the calling window.
Thank you both.