writing an app that analyzes SQLite databases…
The idea is the user chooses a database, and supplies addtional information … HOWEVER, that addtional data is not, and cannot be stored in the original database .
I was thinking about storing that data in an XML file in the App Supp directory with a name like
BUT that could cause conflicts if the user has multiple databases across their system with the same name.
When the app starts, it asks for the user to choose a Database
it then looks for the associated meta file… if it finds one it uses it, it not it creates one
the app then uses both the database and this metafile to continue processing
Any idea how I can name/locate/associate the meta to the database without conflicts
Without storing something in the original db file I don’t see how you can ensure anything. Not sure if anything will be perfect since the user could change the db schema at any time. Putting something in Application Support with the file name is a start. Maybe have some sort of hash of the table/field names and if the user selects it and you have a file with the same name but the schema is different you can ask them if this is the same file and do they want to upgrade it.
I decided (per Norms suggestion) to use
let fileNum = attributes[FileAttributeKey(rawValue: "NSFileSystemFileNumber")] as! UInt64
this is a unique number stored in the macOS filesystem for every file. While it can be reused if the original is deleted that isn’t an issue in this app.
So if database “myDB.sql” has a Filenumber of 1234 then its meta data is stored in 1234.metadata