[cgi-wiki-dev] SQLite Backend

Kate L Pugh cgi-wiki-dev@earth.li
Fri, 7 Nov 2003 16:01:34 +0000


Sorry to take a couple of days to reply to this - new job, v busy.

On Wed 05 Nov 2003, "Naved, Masroor" <mnaved@apdcryogenics.com> wrote:
> The problem is that there are no tables in the SQLite database so
> the write fails (it seems to fail silently)

Blimey.  ->write_node should not fail silently.  The perldoc says:

  Returns 1 on success, 0 on conflict, croaks on error.

If it's not doing that for you then that's a bug.  Can you send me either
as small a test case as possible or failing that all your code.

> I had assumed that CGI::Wiki::Store::Database would create the
> needed tables, but that doesn't seem to be the case.

I am wondering if it should do so.  It'd mean an extra preliminary
database call (to check table existence) every time you tried to write
a node, which would increase load.  Also if you typoed the database
name you wouldn't be hitting the database you expected - which would
be a right pain in the case of SQLite since it'd just create you a new
database file and then you'd be wondering where all your data went.

Opinions on that please.

> I looked through the documentation and code comments in
> CGI::Wiki::Store::Database, CGI::Wiki::Store::SQLite, CGI::Wiki to
> see if I missed something about creating backend tables, but I can't
> find anything that describes the data model.

The pointer to cgi-wiki-createdb is in INSTALL :)  Should it be more
prominent, or did you just forget to read that file?  There's a *lot*
of info in there.  Maybe it should be in README too - would that have
helped?

> Thanks, Masroor Naved

Thanks for the comments and heads-up, and welcome to the list.

On Wed 05 Nov 2003, Tom Insam <tomi@seatbelt.jerakeen.org> wrote:
> You probably want something like
> 
>   cgi-wiki-setupdb --type sqlite --name wiki.db --user root

You don't need --user for SQLite - it's for MySQL and Pg where you
might be authenticating via username and password.

Oh, relating to this, Tom - do you want to take out the 'dbuser'
requirement in CGI::Wiki::Kwiki and make a new release?  I keep having
to put dbuser => "thisisnotused" and it's bugging me :)

Kake