kexi project
Rapid Database Application Development
Development
"Microsoft Access for Linux"

Home Download FAQ Support Features Handbook Screenshots Screencasts Compile Kexi Development Authors Contact License Sponsorship Translate This Site

wiki navigation:

Front Page
[info] [diff] [login]
[recent changes]
[most popular]
You can donate
to Kexi Project:
Via PayPal

Spread the word about Kexi!
Get Kexi Now!

Built on the KDE technology
KDE

Member of the Calligra Suite

No Software Patents!

FrontPage/Kexi Core Design

Kexi Mime Types, Data/Project Saving and Loading

Table of Contents
   1. Kexi project file extensions
     1.1. Shortcut to a Kexi project on a database server
     1.2. Binary format with Kexi meta information (engine inherited from SQLite)
   2. Other file formats/extensions
     2.1. Data for Database Server Connection
   Implementation
   3. Stored list of connection data
   4. Stored information about recent objects
     4.1. Recently Opened Databases (Projects)
     4.2. Recently Connected Database Servers

started: 2003-10-18, js

1. Kexi project file extensions

We can still using single ".kexi" file extension. Kexi can distinguish between what to do with a file, reading its few first bytes from contents, although only KDE newer than 3.1 can be forced to always recognize mime types by file contents. While it is easy to check what is real file format by its contents from Kexi code, it can be hard to ensure that appropriate type information is shown in e.g. Konqueror (not mentioning GNOME or win32 filemanager). So, for compatibility (also with less flexible systems like win32 or macosx) we have forked to more extensions.

All valid file formats that can be currently encountered are described below.

^ toc

1.1. Shortcut to a Kexi project on a database server

Implemented

Ini-like file format for representation of connection data. It is enough info for Kexi that existing Project can be opened. So this is something like a shortcut for a project. For projects stored remote databases it is very useful to have such minimal portion of information stored somewhere.
We're now talking only about remote connections (or a one to the localhost), but it can be later specified that connection data can also point to, say, to a .kexi project file.
All work for reopening connection defined by .kexis file is already handled by KexiDB module (except simple conversion ini-file -> KexiDB:: ConnectionData).
Format description:
 MimeType: application/x-kexiproject-shortcut
 Comment: Shortcut to Kexi Project on Database Server
 File extensions: .kexis or .KEXIS ('s' as in Shortcut)

See also: Startup Options/Using .KEXIS shortcut files

 Specification proposal is now commited to freedesktop.org
 1. Justification
 A format named in general "Shortcut to a database connection data/data source"
 allows a user to store in a simple ini-file-like format. There is no single
 well known format for this.
 2. Usage scenario
 2.1. A file containing data compatible with the format can be kept by a user,
 who can pass the filename to an application to avoid entering all the
 information again.
 2.2. Within desktop system, there can be associated filename extension with
 the file format, so a user can simply click the file to open connetion with
 default application.
 2.3. User can decide to send the mentioned file, e.g. using e-mail, to allow
 connections.
 3. Advantages
 The data structure stored using the format is quite linear, so we've
 succesfully avoided using XML, hence the format is human readable.
 4. Other notes:
 - Security: storing passwords is optional. Integration with password managers
 (like KWallet) is beyond the scope of this specification.
 - The format can be also used to store files containing "recent connections'
 data" at user will. For this we may want to agree on a recommended subdirectory
  for saving such files within $HOME directory.
 - While the format is proposed as implementation-neutral, it is already
 implemented in Kexi and there are planse to reuse it within other
 database-related projects.
 - Further plans include integration with ODBC/JDBC connection data.
 - Formal specification will be provided later, for now I am asking for comments
 5. Example file with comments:
 http://websvn.kde.org/trunk/koffice/kexi/tests/startup/testdb.kexis?view=markup
^ toc

1.2. Binary format with Kexi meta information (engine inherited from SQLite)

