Click here to get back home

Class::DBI::Loader. knowing table names and columns

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Class::DBI::Loader. knowing table names and columns Javier M Mora (jamarier) 11-29-2005
Posted by Javier M Mora (jamarier) on November 29, 2005, 11:35 am
Please log in for more thread options


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I just start to use Class::DBI::Loader (and Class::DBI)

I'm test their using an example from manual:

use Class::DBI::Loader;

01 my $loader = Class::DBI::Loader->new(
02 dsn => "dbi:SQLite:./cookbook.db",
03 namespace => "Data",
04 );
05 my $class = $loader->find_class('recipes'); # $class => Data::Film
06
07 my $obj = $class->retrieve_all;
08
09 while (my $recipe = $obj->next) {
10 print $recipe->title, "\n";
11 }
12
13 print join (" ",$class->columns),"\n"

In line 05, i get an object about table 'recipes', but i need to know
the name of table before to use it. How can i know what tables have mi
database (without look the table's definition ;-)?

In line 13, i get the name of columns of that table. But the order isn't
the order of definition in the table. How can i know the columns name in
same order of definition table (without look the table's definition)?

thanks


- --
        Javier Maria Mora Merchan
        (GPGP) Key ID: 0x794F3D83

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFDjD11pRHCj3lPPYMRAjhYAKCOHc9hNISGBLImsaoGmfaGCnY75gCgqEnB
VZEUJhZlrqdHr5nyaIMbBt8=
=nJyJ
-----END PGP SIGNATURE-----


Posted by Javier M Mora (jamarier) on November 29, 2005, 1:15 pm
Please log in for more thread options


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Javier M Mora (jamarier) escribió:
On Tue, 29 Nov 2005 11:35:29 +0000 (UTC), Javier M Mora (jamarier) wrote:
>
> I just start to use Class::DBI::Loader (and Class::DBI)
>
> I'm test their using an example from manual:
>
> use Class::DBI::Loader;
>
> 01 my $loader = Class::DBI::Loader->new(
> 02 dsn => "dbi:SQLite:./cookbook.db",
> 03 namespace => "Data",
> 04 );
> 05 my $class = $loader->find_class('recipes'); # $class => Data::Film
> [...]
>
> In line 05, i get an object about table 'recipes', but i need to know
> the name of table before to use it. How can i know what tables have mi
> database (without look the table's definition ;-)?
>

Ok, i found in Class::DBI::Loader::Generic:

$loader->classes to get classes name created
$loader->tables to get table names of database


- --
        Javier Maria Mora Merchan
        (GPGP) Key ID: 0x794F3D83

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFDjFTfpRHCj3lPPYMRAimFAJ0UhS1YvCd5zQNOCWJ5ouyWCvITiQCcCrP5
NKC98AVOeg5fgkU4yZcXvIM=
=2rC7
-----END PGP SIGNATURE-----


Similar ThreadsPosted
Problem with set_sql in Class::DBI::Loader::mysql March 22, 2006, 2:47 pm
XML::Generator::DBI and NULL values in columns, oh my! March 9, 2006, 2:24 pm
PDF::Table October 21, 2005, 10:32 pm
CGI.PM and print table April 13, 2008, 1:18 pm
WWW::Authen::Simple table lookup June 8, 2005, 1:20 am
does SQL::Abstract only formulate queries for a single table? December 26, 2005, 5:52 am
Looking for AJAX HTML Table Form Module August 15, 2007, 11:29 am
Class::DBI::Schema2Code V 1.01 July 29, 2004, 7:14 am
Class::Tree V 1.24 July 29, 2004, 7:15 am
[RFC] Class::DataStore May 13, 2005, 2:45 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap