At 22:41 -0800 25/01/2011, Darren Duncan wrote:
>How long have you been using Perl?
>
>Anyway, to start with I would replace the last couple lines with:
>
> my $catalog_rowset = $dbh->selectall_arrayref("PRAGMA
>table_info(contacts)") ;
> my @col_names = map { $_->[1] } @{$catalog_rowset};
> print join ', ', @col_names;
Yes, that's neat, and an encouragement to me to get 'map' into my
head. I've been using Perl long enough to know better but it's only
when I need to advance my knowledge for a real task that I push my
learning to meet the occasion.
>Another thing you can try is use DBI's special methods for basic
>system catalog information, rather than using a SQL query to get
>that information as you did, not that the way you did it is wrong
>per se, but just an alternate means to the end.
>
>I refer to http://search.cpan.org/dist/DBI/DBI.pm#Catalog_Methods :
>
> column_info ...
I did try a few things along those lines and seemed to come across
the problem mentioned on that page : "...Unfortunately,
INFORMATION_SCHEMA views are seldom supported by the DBMS..."
Nevertheless I obviously need to read DBI.pm more thoroughly.
Thank you.
JD
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users