On opening a file Kexi will lookup the file's mimetype (giving a higher priority to magic mime detection, before detection-by-extension).
Kexi will ask KexiDB::DriverManager to lookup the driver name for given mime type. DriverManager do that using KTrader and "X-Kexi-DBFileMime" field of .desktop files. It return valid driver's name if found or null if not found. Then Kexi can fill 'name' properly in its connection data structure and then try to open a connection.
If no valid results was returned in both steps above, nothing more can be done - user is informed that database is in unknown format (also shows error message returend from drivermanager, if any).
Format description:
 MimeType: application/x-kexiproject-sqlite
 Comment: Kexi Database File-based Project
 File extensions: .kexi
^ toc

2. Other file formats/extensions

For the end user's convenience not only above mentioned mimetypes should be available. It's usable to have:

^ toc

2.1. Data for Database Server Connection

After executing (clicking) a file, connection will be established using a data saved in the file; then, for this connection, user will be able to:

  • select one of available databases (projects) to open, or
  • create a new database using this connection, or
  • delete one of available databases (projects)

This format just is a special version of .KEXIS, it just lacks of "database name" field.

Format description:
 MimeType: application/x-kexi-connectiondata
 Comment: Data for Database Server Connection
 File extensions: .kexic
^ toc

Implementation

  • Startup dialog by jstaniek
  • Shortcut to database connection and dialogs by jstaniek
^ toc

3. Stored list of connection data

Location: ~/.kde/share/apps/kexi/connections/, in general, all dirs returned by

 KStandardDirs::findDirs("data", "connections")

will be looked up. Format: connections/ directory (directories) can contain a number of .KEXIC files (see above).

User can add, edit and remove these connections, either by using Kexi GUI (ad/edit/remove butons in a connection-selection wizard's page) or by adding/editing/removing files directly.

Security: On creation, connections/ directory permissions will be set to rwx------ (0700). Every file's permissions inside it will be set to rw------- (0600).

^ toc

4. Stored information about recent objects

We have extended original idea of "recent documents", by distingishing between recent database projects and recent connections. The list is dynamically managed as two FIFO queues (on every database/connection opening within Kexi).

Location: ~/.kde/share/apps/kexi/recent/, in general, all dirs returned by

 KStandardDirs::findDirs("data", "recent")

will be looked up. Format: recent/ directory (directories) can contain a number of .KEXIS files (for database information) and .KEXIC files (connection data), see above for info about these files.

A simple mockup for "open recent" submenu:

Generally, we're deeply copying infromation about a recently opened databases/connections. This means that if a connection information has been edited, copied data is not updated. This is however how "open recent" data works even for regular files: moving them outside an application leads to dangling reference. The advantage of the solution is that we have developed a consistent way of storing information about database locations/connection data: all is stored as a list of files. Sorting is preserved thanks to file's modification time.

Security: On creation, recent/ directory permissions will be set to rwx------. Every file's permissions inside it will be set to rw------- on creation. Passwords, if any, will be removed from .KEXIS and .KEXIC files, so passwords can only be stored if a user explicity defined database connection (see 3.).

^ toc

4.1. Recently Opened Databases (Projects)

A unique list of Kexi db projects recently opened. For file-based db projects, simplified URL is displayed. For db projects accessed via network connections, a db name and a server is displayed using KexiDB::ConnectionData::serverInfoString().

Depending on how infromation about database was obtained, following cases are possible:

  • If a db file has been opened by providing an URL to this file: the URL is stored in a newly created .KEXIS file pointing to the URL.
  • If a db has been opened by providing an URL to .KEXIS file: the file is copied to recent/ dir. Thus even after removing
^ toc

4.2. Recently Connected Database Servers

A unique list of Kexi db connections a user has recently connected with.



Kexi - "MS Access for Linux" ... and Windows
© Kexi Team
This content is available under GFDL
Last edited: January 3, 2007 by js, visited 0 times.