Save scrapbook items etc. in database?

Previous topic - Next topic

goto_coder

While I was trying to find a way to fix bug 14030 I noticed that the code for the scrapbookpalette seems to contain a considerable amount of boilerplate code for managing storage of scrapbook items (e.g. thumbnails, object data, file names, ...). And I started wondering if it could be a good idea to use a database engine to do this.

Bug 14030 for instance seems to be caused by the need to find a unique filename for an item whose name is already present in the scrapbook. The problem is that the internal object name is used as a kind of 'primary key' for storing the object in the scrapbook. If the items were saved to a database, the name could simply be inserted into a field 'name' and the respective table's primary key would ensure that each entry can be identified uniquely. This approach could simplify or streamline the handling of basically any situation where Scribus needs to save some object to a collection and retrieve it in another session.

I'm sure the developer's of Scribus would rather refrain from adding more dependencies to the project. But there's Sqlite3 for example which is claimed to be self-contained and can be integrated to a project by means of a single (large) C source file. So the cost of adding this as a dependency could be just low enough.
Also, Qt seems to have a builtin SQL module that works with a variety of database systems. So the project would not depend to much on a single database engine, as long as the Qt interface is used to communicate with the database.

The downside of a database would be that you can't just look into the ~/.scribus directory and tweak things to your liking. But that's something that will only concern 'power users'. And a power user might as well just use an SQL shell for tweaking if they desire to do so. :-)

So my proposal basically is this: Introduce a database engine like Sqlite to the project for storing and managing collections (scrapbook, symbols, ...) across sessions. Use the Qt builtin SQL functionality for accessing the database.

I just started out working with the Scribus code, so please excuse me if I overlooked something and proposed a silly idea. But it was stuck in my head for a few days now and I thought why not just ask for another opinion.