|
Re: lug-bg: mySQL i bash script
- Subject: Re: lug-bg: mySQL i bash script
- From: mitko@xxxxxxx (Dimitar Peikov)
- Date: Wed, 3 Apr 2002 09:54:11 +0300
mysql -u username -ppassword database -e "show tables"
On Tue, 02 Apr 2002 19:23:38 -0500
Delyan Raychev <draychev@xxxxxx> wrote:
> E neka da ne e bash a perl. Mozhe li?
> Ako imash perl - eto neshto lesno...
>
> use DBI;
>
> my $dbh = DBI->connect('DBI:MySQL:DataBase')
> or die "Couldn't connect to database: " . DBI->errstr;
> my $sth = $dbh->prepare('SELECT * FROM people WHERE lastname =
> ?') or die "Couldn't prepare statement: " .
> $dbh->errstr;
>
>
> $sth->execute($lastname) # Execute the query
> or die "Couldn't execute statement: " . $sth->errstr;
>
> # Read the matching records and print them out
> while (@data = $sth->fetchrow_array()) {
> my $firstname = $data[1];
> my $id = $data[2];
> }
>
> $sth->finish;
>
> }
>
> $dbh->disconnect;
>
> Upseh!
>
> Delyan Raychev
> draychev@xxxxxx
>
> Konstantin Ivanov wrote:
>
> >Kak moga da napisha bash script s koito da pravia query-ta v mysql
> >baza danni, syshtoto sam go postignal s PGP prez web, no ne mi e
> >mnogo iasno kak da stane sys shell komandi.
> >
>
--
Dimitar Peikov
Programmer Analyst
Globalization Group
"We Build e-Business"
RILA Solutions
27 Building, Acad.G.Bonchev Str.
1113 Sofia, Bulgaria
phone: (+359 2) 9797320
phone: (+359 2) 9797300
fax: (+359 2) 9733355
http://www.rila.com
===========================================================================
A mail-list of Linux Users Group - Bulgaria (bulgarian linuxers)
http://www.linux-bulgaria.org/ Hosted by Internet Group Ltd. - Stara Zagora
|
|
|