Re: Help Required regarding Database Operations



On Thu, Dec 29, 2005 at 06:26:59AM +0000, Bhavin Shah wrote:
> I am a novice user to PERL. Plz help me regarding
> following information
> Suppose there is a MySQL DB say X, with Server Y, User
> XY, Password XYZ and Table ABC.
> How do i get fieldsNAmes of a Table in a Array?

Something like

use DBI;
$dbh = DBI->connect("dbi:mysql:host=Y;database=X", "XY", "XYZ");

then either use the column_info() method or, if you're going to be
selecting from the table anyway, you could

$sth = $dbh->prepare("select * from Table");
@fieldsNAmes = @{$sth->{NAME}}; # or NAME_lc or NAME_uc

> Also for PHP as we have phpinfo() function, what is a
> similar function in PERL?

Perhaps the Config module has whatever it is you're looking for.

See also http://www.catb.org/~esr/faqs/smart-questions.html

Tim.
.



Relevant Pages

  • Re: Multiple Domains
    ... you only get one exchange. ... additional mailboxes with unique mailbox names. ... during the AM a worker is working for company ABC and needs to have only ABC ... Exchange Site running on a separate member server, ...
    (microsoft.public.windows.server.sbs)
  • Fwd: Cant connect to Sybase Rep server
    ... Can't connect to Sybase Rep server ... BTW - which version of DBI are you using? ... Objet: Re: Can't connect to Sybase Rep server ... Toute utilisation de ce ...
    (perl.dbi.users)
  • Re: Cant call method "prepare" on an undefined value
    ... Somehow you managed to have an undefined value instead of a DBI database handle in front of ->prepare, which is burried deep inside Oraperl.pm. ... Oracle HTTP Server at Server B. Both server are Solaris server. ... I have installed DBI and DBD into Server B and setup the oraperl in my perl script. ...
    (perl.dbi.users)
  • Re: Same two Domain Names in the same network
    ... DEF was switched off. ... When ABC was recreated newly with same name i.e. ... Did you add server DEF to xyz.com during installation or over "My Computer ... In ABC Exchange 5.5 was not able to upgrade to Exchange 2003. ...
    (microsoft.public.win2000.dns)
  • =?UTF-8?Q?RE=C2=A0:_Cant_connect_to_Sybase_Rep_server?=
    ... perl Makefile.PL ... Objet: Re: Can't connect to Sybase Rep server ... use DBI; ... Toute utilisation de ce ...
    (perl.dbi.users)