[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[coldsync-hackers] Writing conduits that read more then one DB.



I'd sent a message earlier but suspect that it didn't make it to the list 
because I hadn't verified my subscription yet.  :( I've since learned more 
about coldsync and the Palm modules, so hopefully these questions will be a 
little more intelligent! ;)

WARNING:  A perlmonk I am not.  This is my first go at writing anything 
serious in Perl, so go easy on me! :)

What I'm trying to do is write a new conduit for Titrax.  The existing one 
seems to be written for an earlier version of Titrax and isn't complete 
anyway.  It only extracts Titrax data from the datebook db and is looking for 
the string "Titrax log" in the datebooks description; which doesn't appear 
(I'm assuming it did in older versions).

Titrax however, has the ability to also store logs in it's own notes, which 
the current conduit doesn't handle.  In addition to the data that Titrax can 
put into the datebook database, it also has tree DBs of it's own:

TitraxDataDB.pdb	-- Database of Project Times (I'm guessing)
TitraxNameDB.pdb	-- Database of Project names
TitraxNoteDB.pdb	-- Database of Project Notes

Obviousely this means I need to look for data in 4 sources.  At present, I'm 
not too concerned with the data in TitraxDataDB.pdb.  The logs held either in 
the datebook or TitraxNotesDB are what's important.  The TitraxNameDB is also 
important since it holds the project names as they appear in the Datebooks 
description field.  Also, the TitraxNoteDB is cross indexed with it.  ie, the 
project name for record 5 in the noteDB is record 5 in the NameDB.  The three 
databases created by Titrax all have creator ttrx, and types of data, name, 
or note.  

What I need to do is build a conduit that will read the TitraxNameDB, then 
check for notes in TitraxNoteDB and look for Databook records that have 
descriptions matching the TitraxNameDB entries.  My first message questioned 
whether it was possible to pass more then one InputDB header entry.  I 
suspect this isn't possible, and the better solution would be to pass 
arguments with the names of the extra pdb files to check.  

I'm thinking of building my conduit to use a config like this:

   conduit dump {
                   path: /path/to/conduit/titrax;
                   type: ttrx/name;
               arguments:
                   DBpath: /path/to/user/.palm/backup
		   Datebookdb: /path/to/user/.palm/backup/DatebookDB.pdb
		   TitraxNoteDB: /path/to/user/.palm/backup/TitraxNoteDB.pdb
		   TitraxDataDB: /path/to/user/.palm/backup/TitraxDataDB.pdb
           }

My intention is that the last three arguments would be optional if DBpath is 
set.  If none of the arguments are set, I'm thinking I can pull the path off 
of InputDB, which would be set to /path/to/usr/.palm/backup/TitraxNameDB.pdb 
(I think) given this config.  

Does this sound like a reasonable approach?  Are there better ways to handle 
palm apps that have/use multiple DBs?  Assuming this is a reasonable 
approach, my next question becomes, what's the best way to implement it?  

Looking at Palm::PDB, it seems to only be designed for dealing with one file 
at a time.  Given this constraint, I'm thinking I should create three sub 
classes (one for each file) derived from Palm::raw.  This seems ugly, so if 
someone has a better idea, please speak up! ;)  It'd be nice just to have 
Palm::Titrax, not Palm::TitraxName, Palm::TitraxData, Palm::TitraxNote.

If I take this approach, then I'd need a container class to hold four PDB 
objects; three Titrax DBs and one Datebook.  The current coldsync class only 
holds one.  Should I create a new class derived from coldsync to accommodate 
the extra PDBs or just code a conduit with three local PDB objects?

Due to my limited Perl experience, I'm probably making this more 
difficult/ugly then it needs to be.  If there are better/easier ways to code 
this, please let me know.  

...Izzy

-- 
This message was sent through the coldsync-hackers mailing list.  To remove
yourself from this mailing list, send a message to majordomo@thedotin.net
with the words "unsubscribe coldsync-hackers" in the message body.  For more
information on Coldsync, send mail to coldsync-hackers-owner@thedotin.net.