29th April 2020
In SQL Datamodel For J-Pilot I described the SQLite datamodel. I wrote a J-Pilot plugin which can export the below entities and write them to an SQLite database file. The direction is one-way: from J-Pilot to SQLite.
Adding more entities is pretty easy. For example, if people need the Calendar Palm database exported, this can be implemented quickly. We use the usual SQLite API with sqlite3_exec()
, and sqlite3_prepare()
, sqlite3_bind()
, sqlite3_step()
, and finally sqlite3_finalize()
.
The general mechanics of a J-Pilot plugin are described by Judd Montgomery, the author of J-Pilot, in this document. I took the Expense/expense.c
source code from the Expense plugin as a guide.
The plugin provides the following functionality:
jptables.db
If you call jpilot -d
then debug-mode is activated.
Installation.
jpsqlite.c
.so
file) in plugin directory ($HOME/.jpilot/plugins
)jptables.sql
into plugin directoryCompilation is with below command:
gcc `pkg-config -cflags-only-I gtk+-2.0` -I <J-Pilot src dir> -s -fPIC -shared jpsqlite.c -o libjpsqlite.so -lsqlite3
For this to work you need the Pilot-Link header files and the J-Pilot (AUR) source code at hand.
Running the plugin: go to the plugins menu by main-menu selection or function key (F7 in my case), then press SQL button. All previous data is completey erased in the database, then all data is written to database within a single transaction.
In debug mode and in debug mode only, the "J-Pilot search" also searches through all entities in the SQLite database.
The long-term goal is that SQLite is the internal data structure for J-Pilot, thereby abandoning the binary files entirely.
Categories: C / C++, J-Pilot
Tags:
Author: Elmar Klausmeier