Hello,
I am having some problems get a basic CGI::Wiki up and running. I have one script which only opens a SQLite database, a DB_File_SplitHash for an index, and one write_node command. The problem is that there are no tables in the SQLite database so the write fails (it seems to fail silently) and the subsequent display_node function call throws an error "table does not exist", I had assumed that CGI::Wiki::Store::Database would create the needed tables, but that doesn't seem to be the case. 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.
This might be related to my newbie status in Perl and CPAN packages, but I can't figure out where to go from here.
Thanks, Masroor Naved
On Wed, Nov 05, 2003 at 08:41:42AM -0500, Naved, Masroor wrote:
I am having some problems get a basic CGI::Wiki up and running. I have one script which only opens a SQLite database, a DB_File_SplitHash for an index, and one write_node command. The problem is that there are no tables in the SQLite database so the write fails (it seems to fail silently) and the subsequent display_node function call throws an error "table does not exist",
The utility you want to create the tables is 'cgi-wiki-setupdb', there's docs for it here:
http://search.cpan.org/~kake/CGI-Wiki-0.49/bin/cgi-wiki-setupdb
You probably want something like
cgi-wiki-setupdb --type sqlite --name wiki.db --user root
That command works for me, anyway.
.tom
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