
douglazb
Novice
Dec 18, 2009, 10:12 AM
Post #1 of 3
(3346 views)
|
|
How to view query being sent via DBI module
|
Can't Post
|
|
I want to delete all records that were added 180 days ago or earlier. My query deletes all dates, not just dates younger then 6-months ago. How can I view the query that is being sent? I.e. print "$query_handle->execute($source , $year+1900,$mon-5,$mday,$hour,$min,$sec)\n"; does not work.
# Insert article into rolling180days table $query = "INSERT INTO `dev`.`rolling180days` (`name`, `article`, `source`, `url`, `dateadded`) VALUES ( ?, ?, ?, ?, NOW( ) )"; $query_handle = $connect->prepare($query); $query_handle->execute( $person , $stringexpanding , $source , $url); # Delete records older then 180 days from rolling180days table $query = "DELETE FROM `dev`.`rolling180days` WHERE `rolling180days`.`source` = ? AND `rolling180days`.`dateadded` < ? ? ? ? ? ?"; $query_handle = $connect->prepare($query); my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time); $query_handle->execute($source , $year+1900,$mon-5,$mday,$hour,$min,$sec);
|