Data Structures | |
struct | PilotPack_s |
Packing function wrapper. More... | |
struct | PQExp_s |
struct | PQContext_s |
The pilot-qof context struct, extends qof_main_context. More... | |
Files | |
file | pilot-qof.c |
Executable interface to the QOF external framework. | |
file | pilot-qof.h |
Executable interface to the QOF external framework. | |
Defines | |
#define | _GNU_SOURCE |
#define | ARGUMENT_BAD_OPTION 17227 |
#define | EXCLUDE_REPEATER_SQL |
#define | ENUM_LIST_Q(_) |
#define | PQ_MOD_PILOT "pilotqof-objects" |
#define | PQ_MOD_PILOT "pilotqof-objects" |
#define | PILOT_QOF_LOG "pilot-qof.trace" |
#define | PQ_MOD_CLI "pilotqof-cli" |
#define | PQ_DLP_CARD 0 |
#define | PQ_DLP_OFFSET 0 |
#define | PQ_DLP_RECORD 0 |
#define | PQ_DLP_NEW_REC 0 |
#define | PQ_DLP_SET_ID 0 |
#define | PQ_DLP_APPREAD -1 |
#define | PQ_DLP_APPREAD -1 |
#define | PQ_DLP_REC_ATTR 0 |
#define | PQ_DEF_BUFSZ 0xffff |
#define | PILOT_LINK_SUPPORT "0.12" |
#define | PQ_PREF_USE_BACKUP 1 |
#define | PQ_PREF_USE_SIZE 0 |
#define | PQ_PREF_VERSION 0 |
Typedefs | |
typedef struct PQExp_s | PQExpensePref |
typedef struct PQContext_s | PQContext |
The pilot-qof context struct, extends qof_main_context. | |
Enumerations | |
enum | plu_findcategory_flags_t { PLU_CAT_NOFLAGS = 0, PLU_CAT_CASE_INSENSITIVE = 0x0001, PLU_CAT_DEFAULT_UNFILED = 0x0002, PLU_CAT_MATCH_NUMBERS = 0x0004, PLU_CAT_WARN_UNKNOWN = 0x0008 } |
Functions | |
static PQContext * | pilot_qof_create (void) |
PQContext * | pilot_qof_init (void) |
Register all QOF objects. | |
static gint | plu_connect (gchar *plu_port, gint plu_quiet) |
static gint | pq_findcategory (PQContext *context, const gchar *name, gint flags) |
static void | pilot_entity_free (QofEntity *ent, gpointer user_data) |
static void | pilot_object_free (QofObject *obj, gpointer user_data) |
static void | pilot_qof_free (PQContext *data) |
static void | write_ent_cb (QofEntity *ent, gpointer user_data) |
static void | pilot_database_open (QofObject *obj, gpointer user_data) |
static void | pilot_error (PQContext *context, const gchar *message) |
static void | find_invoice_contact (QofEntity *ent, gpointer data) |
static void | check_invoice_handler (PQContext *context) |
void | qof_cmd_hotsync (PQContext *context) |
Activate/HotSync and query the Palm, ignoring the offline storage. | |
static void | pq_invoice_xmlfile (PQContext *context) |
int | main (int argc, const char *argv[]) |
void | pilot_qof_close (void) |
Shutdown the QOF framework. | |
Variables | |
static QofLogModule | log_module = PQ_MOD_CLI |
static GList * | pilot_modules = NULL |
static const gchar * | env_pilotport = "PILOTPORT" |
Packing, unpacking and freeing wrapped objects. | |
QOF is wrapped around existing pilot-link structs. These objects have their own methods for writing to and reading from the Palm databases. Objects are packed before being written to the Palm, and unpacked to create new objects when the database is read. Packing and unpacking are only used when connecting to the Palm. The free_ent_func routines are used whenever any QofBook created from this framework is closed. | |
typedef gint(* | QofPack )(QofEntity *ent, gpointer user_data) |
Packing function pointer type. | |
typedef struct PilotPack_s | PQPack |
Packing function wrapper. | |
void | pilot_qof_pack (QofEntity *ent, gpointer user_data) |
Pack this object. | |
void | pilot_qof_unpack (QofEntity *ent, gpointer user_data) |
Unpack this object. | |
void | pilot_app_unpack (QofIdTypeConst e_type, gpointer user_data) |
Unpack the database information. | |
void | pilot_entity_finaliser (QofBook *book, gpointer key, gpointer data) |
Free the wrapped object. | |
gboolean | pilot_qof_pack_register (const PQPack *p) |
Shamelessly copied from QOF. | |
const PQPack * | pilot_qof_pack_lookup (QofIdTypeConst object_type) |
provide for looking up an object |
pilot-qof provides the executable interface to the QOF external framework. It supports writing the QSF XML offline storage and SQL-type queries.
The types of SQL queries that are allowed at this point are a little limited. In general, only the following types of queries are supported:
SELECT * FROM SomeObj WHERE (param_a < 10.0) AND (param_b = "asdf") SORT BY param_c DESC;
INSERT INTO SomeObj (param_a, param_b, param_c) VALUES ("value_a", true, "0/1");
Joins are not supported directly.
SELECT * FROM ObjA,ObjB WHERE (ObjA.param_id = ObjB.param_other_id);
The problem with the above is that the search requires a nested search loop, aka a 'join', which is not currently supported in the underlying QofQuery code.
However, by repeating queries and adding the entities to a new session using qof_entity_copy_list, a series of queries can be added to a single book. e.g. You can insert multiple entities and save out as a QSF XML file or use multiple SELECT queries to build a precise list - this can be used to replicate most of the functionality of a SQL join.
SELECT * from ObjA where param_id = value; SELECT * from ObjB where param_other_id = value;
Equivalent to:
SELECT * from ObjA,ObjB where param_id = param_other_id and param_id = value;
When combined with a foreach callback on the value of param_id for each entity in the QofBook, you can produce the effect of a join from running the two SELECT queries for each value of param_id held in 'value'.
See QofEntityForeachCB and qof_object_foreach.
SELECT a,b,c FROM ...
Used to convert QOF objects between applications by using the returned parameter values to create a second object. One application using QOF could register objects from two applications and convert data from one to the other by using
SELECT a,b,c FROM ObjA; SELECT d,f,k FROM ObjB; qof_object_new_instance(); ObjC_set_a(value_c); ObjC_set_b(value_k) etc.
What's needed is for the SELECT to return a complete object that only contains the parameters selected.
Unsupported: UPDATE, DELETE.
It will not be possible to support CREATE, AMEND or DROP for understandable reasons.
#define ENUM_LIST_Q | ( | _ | ) |
_(qof_op_noop, = 0) \ _(qof_op_offline, ) \ _(qof_op_list,) \ _(qof_op_hotsync,) \ _(qof_op_empty,) \ _(qof_op_category,) \ _(qof_op_database,) \ _(qof_op_time,) \ _(qof_op_exclude,) \ _(qof_op_sql,) \ _(qof_op_sql_file,) \ _(qof_op_write, ) \ _(qof_op_upload, ) \ _(qof_op_explain,) \ _(qof_op_vers,) \ _(qof_op_compress,) \ _(qof_op_debug,) \ _(qof_op_inv_city,) \ _(qof_op_inv_vendor,) \ _(qof_op_use_locale,)
Definition at line 75 of file pilot-qof.c.
#define EXCLUDE_REPEATER_SQL |
"SELECT * from pilot_datebook " \ "where DATEBOOK_REPEATER == TRUE;"
Definition at line 72 of file pilot-qof.c.
#define PILOT_LINK_SUPPORT "0.12" |
This is the 0.1.x series of pilot-qof
Definition at line 143 of file pilot-qof.h.
Referenced by main().
#define PILOT_QOF_LOG "pilot-qof.trace" |
#define PQ_DEF_BUFSZ 0xffff |
Default pi_buffer size
Definition at line 140 of file pilot-qof.h.
#define PQ_DLP_APPREAD -1 |
The number of bytes to read from the AppBlock.
Specify negative one for all available bytes.
Definition at line 131 of file pilot-qof.h.
#define PQ_DLP_APPREAD -1 |
The number of bytes to read from the AppBlock.
Specify negative one for all available bytes.
Definition at line 131 of file pilot-qof.h.
#define PQ_DLP_CARD 0 |
The DLP Card Number reference
Definition at line 108 of file pilot-qof.h.
#define PQ_DLP_NEW_REC 0 |
The DLP Record ID - 0 for a new record
Definition at line 117 of file pilot-qof.h.
#define PQ_DLP_OFFSET 0 |
The DLP Offset
Definition at line 111 of file pilot-qof.h.
#define PQ_DLP_REC_ATTR 0 |
The DLP Record attributes - not currently used.
See dlpRecAttributes in pilot-link, includes/pi-dlp.h
Definition at line 137 of file pilot-qof.h.
#define PQ_DLP_RECORD 0 |
The DLP Record Index
Definition at line 114 of file pilot-qof.h.
#define PQ_DLP_SET_ID 0 |
The DLP Record ID value, after writing - currently ignored.
Definition at line 120 of file pilot-qof.h.
#define PQ_MOD_CLI "pilotqof-cli" |
#define PQ_MOD_PILOT "pilotqof-objects" |
default log module for objects
Definition at line 99 of file pilot-qof.h.
#define PQ_MOD_PILOT "pilotqof-objects" |
#define PQ_PREF_USE_BACKUP 1 |
If set, read from backup preferences
(see Palm OS documentation). This flag is ignored on Palm OS 1.x.
Definition at line 149 of file pilot-qof.h.
#define PQ_PREF_USE_SIZE 0 |
Preference read datasize.
If not NULL, on return contains the size of the preference data block.
Definition at line 155 of file pilot-qof.h.
#define PQ_PREF_VERSION 0 |
Preferences version if not NULL.
Definition at line 158 of file pilot-qof.h.
typedef struct PilotPack_s PQPack |
Packing function wrapper.
The pack routines are linked to the QOF object using the qof_pack function pointer and the pilot_pack wrapper. The wrapper also includes the name of the database as held on the Palm.
The e_type must be the same as the e_type of the QofObject, as defined in the object_def definition.
typedef gint(* QofPack)(QofEntity *ent, gpointer user_data) |
Packing function pointer type.
The pack routines are built into the QOF object using the qof_pack function pointer and the pilot_pack wrapper. The same type is used for the free object memory function, free_pack_func.
Definition at line 239 of file pilot-qof.h.
int main | ( | int | argc, | |
const char * | argv[] | |||
) |
Definition at line 827 of file pilot-qof.c.
References QofMain_s::database, ERR_INDENT, QofMain_s::error, QofMain_s::filename, QofMain_s::gz_level, QofMain_s::input_file, QofMain_s::input_session, PQContext_s::invoice_city, PQContext_s::invoice_vendor, PILOT_LINK_SUPPORT, pilot_qof_init(), PILOT_QOF_LOG, PQContext_s::port, PQ_MOD_CLI, PQ_MOD_PILOT, PQContext_s::qof, QOF_CLI_OPTIONS, qof_cmd_explain(), qof_cmd_hotsync(), qof_cmd_list(), qof_cmd_xmlfile(), QOF_MAIN_CLI, qof_main_wrap_line(), qof_mod_category(), qof_mod_convert_deprecated(), qof_mod_database(), qof_mod_encoding(), qof_mod_exclude(), qof_mod_sql(), qof_mod_sql_file(), qof_mod_time(), qof_mod_write(), QOF_OP_INIT, QOF_OP_VARS, and PQContext_s::quiet.
00828 { 00829 const gchar *help_header_text, *input_file, *plu_port; 00830 gint plu_quiet, optc; 00831 PQContext *pilot_qof_context; 00832 gboolean debug_on; 00833 poptContext pc; 00834 gint64 gz_level; 00835 qof_op_type palm_command; 00836 00837 QOF_OP_VARS struct poptOption options[] = { 00838 {"port", 'p', POPT_ARG_STRING, &plu_port, 0, 00839 _("Use the device <port> to communicate with Palm"), 00840 "<port>"}, 00841 { "quiet", 'q', POPT_ARG_NONE, &plu_quiet, 0 , 00842 _("Suppress HotSync connection messages"), NULL}, 00843 {"input-file", 'i', POPT_ARG_STRING, &filename, qof_op_offline, 00844 _("Query the data in <filename>"), _("filename")}, 00845 QOF_CLI_OPTIONS 00846 {"hot-query", 'a', POPT_ARG_NONE, 00847 NULL, qof_op_hotsync, 00848 _("Activate/HotSync and query the Palm."), NULL}, 00849 {"upload", 'u', POPT_ARG_STRING, &input_file, qof_op_upload, 00850 _("Upload data from <filename> to the Palm. Requires -a"), 00851 "filename"}, 00852 {"invoice-vendor", 0, POPT_ARG_NONE, NULL, qof_op_inv_vendor, 00853 _ 00854 ("Shorthand to relate an event or expense to a contact, by vendor. " 00855 "Requires -t."), NULL}, 00856 {"invoice-city", 0, POPT_ARG_NONE, NULL, qof_op_inv_city, 00857 _ 00858 ("Shorthand to relate an event or expense to a contact, by city. " 00859 "Requires -t."), NULL}, 00860 {"use-locale", 0, POPT_ARG_NONE, NULL, qof_op_use_locale, 00861 _ 00862 ("Write XML using the current locale encoding instead of UTF-8."), 00863 NULL}, 00864 POPT_TABLEEND 00865 }; 00866 00867 palm_command = qof_op_noop; 00868 debug_on = FALSE; 00869 QOF_OP_INIT; 00870 input_file = NULL; 00871 plu_quiet = 0; 00872 plu_port = NULL; 00873 00874 #ifdef ENABLE_NLS 00875 setlocale (LC_ALL, ""); 00876 bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR); 00877 bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); 00878 textdomain (GETTEXT_PACKAGE); 00879 #endif 00880 00881 help_header_text = _("\n" 00882 " Query Palm databases as objects and save to XML.\n" 00883 00884 " pilot-qof provides a query interface to data on a Palm device,\n" 00885 " using pilot-link and QOF - the Query Object Framework.\n\n" 00886 " pilot-qof supports reading addressbook, datebook, expenses and\n" 00887 " ToDo data from a Palm device to XML files. pilot-qof runs SQL-type\n" 00888 " queries on the live data or a QSF XML file and results can be imported\n" 00889 " into other QOF applications or converted to other text based formats,\n" 00890 " including non-XML formats like vcard.\n" 00891 " See http://pilot-qof.sourceforge.net/\n\n" 00892 " Commands are -x -a -l --explain -s or -f.\n" 00893 " Options are -c -t -w, -d or -e.\n" 00894 " option -u requires -a\n\n"); 00895 00896 pc = poptGetContext (PACKAGE, argc, argv, options, 0); 00897 00898 poptSetOtherOptionHelp (pc, help_header_text); 00899 00900 if (argc < 2) 00901 { 00902 poptPrintUsage (pc, stderr, 0); 00903 return EXIT_FAILURE; 00904 } 00905 pilot_qof_context = pilot_qof_init (); 00906 if (!pilot_qof_context) 00907 { 00908 qof_main_wrap_line (stderr, ERR_INDENT, 00909 _("%s: Failed to initialise " 00910 "the query object framework."), PACKAGE); 00911 return EXIT_FAILURE; 00912 } 00913 /* convert deprecated date fields into the newly supported 00914 time values. */ 00915 qof_mod_convert_deprecated (1, &pilot_qof_context->qof); 00916 while ((optc = poptGetNextOpt (pc)) >= 0) 00917 { 00918 switch (optc) 00919 { 00920 /* commands - mutually exclusive */ 00921 case qof_op_offline: 00922 case qof_op_list: 00923 case qof_op_explain: 00924 case qof_op_hotsync: 00925 { 00926 palm_command = optc; 00927 break; 00928 } 00929 case qof_op_sql: 00930 { 00931 qof_mod_sql (sql_query, &pilot_qof_context->qof); 00932 if (!filename) 00933 { 00934 filename = g_strdup (QOF_STDOUT); 00935 } 00936 palm_command = qof_op_empty; 00937 break; 00938 } 00939 case qof_op_sql_file: 00940 { 00941 qof_mod_sql_file (sql_file, &pilot_qof_context->qof); 00942 palm_command = qof_op_empty; 00943 break; 00944 } 00945 case qof_op_vers: 00946 { 00947 fprintf (stdout, _("\n This is %s v%s\n"), PACKAGE, 00948 VERSION); 00949 fprintf (stdout, 00950 _ 00951 (" Query interface for Palm databases as objects.\n")); 00952 fprintf (stdout, 00953 "\n Copyright (c) 2005-2006 " 00954 "Neil Williams <linux@codehelp.co.uk>\n"); 00955 fprintf (stdout, 00956 _(" For %s support, join the QOF-devel " 00957 "mailing list at\n"), PACKAGE); 00958 fprintf (stdout, 00959 " http://lists.sourceforge.net/mailman/listinfo/qof-devel\n\n"); 00960 /* Translators: Add or subtract dots to keep the translated lines aligned vertically */ 00961 fprintf (stdout, _(" Build target............: %s\n"), 00962 HOST_OS); 00963 /* Translators: Add or subtract dots to keep the translated lines aligned vertically */ 00964 fprintf (stdout, _(" Build date..............: %s %s\n"), 00965 __DATE__, __TIME__); 00966 /* Translators: Add or subtract dots to keep the translated lines aligned vertically */ 00967 fprintf (stdout, _(" Built for pilot-link ...: %s\n"), 00968 PILOT_LINK_SUPPORT); 00969 /* Translators: Add or subtract dots to keep the translated lines aligned vertically */ 00970 fprintf (stdout, _(" --debug logs to.........: %s/%s\n\n"), 00971 g_get_tmp_dir (), PILOT_QOF_LOG); 00972 fprintf (stdout, 00973 _ 00974 (" Please use --help for more detailed options.\n\n")); 00975 return EXIT_SUCCESS; 00976 } 00977 /* optional modifiers - store to act on later. */ 00978 case qof_op_category: 00979 { 00980 qof_mod_category (category, &pilot_qof_context->qof); 00981 break; 00982 } 00983 case qof_op_database: 00984 { 00985 qof_mod_database (database, &pilot_qof_context->qof); 00986 break; 00987 } 00988 case qof_op_time: 00989 { 00990 qof_mod_time (date_time, &pilot_qof_context->qof); 00991 break; 00992 } 00993 case qof_op_exclude: 00994 { 00995 qof_mod_exclude (exclude, &pilot_qof_context->qof); 00996 break; 00997 } 00998 case qof_op_write: 00999 { 01000 qof_mod_write (write_file, &pilot_qof_context->qof); 01001 break; 01002 } 01003 case qof_op_upload: 01004 { 01005 if (palm_command != qof_op_hotsync) 01006 { 01007 fprintf (stderr, 01008 _("%s: Error: Please specify -a if you use -u\n"), 01009 PACKAGE); 01010 poptPrintUsage (pc, stderr, 0); 01011 return EXIT_FAILURE; 01012 } 01013 pilot_qof_context->qof.input_file = g_strdup (input_file); 01014 break; 01015 } 01016 case qof_op_debug: 01017 { 01018 gchar *log; 01019 01020 log = 01021 g_strconcat (g_get_tmp_dir (), "/", PILOT_QOF_LOG, 01022 NULL); 01023 qof_log_init_filename (log); 01024 g_free (log); 01025 qof_log_set_default (QOF_LOG_DETAIL); 01026 qof_log_set_level (PQ_MOD_CLI, QOF_LOG_DETAIL); 01027 qof_log_set_level (PQ_MOD_PILOT, QOF_LOG_DETAIL); 01028 qof_log_set_level (QOF_MAIN_CLI, QOF_LOG_DETAIL); 01029 qof_log_set_level (QOF_MOD_QSF, QOF_LOG_DETAIL); 01030 qof_log_set_level ("qof-sqlite-module", QOF_LOG_DETAIL); 01031 debug_on = TRUE; 01033 break; 01034 } 01035 case qof_op_compress: 01036 { 01037 pilot_qof_context->qof.gz_level = gz_level; 01038 break; 01039 } 01040 case qof_op_inv_vendor: 01041 { 01042 if (!pilot_qof_context->invoice_city) 01043 pilot_qof_context->invoice_vendor = TRUE; 01044 break; 01045 } 01046 case qof_op_inv_city: 01047 { 01048 pilot_qof_context->invoice_city = TRUE; 01049 pilot_qof_context->invoice_vendor = FALSE; 01050 break; 01051 } 01052 case qof_op_use_locale: 01053 { 01054 const gchar *locale_encoding; 01055 gboolean test; 01056 locale_encoding = NULL; 01057 test = g_get_charset (&locale_encoding); 01058 if (!test) 01059 qof_mod_encoding (locale_encoding, 01060 &pilot_qof_context->qof); 01061 break; 01062 } 01063 default: 01064 { 01065 fprintf (stderr, _("%s: ERROR: got option %d, arg %s\n"), 01066 PACKAGE, optc, poptGetOptArg (pc)); 01067 return EXIT_FAILURE; 01068 } 01069 } 01070 } 01071 if (qof_op_noop == palm_command) 01072 { 01073 qof_main_wrap_line (stderr, ERR_INDENT, 01074 _("%s: ERROR: specify a command " 01075 "-x, -a, -l, -s or -f, or --explain.\n"), PACKAGE); 01076 poptPrintUsage (pc, stderr, 0); 01077 return EXIT_FAILURE; 01078 } 01079 if (qof_op_noop == palm_command) 01080 { 01081 fprintf (stderr, _("%s: ERROR: specify a command " 01082 "-x, -a, -l, -s or -f, or --explain.\n"), PACKAGE); 01083 poptPrintUsage(pc, stderr, 0); 01084 return EXIT_FAILURE; 01085 } 01086 if (optc < -1) 01087 { 01088 fprintf (stderr, "%s: %s %s\n\n", PACKAGE, 01089 poptBadOption (pc, POPT_BADOPTION_NOALIAS), 01090 poptStrerror (optc)); 01091 poptPrintUsage (pc, stderr, 0); 01092 return EXIT_FAILURE; 01093 } 01094 /* If we get this far, we should have sensible options: start the work. */ 01095 pilot_qof_context->qof.input_session = qof_session_new (); 01096 switch (palm_command) 01097 { 01098 case qof_op_empty: 01099 { 01100 pilot_qof_context->qof.filename = g_strdup (filename); 01101 if ((pilot_qof_context->invoice_city) 01102 || (pilot_qof_context->invoice_vendor)) 01103 { 01104 check_invoice_handler (pilot_qof_context); 01105 if (pilot_qof_context->qof.error) 01106 return EXIT_FAILURE; 01107 pq_invoice_xmlfile (pilot_qof_context); 01108 } 01109 else 01110 qof_cmd_xmlfile (&pilot_qof_context->qof); 01111 break; 01112 } 01113 case qof_op_offline: 01114 { 01115 pilot_qof_context->qof.filename = g_strdup (filename); 01116 if ((pilot_qof_context->invoice_city) 01117 || (pilot_qof_context->invoice_vendor)) 01118 { 01119 check_invoice_handler (pilot_qof_context); 01120 if (pilot_qof_context->qof.error) 01121 return EXIT_FAILURE; 01122 pq_invoice_xmlfile (pilot_qof_context); 01123 } 01124 else 01125 qof_cmd_xmlfile (&pilot_qof_context->qof); 01126 break; 01127 } 01128 case qof_op_list: 01129 { 01130 DEBUG (" list mode"); 01131 qof_cmd_list (); 01132 break; 01133 } 01134 case qof_op_explain: 01135 { 01136 if (!pilot_qof_context->qof.database) 01137 { 01138 qof_main_wrap_line (stderr, ERR_INDENT, 01139 _("%s: Error: please specify which database " 01140 "you would like explained.\n\n"), PACKAGE); 01141 break; 01142 } 01143 DEBUG (" explain mode"); 01144 qof_cmd_explain (&pilot_qof_context->qof); 01145 break; 01146 } 01147 case qof_op_hotsync: 01148 { 01149 DEBUG (" hotsync mode"); 01150 pilot_qof_context->port = g_strdup (plu_port); 01151 pilot_qof_context->quiet = plu_quiet; 01152 qof_cmd_hotsync (pilot_qof_context); 01153 break; 01154 } 01155 case qof_op_noop: 01156 case qof_op_category: 01157 case qof_op_database: 01158 case qof_op_time: 01159 case qof_op_exclude: 01160 case qof_op_sql: 01161 case qof_op_sql_file: 01162 case qof_op_write: 01163 case qof_op_upload: 01164 case qof_op_vers: 01165 case qof_op_compress: 01166 case qof_op_debug: 01167 case qof_op_inv_city: 01168 case qof_op_inv_vendor: 01169 case qof_op_use_locale: 01170 default: 01171 break; 01172 } 01173 poptFreeContext (pc); 01174 pilot_qof_free (pilot_qof_context); 01175 if (debug_on) 01176 qof_log_shutdown (); 01177 qof_close (); 01178 return EXIT_SUCCESS; 01179 }
void pilot_app_unpack | ( | QofIdTypeConst | e_type, | |
gpointer | user_data | |||
) |
Unpack the database information.
The Palm uses a separate structure for information about the current database, including the list of available categories.
This is a per-database structure, not per record. The records only contain an integer - the value of the category in the index of the CategoryAppInfo. QOF converts this into a string value for the category name for portability.
It does not call any qof_pack routines as there is no QofEntity at this stage.
e_type | - determines the type of application information to unpack from the pilot_pack wrapper. | |
user_data | - gpointer to the pqd context. |
void pilot_entity_finaliser | ( | QofBook * | book, | |
gpointer | key, | |||
gpointer | data | |||
) |
Free the wrapped object.
Set the pointer to the free function for the object within this entity. The function itself is called automatically by QOF when the QofBook is being closed.
PQContext * pilot_qof_init | ( | void | ) |
Register all QOF objects.
If new objects are added, call the register func() here. Ensure you have the pack routines for your object.
Follow the template of other objects to create your own callbacks.
pilot_qof_init must be called by any program wanting to use the QOF framework with pilot-link objects.
Referenced by main().
void pilot_qof_pack | ( | QofEntity * | ent, | |
gpointer | user_data | |||
) |
Pack this object.
Retrieve the pointer to the pack function for the object within this entity. Entity objects are packed prior to being written to a Palm database. Although upload is available for new records, merge and sync are not yet implemented in the pilot-qof Although upload is available for new records, merge and sync are not yet implemented in the pilot-qof application. Functionality to merge two QofBooks to handle the merge and sync does exist in QOF.
const PQPack * pilot_qof_pack_lookup | ( | QofIdTypeConst | object_type | ) |
provide for looking up an object
Returns the pilot_pack that matches this object type. Uses the same object type as the QofObject->e_type.
gboolean pilot_qof_pack_register | ( | const PQPack * | p | ) |
Shamelessly copied from QOF.
Pilot-link requires a few functions to pack and unpack the database records prior to / post HotSync. These are specific to each object and to allow new objects to be added easily, need to be referenced generically.
pilot-qof implements a mini-QofObject alongside QOF that just contains this pilot-link data.
void pilot_qof_unpack | ( | QofEntity * | ent, | |
gpointer | user_data | |||
) |
Unpack this object.
Retrieve the pointer to the unpack function for this entity and the object it contains. Entities are unpacked after being read from the Palm during a HotSync. The unpack routine populates the object with the Palm data in a usable form. The QOF framework then accesses this data through QOF wrappers.
void qof_cmd_hotsync | ( | PQContext * | context | ) |
Activate/HotSync and query the Palm, ignoring the offline storage.
Connects the the Palm and queries the live database. If -d or -e are not used, query all supported databases in one HotSync operation.
Referenced by main().
QofLogModule log_module = PQ_MOD_CLI [static] |
used to print debug logs.
Definition at line 64 of file pilot-qof.c.
GList* pilot_modules = NULL [static] |
pack routines for communication with pilot
Definition at line 66 of file pilot-qof.c.