Monthly Archives: October 2010

Perl DBI table_info method

Just as column_info() returns information about the table columns in your database, so table_info() returns information about the tables themselves. my $sth = $dbh->table_info(); print join(“, “, @{$sth->{NAME}}); print “\n”; while (defined(my $row = $sth->fetchrow_hashref())) { print “Table: $row->{TABLE_NAME}\n”; } Results TABLE_CAT, TABLE_SCHEM, TABLE_NAME, TABLE_TYPE, REMARKS Table: wp_commentmeta Table: wp_comments Table: wp_links Table: wp_options Table: [...]

Posted in Perl | Tagged , | Leave a comment

Database Agnostic Data Dictionary Spelunking with Perl DBI

The various databases all have different ways of querying the internal data dictionary, to find out which tables are available and which columns they contain. Perl DBI provides a unifying interface so that you can extract table and column data from any supported database using the same API. The method to extract column names and [...]

Posted in Perl, Programming | Tagged , | Leave a comment

Emacs String Functions

Characters and Strings Strings are a sequence of characters. Unlike many languages emacs lisp doesn’t differentiate between characters and integers. Evaluating ?A returns 65. Therefore you don’t need an ord or char function. To convert a character (or integer) into a string use (string …). (string 65) ;; “A” is the same as (string ?A) [...]

Posted in Emacs | Leave a comment