Thursday, June 16, 2011

My answer to "MySQL, why not Sqlite3?"

This is my answer to a Question on Support site for LampCMS project


It will be easy to add other types of databases. MySQL is used only for the search feature. Ideally no database will be needed at all when we start using real search engine like Lucene or Sphinx.

If you want to write sqlite plugin then you need to implement 2 interfaces: Search and Indexer
Then edit SearchFactory class to return your own objects that implement these 2.

The class for creating tables if tables don't exists is just a helper class specifically for mysql. You are not required to implement it but then you will be required to pre-create all your SQLite tables in advance. I prefer when there is that helper class that detects that table does not exist and creates it.

Later I should probably refactory this a little so that every search provider is in its own namespace, for example
\Lampcms\Modules\Search\Mysql\Indexer.php and \Lampcms\Modules\Search\Mysql\Search.php

Then it will be easy to define your prefered search provider in !config.ini by just defining the name of search provider.

No comments:

Post a Comment