I'm migrating from Cairo to 4.1.1 and discovered some strangeness with DatabasePlugin 14908 (17 Sep 2007).

I went through the configure process on the web to set up the new format for LocalSite.cfg. Two things became immediately apparent:

  • If my database description doesn't match the database name, the connection to the database fails.
  • DATABASE_REPEAT appears to use table in places instead of table_name which causes it to fail.
    • The work around seems to be to replace table_name with table in the configuration file for TWiki.

Here is my example where I see the second failing.

 %DATABASE_REPEAT{description="pandora" columns="name,version,descrip,instdate"}%| [[%SCRIPTURL%/view%SCRIPTSUF
FIX%/%WEB%/PandoraToolInfo?name=%name%&version=%version%][%name% %version%]] | <nop>%descrip% | <nop> %instdat
e% |
%DATABASE_REPEAT% 
%DATABASE_EDIT{description="pandora" display_text="Edit the above table"}%


My LocalSite.cfg for the plugin looks like:

 $TWiki::cfg{Plugins}{DatabasePlugin}{Databases} = [
                                                    {   
                                                      'sid' => '',
                                                      'hostname' => 'databasehost',
                                                      'description' => 'pandora',
                                                      'username' => 'pandora_admin',
                                                      'database' => 'pandora',
                                                      'password' => 'password',
                                                      'table' => 'packages',
                                                      'driver' => 'mysql'
                                                    }   
                                                  ];  


The stack backtrace when description doesn't match database is


