***: PeterThoeny changes topic to: Questions? Simply ask here or post a question in http://twiki.org/cgi-bin/view/Support -- Latest TWiki-5.1.1 released 2012-01-14, r22570 starshine: :)
nn all PeterThoeny: meeting minutes now posted at http://twiki.org/cgi-bin/view/Codev/JerusalemReleaseMeeting2012x05x11 ***: MichaelGulitz has left chico_chicote: hello, i'm trying to use the DBIQueryPlugin in twiki version Fri, 31 Mar 2006 build 9626
i'm trying to define a database connection and i only get that the db connection is not defined
the definition is something like this: http://pastie.org/private/njdotc0h7luowfupciujw
if anyone here uses DBIQueryPlugin, could you please show me an example configuration? i'm having trouble using it in twiki version Fri, 31 Mar 2006 build 9626
i've tried updating $TWiki::cfg{Plugins}{DatabaseContrib}{connections} in LocalSite.cfg and creating a lib/DBIQueryPlugin.cfg file, with no results
both return 'This DBI connection is not defined' ***: ChanServ sets mode: +o PeterThoeny chico_chicote: @PeterThoeny: could you help me with a DBIQueryPlugin configuration? PeterThoeny: chico_chicote: not sure i can help, but go ahead chico_chicote: i have http://pastie.org/private/njdotc0h7luowfupciujw as the last line of my LocalSite.cfg
but when previewing a query, i only get 'This DBI connection is not defined'
i've already tested the db credentials with another perl script PeterThoeny: did you install the dependencies for the database, e.g. all necessary drivers? (libs and perl)
does the other perl script run on the same server? chico_chicote: i'm going to double-check dependencies, but the other perl script does run on the same server PeterThoeny: syntax looks ok to me
comparing with http://svn.twiki.org/svn/twiki/trunk/DatabaseContrib/lib/TWiki/Contrib/DatabaseContrib/Config.spec chico_chicote: is there any meaningful difference between a hash and a hash ref in perl?
that's the only difference i could spot HaraldJoerg: chico_chicote: Yeah, try to get rid of your outermost curlies.
The example in Config.spec is crap.
If, in perl, I say $foo = ('bar' => 'baz') this is the same as
$foo='baz'
You want
$TWiki::cfg{Plugins}{DatabaseContrib}{connections} = { user => 'selectonlyuser', password => 'passpasspass', driver => 'mysql', database => 'mydb', host => 'myhost' }; PeterThoeny: although the syntax supports more than one connection, so it looks like nested hash ref is needed?
i have not read the code though chico_chicote: yea, the docs say 'Additional databases can be added, as a comma-separated list of Perl hash refs.' HaraldJoerg: Definitely not with the syntax currently in Config.spec.
Variables in %TWiki::cfg are all scalars, so if you want to assign a list to them you'd need a list *reference* PeterThoeny: source at http://svn.twiki.org/svn/twiki/trunk/DatabaseContrib/lib/TWiki/Contrib/DatabaseContrib.pm
see sub init
my $cfg_file = $TWiki::cfg{Plugins}{DatabaseContrib}{connections};
$cfg_file = "( $cfg_file , );";
??
it looks like it is building an array of hash refs
so in this case the outer {} should be removed as harald said HaraldJoerg: The code would only work if you write the config items as strings, not as structures
There's a string eval next to the line you just quoted. Ouch. PeterThoeny: so fix could be to define an array of hash ref in localsite.cfg, and use this directly in databasecontrib.pm without eval chico_chicote: thank you guys PeterThoeny: wondering why it is implemented with an eval in the first place... chico_chicote: i think i got it PeterThoeny: chico_chicote: please post a bug report with patch when you get it working
http://develop.twiki.org/~twiki4/cgi-bin/view/Bugs/DatabaseContrib chico_chicote: ok
do you agree it's more of a documentation issue ? HaraldJoerg: Only if you agree than one connection is enough.
Trying to actually define a list of connections without deeply looking at the code would be a true challenge
Peter: That code is severly broken, it won't work without the braces either chico_chicote: is there a repository for twiki plugins?
something like gitorious, in which i could just checkout the code, patch it and send a pull request? HaraldJoerg: TWiki is running subversion at http://svn.twiki.org/svn/
Samples of how to checkout a single extensions are under http://twiki.org/cgi-bin/view/Codev/SubversionReadme ***: HaraldJoerg has left
ChanServ sets mode: +o PeterThoeny