in reply to uninitialized value in Tk::DBI::Table

Tk::DBI::Table assumes the first column in a select statement is the id column, and when I select a date/time column as the first column (as you have), I get this error before the table shows up:
parent element "1980-01-01 00:00:00" does not exist at C:/Perl/site/li +b/Tk.pm li ne 247. at C:/Perl/site/lib/Tk/Derived.pm line 469
This is with Tk 800.24, Tk::DBI::Table 0.02, perl 5.8.4 (AS build 810).

Update: After some mucking about, I found that the "." in the date/time string was messing up the $hlist->add($entryPath) method (the date/time being used as the entry path for the HList). The "." is truncatated from the string in the error message, because "." is the default path 'separator' for an HList.

Replies are listed 'Best First'.
Re^2: uninitialized value in Tk::DBI::Table
by TonyDonker (Novice) on Feb 18, 2005 at 08:34 UTC
    But can you sort the first column?
      I just found out, that you even't can't use DBI::Table, if 2 (or more) identical rows in your database...

      HELP!!!

      element "18-02-2005 09:45:10" already exists at E:/Perl/site/lib/Tk.pm line 228.

      at E:/Perl/site/lib/Tk/Derived.pm line 467

        The way Tk::DBI::Table currently works, is that the first column selected is assumed to be a primary key, and so it must be unique. If you have no unique columns, then you're out of luck. I have an idea how the module should be patched, but no time to work on it. I've also emailed the author but have not heard back yet.

        And to answer your earlier question, no, I can't sort on the first column either.