Hi guys , I need to move big databa among databases.
I have been reading about improving performance with mysql prepared statements.
So far I dont understand why it is better neither how to use it.
Lets suppose I have the following "bring and insert data" procedure:
#!/usr/bin/perl use strict; use warnings; require DBI; ### #variables here my @big_data_array; ### foreach $id (@big_data_array){ $query1 = "SELECT * from database1.table WHERE id = '$ +id' my $sth1 = $dbh1->prepare($query1); $sth2->execute(); while (my @row = $sth1->fetchrow_array ) { $val1 = $row[0]; $val2=$row[1]; } $query2 = "insert into database2.table ('value1','valu +e2')". " VALUES('$val1','$val2')"; my $sth2 = $dbh2->prepare($query2); $sth2->execute(); }
Question is how to achieve same result using prepared statements ?
And why is it better ?
I will try to find more info about it.
Regards,
Leo.
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |