Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: Is bind useful for one-time queries and commands?

by sabari (Beadle)
on May 20, 2008 at 11:34 UTC ( #687584=note: print w/ replies, xml ) Need Help??


in reply to Re: Is bind useful for one-time queries and commands?
in thread Is bind useful for one-time queries and commands?

Dear Friends,
I am very new to perl ,can any one post the sample code for the database operation with bind ?.

Best Regards, S.Sabarinathan,


Comment on Re^2: Is bind useful for one-time queries and commands?
Replies are listed 'Best First'.
Re^3: Is bind useful for one-time queries and commands?
by sathiya.sw (Monk) on Nov 19, 2008 at 14:06 UTC
    check the following sample code ( for sabari )..
    #Establish the connection to the database. my $dbh = DBI->connect( 'dbi:Pg:database=test','test','1234',{RaiseErr +or => 1,AutoCommit => 0}) || die "Database connection not made: $DBI::errstr"; #It get the port number and IP address from the data base. my $sql = qq{ SELECT port,ipaddr,log_file FROM details where name='$na +me'}; my $sth = $dbh->prepare( $sql ); $sth->execute(); #bind_columns - It stored the port number and IP address to variable. my( $port, $ipaddr,$log_file ); $sth->bind_columns(\$port, \$ipaddr,\$log_file); #It fetch the values from table $sth->fetch(); $sth->finish(); #Dis-connect the database,if we miss it tells warnings, that destroy h +ad been #called with out disconnect. $dbh->disconnect();

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://687584]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2015-07-29 10:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (263 votes), past polls