I would like to access the database of the *Pedias outside of the GUI. I'm talking about the "Database.pediadata" file that is stored in the Library/Applications Data/???pedia directory.
I know this is an sqlite3 database, and most of the fields in the tables are simple text fields, so most accesses are fine. However, in some tables, the ZCOLLECTIONS table in particular, there are a couple of BLOBs. One of them looks to be a BLOB for a Cocoa object that I'm guessing holds the information needed to create and maintain a "Smart Collection".
Is Bruji comfortable sharing this information with any 3rd parties that might want to develop utilities on top of the *pedias?
accessing fields in the database outside of *pedia
-
- Contributor
- Posts: 6
- Joined: Mon Dec 28, 2009 11:34 am
Re: accessing fields in the database outside of *pedia
We are comfortable sharing the information, we want the data to be as open as can be. You are correct that they few BLOB objects are internal information that was easier to store that way. For example the smart collection rules your trying to access are stored as NSPredicates (this way we can use them directly in Core Data without any translation). To read them outside of the Pedias you will have to still use Cocoa to make things simple. The code you would need is as follows:
Then with the NSPredicate you could ask it for predicateFormat and get the actual rules in English. However, without Cocoa I am not sure how you would go about translating the raw binary that is stored in the BLOB, since as you can see we let Cocoa take care of that.
If your looking to add functionality into the Pedias consider our plug-in architecturethat might fit your needs.
Code: Select all
NSData * theBLOBvalue = Add the raw value of the BLOB here.
if (theBLOBvalue) {
NSPredicate *aPredicate = [NSKeyedUnarchiver unarchiveObjectWithData: theBLOBvalue];
}
Then with the NSPredicate you could ask it for predicateFormat and get the actual rules in English. However, without Cocoa I am not sure how you would go about translating the raw binary that is stored in the BLOB, since as you can see we let Cocoa take care of that.
If your looking to add functionality into the Pedias consider our plug-in architecturethat might fit your needs.