我如何从Perl的DBI获取模式? [英] How do I get schemas from Perl's DBI?

查看:65
本文介绍了我如何从Perl的DBI获取模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Perl DBI 。我知道 $ dbase-> tables()将返回相应数据库中的所有表。同样,我想知道数据库中可用的架构。

I am using Perl DBI. I know that $dbase->tables() will return all the tables in the corresponding database. Likewise, I want to know the schemas available in the database. Is there any function available for that?

推荐答案

您正在寻找的是: DBI-> table_info()

像这样调用:

my $sth = $dbh->table_info('', '%', '');
my $schemas = $dbh->selectcol_arrayref($sth, {Columns => [2]});
print "Schemas: ", join ', ', @$schemas;

这篇关于我如何从Perl的DBI获取模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