db-backend
Francis J. Lacoste
flacoste at logreport.org
Fri Sep 3 16:44:59 CEST 2004
On September 3, 2004 05:34, Juan Dominguez Gallego wrote:
> Hello list,
>
> I am looking for a way to change the database backend of the DLF to
> MySQL or Postgres.
>
> I would like to use another backend db instead of SQLite. I was looking
> in the FAQ section but could not find any informations on how to do that.
>
> Has anybody done that before and is there some documentation on that?
No, it was never done before.
> Can you give me some hints how to get started?
You will need to modify the following classes:
Lire::DlfStore -> Part that open the DB connection.
Schema management:
Lire::DlfSchema
Lire::ExtendedSchema
Lire::DerivedSchema
SQL implementation of the Lire Report Specification Markup Language :
Aggregators:
Lire::Group
Lire::Timegroup
Lire::Timeslot
Lire::Records
Lire::Rangegroup
Aggregates:
Lire::Average
Lire::Count
Lire::First
Lire::Last
Lire::Sum
Filter expression:
Lire::FilterExpr
Most of the SQL stuff should be fairly portable. The main hurdle is that there
are SQLite extension functions implemented in perl which will need to be
mapped appropriately to the other database SQL construct (either extension
functions or SQL functions that weren't supported by SQLite) :
Lire::SQLExt:
LrCountUniq
LrFirst
LrLast
LrMissingCases
LrMatch
LrRangegroup
LrTimegroup
LrTimeslot
It should be obvious from the name which other modules uses the function (the
LrMissingCases is used by all implementation). Some of these functions could
map to operators offered by the backend (for example, PostgreSQL supports an
operator to do regexp which would be used instead of LrMatch). Some others
could be implemented using subqueries (SQLite doesn't support dynamic
subqueries - subqueries that refers to a field in the enclosing statement).
It would be a good idea to first refactor the code to put all the backend
specific stuff in an outside interface which would be used by the main
classes. This would make porting to different backends easier.
Also. but sure to consult the unit tests for the above classes to understand
what are the expected results of each operators.
Francis J. Lacoste
--
Francis J. Lacoste . . http://www.logreport.org
/^LogReport$/ . . flacoste at logreport.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: signature
Url : http://lists.logreport.org/pipermail/development/attachments/20040903/c7ab7819/attachment.bin
More information about the Development
mailing list