MoneyWorks Manual
Sqlite3_Open (databaseName)
Result Type: sqlite connection handle
Definition: Opens a connection to a new pr existing sqlite3 database. This will be completely separate form the MoneyWorks database, but you can use it to access or store any information your script needs to.
You can: create and use temporary in-memory sqlite databases in MWScript for data analysis and tabulation (as a more powerful alternative to TableAccumulate etc); create and/or open local sqlite databases from MWScript on a MoneyWorks client for storing client-local data, or for importing data from a sqlite.db; create and use shared sqlite databases that reside on a MoneyWorks Datacentre server and access the data from all MoneyWorks clients. This allows MWScript to be used to create bespoke databases and user interfaces for them within MoneyWorks
Using Sqlite3_Open("filename.db")
will open an existing—or create a new—database file in the Automation Files/Sqlite directory of the MoneyWorks client. Using Sqlite3_Open("/full/path/to/filename.db")
will open an existing—or create a new—database file on the local client, provided that the path is allowed by the safe scripting paths in the app preferences. You can call Sqlite3_Open
on the same file more than once to get additional connections to the database file (this might happen if different scripts access the same database for example). You need to close each handle thus allocated when you are finished with it.
Using Sqlite3_Open("shared:filename.db")
or Sqlite3_Open("shared-public:filename.db")
will open an existing—or create a new—database file in the MoneyWorks Custom Plugins/Sqlite directory on the MoneyWorks Datacentre Server (or, if you are not connected to a server, in the MoneyWorks Custom Plugins/Sqlite directory for the MoneyWorks file you have open (this mode will fail if running a MWScript outside of a MoneyWorks document). All MoneyWorks files that share the custom plugins folder can access the same .db file. Using Sqlite3_Open("shared-private:filename.db")
will open an existing—or create a new—database file in the MoneyWorks Custom Plugins/Pictures/company-name/Sqlite directory on the MoneyWorks Datacentre Server (or, if you are not connected to a server, in the MoneyWorks Custom Plugins/Pictures/company-name/Sqlite directory for the MoneyWorks file you have open. Only that company file will have access to such .db files. Note that in this case the sqlite .db will be backed up with the Pictures folder (may be a separate backup depending on server prefs).
For more information see Using Sqlite3 with MoneyWorks and https://www.sqlite.org/