![]() Lastly, is it accurate that nothing in this single-user, multiple-tab scenario could ever be related to multiple threads and SQLite can be compiled without the thread-safe option?įirstly I think you need to differentiate between "database" (meaning a file stored on disk) and a "connection" to one or more "database files". Regardless of the number of instances of the C/SQLite program employed, if a user opens the same database in more than one tab and, if it were possible that one query could run long enough for the user to switch tabs and attempt to run a second query against the same database, is it still simply a matter of handling SQLITE_BUSY? If, instead, each tab has its own instance of the C program, should the loadable extensions be dynamically linked such that each instance can use the same separate library file, or is statically linking better since all will still be in one executable file? ![]() Is it okay/possible for one C program to maintain a set of SQLite database pointers and prepared statements in this manner? If loadable extensions that aren't part of the core SQLite are employed as statically linked, does having multiple databases cause an issue with the entry points in some manner? I don't really grasp how that works to know if sqlite3_auto_extension() can manage that in this scenario. That same ID could be used in a single instance of the C program to track which database each tab has open and build the prepared statements that will be used frequently by the extension for each database when it is first opened. Each tab has a unique ID, which is used by the background script to know which tab it is communicating with. ![]() There could be one instance for all tabs, just as there is only one background script for all tabs or each tab can a separate instance of the C/SQLite program. There are at least two possible ways to handle the native application. From the extension UI, the user can open the local HTML file in as many tabs as they desire and, in each tab, open the same or different SQLite databases, where each database is a collection of study modules built by users. Once the background script is informed that the main JS has successfully loaded, it requests a communication port with the C/SQLite program through the native-messaging API and, if it is not open, it opens it. To a novice like me, it is kind of impressive that it takes place so quickly. ![]() If the GUID is valid, the background script establishes the port and then injects a CSS file and the main JS script, which builds the UI and appends it to the body and POOF there it is. When the user loads the page, the background script injects a small content script into the page that grabs the GUID from the body element and passes it to background script in a request to establish a runtime communication port with it. ![]() The background script listens only for a specifically named, locally stored HTML file, which is an empty HTML "container" having an empty body element with a data attribute that is a GUID. The script listens for URL loads and when one matches the match pattern provided in the extension manifest, the script acts upon the page. The extension is installed in the browser, and the only active component of it is a background script that is associated with an empty, hidden background web page. The extension provides something termed a native-messaging API that facilitates communication between the browser extension and a locally stored application. I'm using a C program compiled with the SQLite amalgamation as a component of a web extension in place of the indexedDB API. At first, this may not sound like a SQLite-specific question but, ultimately, it is about how to handle multiple database connections and loadable extensions but I don't know how else to ask it without providing the boring background. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |