DBIx::Table2Hash

Read a database table into a hash
Download

DBIx::Table2Hash Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Ron Savage
  • Publisher web site:
  • http://search.cpan.org/~rsavage/

DBIx::Table2Hash Tags


DBIx::Table2Hash Description

Read a database table into a hash DBIx::Table2Hash is a Perl module that reads a database table and stores keys and values in a hash.Synopsis #!/usr/bin/perl use DBIx::Table2Hash; my($key2value) = DBIx::Table2Hash -> new ( dbh => $dbh, table_name => $table_name, key_column => 'name', value_column => 'id' ) -> select(); # or my($key2hashref) = DBIx::Table2Hash -> new ( dbh => $dbh, table_name => $table_name, key_column => 'name', ) -> select_hashref(); # or my($key2tree) = DBIx::Table2Hash -> new ( dbh => $dbh, table_name => $table_name, key_column => 'name', child_column => 'id', parent_column => 'parent_id', skip_columns => ) -> select_tree();The aim is to create a hash which is a simple look-up table. To this end, the module allows the key_column to point to an SQL expression.select() and select_hashref() do not nest the hash in any way.select_tree() returns a nested hash. select_tree() will call select_hashref() if necessary, ie if you have not called select_hashref() first. Requirements: · Perl


DBIx::Table2Hash Related Software