No such DB pandora at /proj/twiki/testing/testboot/twiki4.1.1/lib/TWiki/Plugins/DatabasePlugin.pm line 76. at /usr/local/.package/perl-5.8.8/lib/5.8.8/CGI/Carp.pm   line 319 CGI::Carp::realdie('No such DB pandora at /proj/twiki/testing/testboot/twiki4.1.1...') 
called at /usr/local/.package/perl-5.8.8/lib/5.8.8/CGI/Carp.pm line 396 CGI::Carp::die('No such DB pandora') 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/TWiki/Plugins/DatabasePlugin.pm line 76 eval {...} 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/TWiki/Plugins/DatabasePlugin.pm line 75 TWiki::Plugins::DatabasePlugin::_dispatch('DATABASE_REPEAT',           'description="pandora" columns="name,version,descrip,instdate"', '| [[http://www/twiki-test/testboot/twiki4.1.1/bin/view/Mai...') 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/TWiki/Plugins/DatabasePlugin.pm line 95 TWiki::Plugins::DatabasePlugin::commonTagsHandler('---+!!              PandoraToolsList\x{a}\x{a}This is a list of tools that are curr...', 'PandoraToolsList', 'Main', 0) 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/TWiki/Plugin.pm line 245 TWiki::Plugin::invoke('TWiki::Plugin=HASH(0x8d8df04)', 'commonTagsHandler', '---+!!   PandoraToolsList\x{a}\x{a}This is a list of tools that are curr...', 'PandoraToolsList', 'Main', 0) 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/TWiki/Plugins.pm line 333 TWiki::Plugins::_dispatch('TWiki::Plugins=HASH(0x88213c8)', 'commonTagsHandler',     '---+!!PandoraToolsList\x{a}\x{a}This is a list of tools that are curr...', 'PandoraToolsList', 'Main', 0) 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/TWiki/Plugins.pm line 470 TWiki::Plugins::commonTagsHandler('TWiki::Plugins=HASH(0x88213c8)', '---+!!          PandoraToolsList\x{a}\x{a}This is a list of tools that are curr...', 'PandoraToolsList', 'Main', 0) 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/TWiki.pm line 2596 TWiki::handleCommonTags('TWiki=HASH(0x804d6d0)', '---+!!PandoraToolsList\x{a}\x{a}This is a list of tools that are currently ins...', 'Main', 'PandoraToolsList') 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/TWiki/UI/View.pm line 375 TWiki::UI::View::_prepare('---+!!PandoraToolsList\x{a}\x{a}This is a list of tools   that are currently ins...', 'TWiki=HASH(0x804d6d0)', 'Main', 'PandoraToolsList', 'TWiki::Meta=HASH(0x903b028)', 0) 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/TWiki/UI/View.pm line 359 TWiki::UI::View::view('TWiki=HASH(0x804d6d0)') 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/TWiki/UI.pm line 157 TWiki::UI::__ANON__() 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/CPAN/lib//Error.pm line 379 eval {...} 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/CPAN/lib//Error.pm line 371 Error::subs::try('CODE(0x804d5b0)', 'HASH(0x904f154)') 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/TWiki/UI.pm line 197 TWiki::UI::run('CODE(0x809e7e4)', 'view', 1) 
called at /home/apache/www/htdocs/twiki-test/testboot/twiki4.1.1/bin/view line 31  No such DB pandora at /proj/twiki/testing/testboot/twiki4.1.1/lib/TWiki/Plugins/  DatabasePlugin.pm line 76. at /usr/local/.package/perl-5.8.8/lib/5.8.8/CGI/Carp.pm line 319 CGI::Carp::realdie('No such DB pandora at /proj/twiki/testing/testboot/  twiki4.1.1...') 
called at /usr/local/.package/perl-5.8.8/lib/5.8.8/CGI/Carp.pm line 396 CGI::Carp::die('No such DB pandora') 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/TWiki/Plugins/DatabasePlugin.pm line 76 eval {...} 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/TWiki/Plugins/DatabasePlugin.pm line 75 TWiki::Plugins::DatabasePlugin::_dispatch('DATABASE_EDIT',             'description="pandora" display_text="Edit the above table"') 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/TWiki/Plugins/DatabasePlugin.pm line 97 TWiki::Plugins::DatabasePlugin::commonTagsHandler('---+!!              PandoraToolsList\x{a}\x{a}This is a list of tools that are curr...', 'PandoraToolsList', 'Main', 0) 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/TWiki/Plugin.pm line 245 TWiki::Plugin::invoke('TWiki::Plugin=HASH(0x8d8df04)', 'commonTagsHandler', '---+!!   PandoraToolsList\x{a}\x{a}This is a list of tools that are curr...', 'PandoraToolsList', 'Main', 0)  
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/TWiki/Plugins.pm line 333 TWiki::Plugins::_dispatch('TWiki::Plugins=HASH(0x88213c8)', 'commonTagsHandler',     '---+!!PandoraToolsList\x{a}\x{a}This is a list of tools that are curr...', 'PandoraToolsList', 'Main', 0)  
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/TWiki/Plugins.pm line 470 TWiki::Plugins::commonTagsHandler('TWiki::Plugins=HASH(0x88213c8)', '---+!!          PandoraToolsList\x{a}\x{a}This is a list of tools that are curr...', 'PandoraToolsList', 'Main', 0) 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/TWiki.pm line 2596 TWiki::handleCommonTags('TWiki=HASH(0x804d6d0)', '---+!!PandoraToolsList\x{a}\x{a}This is a list of tools that are currently ins...', 'Main', 'PandoraToolsList') 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/TWiki/UI/View.pm line 375 TWiki::UI::View::_prepare('---+!!PandoraToolsList\x{a}\x{a}This is a list of tools   that are currently ins...', 'TWiki=HASH(0x804d6d0)', 'Main', 'PandoraToolsList', 'TWiki::Meta=HASH(0x903b028)', 0) 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/TWiki/UI/View.pm line 359 TWiki::UI::View::view('TWiki=HASH(0x804d6d0)') 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/TWiki/UI.pm line 157 TWiki::UI::__ANON__() 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/CPAN/lib//Error.pm line 379 eval {...} 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/CPAN/lib//Error.pm line 371 Error::subs::try('CODE(0x804d5b0)', 'HASH(0x904f154)') 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/TWiki/UI.pm line 197 TWiki::UI::run('CODE(0x809e7e4)', 'view', 1) 
called at /home/apache/www/htdocs/twiki-test/testboot/twiki4.1.1/bin/view line 31


And here's the output when DATABASE_REPEAT fails.


 No table defined in pandora at /proj/twiki/testing/testboot/twiki4.1.1/lib/TWiki/Plugins/DatabasePlugin/DATABASE_REPEAT.pm line 10. at /usr/local/.package/perl-5.8. 8/lib/5.8.8/CGI/Carp.pm line 319 CGI::Carp::realdie('No table defined in pandora at /proj/twiki/testing/testboot/t...') 
