Home English Mozilla  Saturday, Avril 20 11:55:35 
Wcal
Print

 Home

 Screenshots
 Demo
 Downloads

 News RSS 2.0
 FAQ
 Mail archive
Documentation
 Roadmap

 P*Wcal
 CWcal
 DWcal
 Themes
 Internationalization

 Maintainer
 Contributors
 Web repositories
 CVS

 NeoSystem
 MyNews

  
Search
README.db
Some people have asked about the database format that Wcal uses, so here
comes. This information is intended for those interested in inner workings
of Wcal. The database files live in /var/wcal by default, and end in .db.
They are created using a third party Data::Dumper perl module, available in
CPAN. Wcal reads in the .db files by simply reading them into a scalar, and
eval()'ing them, which results in an perl data structure identical to one
the file was created from.

Contents of the .db files are as following

w-USER-YYYYWW.db	 (week files)
  All events for USER for the week YYYYWW (week files).

rw-USER.db	(week repeat files)
  Weekly repeating events for USER (week repeat files).

rm-USER.db	(month repeat files)
  Monthly repeating events for USER.

general.db
  Holds two separate bits of data: Highest event id in use (incremented by
  one for each new event), and the 'date format' configuration setting of
  the database.

The fields of the files should be fairly easy to guess. The first member of
the top level arrays is the database version number (didn't exist in .db
files of Wcal 1.00). Wcal will always be able to read the .db files of older
versions, but the reverse doesn't hold true ofcourse. In wcald there is a
function (convert_events_*) for converting from older database formats to
the current one, and you can use it in your own programs if the need arises.

These formats may and most likely will change in future versions as new features
are added.

The following perl snippet reads in a foo.db file, removes the version
number, and writes it back into bar.db, for demonstration purposes

  use Data::Dumper;
  open (F, "foo.db") or die $!;
  undef $/;
  $file = eval <F>;
  close F;
  
  shift @$file;
  
  open (F, ">bar.db") or die $!;
  $Data::Dumper::Terse = 1;
  print F Dumper ($file);
  close F;


© 2004 Joël Savignon