2011/4/4 David McMath <mcd...@stanford.edu>: > On 04/03/2011 06:18 AM, Jens Rehsack wrote: >> >> On 04/01/11 17:15, David McMath wrote: >>> >>> Dear List, >> >> Hi David, >> >> I quick reply now without taking a look into the details of the >> implementation to prevent that I forget you (I'm currently busy >> with other tasks ...). >> > ... >> >>> I've tried "$dbh->func('list_tables')" but that just lists all the files >>> in the directory. I'd rather not use that because I'd rather not have to >>> remember how the particular DBM handles extensions. >> >> This shouldn't happen with a proper configured DBD::DBM session. If I >> forgot to dig deeper here within next 4 business days, please feel free >> to remind me. >> >> You should include the version numbers of DBI and SQL::Statement >> you use in your environment and they should better match the latest >> released versions ;) >> Further, you should add the OS(s) you're using (just to be sure). > > Thanks for your time. Including version numbers is always good advice. > When I wrote the original, DBI was something very old and DBD::DBM was > v0.03. After updating, I understand that list_tables should work. > > The attached script almost does the right thing except for a bug in > SqlEngine (?). I described that at > > https://rt.cpan.org/Public/Bug/Display.html?id=67223
I'll see when I find the time to care (might not be soon). Thanks for reporting. > I don't think "CREATE TABLE IF NOT EXISTS" parses, even after I updated > everything I could think of. The attached script gives the output below. > But the list_tables trick is good enough for me. You're right and I'm sorry - "CREATE TABLE IF NOT EXISTS" is neither supported by DBI::SQL::Nano nor by SQL::Statement. I'll try to remind myself when hacking on RT#67223. > Thanks again for your help, You're welcome, Jens > dave > > -- > > [mcdave@epgy-dsk-999 ticketServer]$ uname -a > Linux epgy-dsk-999.Stanford.EDU 2.6.18-164.11.1.el5 #1 SMP Wed Jan 6 > 13:26:04 EST 2010 x86_64 x86_64 x86_64 GNU/Linux > [mcdave@epgy-dsk-999 ticketServer]$ perl gdb_test_list.pl > Version information: > Use of uninitialized value in concatenation (.) or string at > /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/DBD/DBM.pm line > 178. > Use of uninitialized value in concatenation (.) or string at > /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/DBD/DBM.pm line > 185. > DBD::DBM 0.06 using SDBM_File () + MLDBM () + > MLDBM::Serializer::Storable > DBD::File 0.40 using IO::File (1.14) > DBI::DBD::SqlEngine 0.03 using SQL::Statement 1.33 > DBI 1.616 > OS linux (2.6.18-128.1.10.el5) > Perl 5.008008 (x86_64-linux-thread-multi) > List of tables: > Can't use string ("tickets") as an ARRAY ref while "strict refs" in use at > /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/DBI/DBD/SqlEngine.pm > line 688. > Can't find column definitions! at > /usr/lib/perl5/site_perl/5.8.8/SQL/Statement.pm line 88 > DBD::DBM::db do failed: Can't find column definitions! [for Statement > "CREATE TABLE IF NOT EXISTS tickets > (tid TEXT PRIMARY KEY > , user_id INTEGER > , started DATE > , status_f VARCHAR(16) > , value_f VARCHAR(255) > ) > "] at gdb_test_list.pl line 19. > Can't find column definitions! at gdb_test_list.pl line 18. >