called at /usr/local/.package/perl-5.8.8/lib/5.8.8/CGI/Carp.pm line 396 CGI::Carp::die('No table defined in pandora') 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/TWiki/Plugins/DatabasePlugin/DATABASE_REPEAT.pm line 10 TWiki::Plugins::DatabasePlugin::DATABASE_REPEAT::      handle('TWiki::Plugins::DatabasePlugin::Connection=HASH(0x8fe7b04)', 'description="pandora" columns="name,version,descrip,instdate"', '| [[http://www/twiki-test/    testboot/twiki4.1.1/bin/view/Mai...') 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/TWiki/Plugins/DatabasePlugin.pm line 81 eval {...} 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/TWiki/Plugins/DatabasePlugin.pm line 75 TWiki::Plugins::DatabasePlugin::_dispatch('DATABASE_REPEAT',           'description="pandora" columns="name,version,descrip,instdate"', '| [[http://www/twiki-test/testboot/twiki4.1.1/bin/view/Mai...') 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/TWiki/Plugins/DatabasePlugin.pm line 95 TWiki::Plugins::DatabasePlugin::commonTagsHandler('---+!!              PandoraToolsList\x{a}\x{a}This is a list of tools that are curr...', 'PandoraToolsList', 'Main', 0) 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/TWiki/Plugin.pm line 245 TWiki::Plugin::invoke('TWiki::Plugin=HASH(0x8d8e1b4)', 'commonTagsHandler', '---+!!   PandoraToolsList\x{a}\x{a}This is a list of tools that are curr...', 'PandoraToolsList', 'Main', 0) 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/TWiki/Plugins.pm line 333 TWiki::Plugins::_dispatch('TWiki::Plugins=HASH(0x8821438)', 'commonTagsHandler',     '---+!!PandoraToolsList\x{a}\x{a}This is a list of tools that are curr...', 'PandoraToolsList', 'Main', 0) 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/TWiki/Plugins.pm line 470 TWiki::Plugins::commonTagsHandler('TWiki::Plugins=HASH(0x8821438)', '---+!!          PandoraToolsList\x{a}\x{a}This is a list of tools that are curr...', 'PandoraToolsList', 'Main', 0) 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/TWiki.pm line 2596 TWiki::handleCommonTags('TWiki=HASH(0x804d6d0)', '---+!!PandoraToolsList\x{a}\x{a}This is a list of tools that are currently ins...', 'Main', 'PandoraToolsList') 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/TWiki/UI/View.pm line 375 TWiki::UI::View::_prepare('---+!!PandoraToolsList\x{a}\x{a}This is a list of tools   that are currently ins...', 'TWiki=HASH(0x804d6d0)', 'Main', 'PandoraToolsList', 'TWiki::Meta=HASH(0x903b0b0)', 0) 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/TWiki/UI/View.pm line 359 TWiki::UI::View::view('TWiki=HASH(0x804d6d0)') 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/TWiki/UI.pm line 157 TWiki::UI::__ANON__() 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/CPAN/lib//Error.pm line 379 eval {...} 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/CPAN/lib//Error.pm line 371 Error::subs::try('CODE(0x804d5b0)', 'HASH(0x904f644)') 
called at /proj/twiki/testing/testboot/twiki4.1.1/lib/TWiki/UI.pm line 197 TWiki::UI::run('CODE(0x809e7e4)', 'view', 1) 
called at /home/apache/www/htdocs/twiki-test/testboot/twiki4.1.1/bin/view line 31    


-- TWiki:Main/TravisCampbell - 26 Oct 2007

I can verify the two statements. The docs could emphasize that 'description' must match database and the other macros could be hidden by a twistie maybe. Otherwise I don't know if it would be a good idea to update this plugin a bit or make a *Ng plugin. Only DATABASE_SQL is actually needed, I think, and it could be written with a registerTagHandler instead of commonTagsHandler. The other macros are documented to be for compatability (for?) and should not be used. The DATABASE_EDIT also seem to be suitable for a registered tag. I won't start doing this until after getting some feedback. We must remember those who have old TWiki's who wants to upgrade smile

-- LarsEik

ItemTemplate edit

Summary Configuration or documentation bugs with DatabasePlugin? description must match database name, and table_name should be table?
ReportedBy TWiki:Main.TravisCampbell
Codebase trunk
SVN Range TWiki-4.3.0, Fri, 12 Oct 2007, build 15261
AppliesTo Extension
Component DatabasePlugin
Priority Normal
CurrentState Confirmed
WaitingFor
Checkins
TargetRelease n/a
ReleasedIn
Topic revision: r4 - 26 Aug 2010, CrawfordCurrie
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy