Skip to content

Commit

Permalink
Item9808: It's been a long standing desire that we support DBI-based …
Browse files Browse the repository at this point in the history
…data stores. Well, this is a big step on the road. This contrib implements query and search algorithms using SQL, searching a database cache of the topics stored in RCS. Status is experimental; you are all invited to contribute to further development

git-svn-id: http://svn.foswiki.org/trunk/DBIStoreContrib@9533 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
CrawfordCurrie authored and CrawfordCurrie committed Oct 7, 2010
0 parents commit 5087137
Show file tree
Hide file tree
Showing 10 changed files with 1,099 additions and 0 deletions.
42 changes: 42 additions & 0 deletions data/System/DBIStoreContrib.txt
@@ -0,0 +1,42 @@
---+!! !DBIStoreContrib
<!--
* Set SHORTDESCRIPTION = %$SHORTDESCRIPTION%
-->
%SHORTDESCRIPTION%

%TOC%

*This extension will *not* work with Foswiki 1.1.x or earlier.*

This extension (currently) implements search operations (query and text search) using [[http://www.sqlite.org/][SQLite]], the popular lightweight implementation of an SQL relational database. It uses the special cache hooks recently added to the Foswiki RCS store to cache topics in the database, and executes %<nop>SEARCH= using SQL. We get over the fact that SQL does not implement all the query search features of Foswiki by _hoisting_ SQL expressions out of the Foswiki search statements, leaving behind only those parts of the expression that SQL can't handle.

*If you are experienced with SQLite and / or other SQL DMBS, you are invited with open arms to contribute to the further development of this extension.*

The extension is currently classed as experimental because it has a number of problems:
1 The SQL schema (and the query generator) are (probably) sub-optimal, and require extensive tuning.
1 SQLite is fine for small data, but does not scale well. Large data requires use of an industrial strength DB (such as MySQL) instead.

The longer term goal is to implement a full back-end store using an SQL RDBMS, rather than just a simple cache as at present.

Mapping to another DB *should* be as simple as setting up a different
DSN, but life is never that simple. Not all DBs imlpement the REGEXP
operator, for example. Please go ahead and try, though.

---++ Installation Instructions

%$INSTALL_INSTRUCTIONS%
* Go to =configure= and set a destination

---++ Info

| Author(s): | Crawford Currie http://c-dot.co.uk |
| Copyright: | &copy; |
| License: | [[http://www.gnu.org/licenses/gpl.html][GPL (Gnu General Public License)]] |
| Release: | %$RELEASE% |
| Version: | %$VERSION% |
| Change History: | <!-- versions below in reverse order -->&nbsp; |
| Dependencies: | %$DEPENDENCIES% |
| Home page: | http://foswiki.org/bin/view/Extensions/DBIStoreContrib |
| Support: | http://foswiki.org/bin/view/Support/DBIStoreContrib |

<!-- Do _not_ attempt to edit this topic; it is auto-generated. -->
11 changes: 11 additions & 0 deletions lib/Foswiki/Contrib/DBIStoreContrib.pm
@@ -0,0 +1,11 @@
# See bottom of file for license and copyright information.
package Foswiki::Contrib::DBIStoreContrib;

use strict;

our $VERSION = '$Rev$'; # version of *this file*.

our $RELEASE = '1.0';

our $SHORTDESCRIPTION = '(Experimental) use of DBI to implement an SQL query search';

11 changes: 11 additions & 0 deletions lib/Foswiki/Contrib/DBIStoreContrib/Config.spec
@@ -0,0 +1,11 @@
#--+ Extensions
#--++ DBIStoreContrib
# **STRING 120**
# DBI DSN to use to connect to the database.
$Foswiki::cfg{Extensions}{DBIStoreContrib}{DSN} = 'dbi:SQLite:dbname=$Foswiki::cfg{WorkingDir}/dbcache';
# **STRING 80**
# Username to use to connect to the database.
$Foswiki::cfg{Extensions}{DBIStoreContrib}{Username} = '';
# **STRING 80**
# Password to use to connect to the database.
$Foswiki::cfg{Extensions}{DBIStoreContrib}{Password} = '';
5 changes: 5 additions & 0 deletions lib/Foswiki/Contrib/DBIStoreContrib/DEPENDENCIES
@@ -0,0 +1,5 @@
# Dependencies for DBIStoreContrib
# Example:
# Time::ParseDate,>=2003.0211,cpan,Required.
# Foswiki::Plugins,>=1.2,perl,Requires version 1.2 of handler API.

0 comments on commit 5087137

Please sign in to comment.