[CDBI] How to retrieve meta information from database: not null, default, ...?

David Baird lists.riverside at gmail.com
Mon Sep 12 22:29:33 BST 2005


On 12 Sep 2005 07:53:51 -0700, Randal L. Schwartz <merlyn at stonehenge.com> wrote:
> >>>>> "Alex" == Alex Aminoff <alex at basespace.net> writes:
> 
> Alex> Is there some sort of plugin that does this?
> 
> Call $dbh->column_info("","",$table,$column)->fetchall_arrayref({})
> and dump the resulting data structure.  Perhaps the IS_NULLABLE and
> COLUMN_DEF info will give you what you want.
> 

There's a couple of helper classes in CDBI::FormBuilder that
encapsulate this. They can be used independently of CDBI::FB, maybe I
should release them separately. Very sparse docs I'm afraid.
Use CDBI::FB::Meta::Table to set up the metadata. Its column() method
returns CDBI::FB::Meta::Column objects. Tweak the list of metadata
you're interested in at the top of CDBI::FB::M::Column.

d.




More information about the ClassDBI mailing list