Subject: | Error at Tk-DBI-Table |
Hi,
I'm using Perl 5.6.1 built for i386-linux on Linux with kernel 2.4.20 and Tk version 804.024.
The problem I'm experiencing with Tk::DBI::Table modul is that it doesn't allow me to select columns that have not unique values. This is the error I get every time I try to fetch data from the database:
"element TCHDROP already exists at /usr/lib/perl5/Tk.pm line 228"
The database I'm using is very simple PostgreSQL database and doesn't have any unique keys or unique keys. If I make a SELECT query that eliminates the duplicate values at any of the columns, the modul is working properly. Also if I use the Tk::Hlist to display the data everithing works fine.
I'm currently using Tk-DBI-Table.0.02 version but I had the same problems with 0.01 version.
I'm including the perl script in the attachment. Please check if I'm making some mistake in the way I'm using the module, is there any compatibility problem or database problem.
Thank you in advance for your help.
Igor
#!/usr/bin/perl
use Tk;
use CGI':standard';
use CGI::Carp;
use DBI;
use Tk::DBI::Table;
my $user = "user";
my $pass = "password";
my $dsn = "dbi:Pg:dbname=psa;host=localhost;port=5432";
my $dbh = DBI->connect($dsn, $user, $pass, {RaiseError => 1}) || die $DBI::errstr;
my $top = MainWindow->new;
$top->geometry('860x740');
my $tkdbi = $top->DBITable(
-sql => qq/select * from psa_stats where date = '2005-02-10'/,
-dbh => $dbh,
-display_id => 1, #with 0 also have the same error
)->pack(expand => 1, -fill => 'both');
$dbh->disconnect;
MainLoop;