List:MySQL and Perl« Previous MessageNext Message »
From:Martin J. Evans Date:September 4 2006 4:50pm
Subject:RE: handling with variable
View as plain text  
Not actually tested but the basic principle is:

my $dbh = DBI->connect(...);
my $sth = $dbh->prepare(q/select col1, col2 from table where col3=1/);
my ($col1, $col2);
$sth->bind_col(1, \$col1);
$sth->bind_col(2, \$col2);
$sth->fetch;
my $result = $col1 + $col2;
$sth = $dbh->prepare(q/insert into table2 values(?)/);
$sth->execute($result);

Martin
--
Martin J. Evans
Easysoft Ltd, UK
http://www.easysoft.com


On 04-Sep-2006 Ruprecht Helms wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi,
> 
> how can I work with variables within a perl-script using DBI.
> I want to read content of tablefields into variables to compute with it.
> The result of the computing should be written into another field of
> another table.
> 
> A little scriplet would be nice.
> 
> Regards,
> Ruprecht
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2 (GNU/Linux)
> Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org
> 
> iD8DBQFE/D5yOAckbBgiIFcRAhEBAJsHhtJ40n2iafcrGq/Oxu31tD+sowCeIeuO
> wG1LN7ZuIZcK9vN7orYVHnE=
> =ZHde
> -----END PGP SIGNATURE-----
> 
> -- 
> MySQL Perl Mailing List
> For list archives: http://lists.mysql.com/perl
> To unsubscribe:   
> http://lists.mysql.com/perl?unsub=1
Thread
handling with variableRuprecht Helms4 Sep
  • RE: handling with variableMartin J. Evans4 Sep