Archives quotidiennes :

Le bug corrigé

Voici la trace de debug générée par le plugin PDO. La requete rejouée dans sqlite manager me donnait 0. En fait pour sqlite il semblerait que ’08’=08 retourne false alors que la même requête avec jste l’année consdérait que ‘2008’=2008. Peut être un bug de ma version de sqlite.

Raw query:	SELECT  COUNT(*) FROM  wp_posts  WHERE 1=1  AND YEAR(wp_posts.post_date)=2008 AND MONTH(wp_posts.post_date)=08 AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish')  ORDER BY wp_posts.post_date DESC 
Rewritten: SELECT  COUNT(*) FROM  wp_posts  WHERE 1=1  AND strftime('%Y',wp_posts.post_date) =2008 AND strftime('%m',wp_posts.post_date) =08 AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish')  ORDER BY wp_posts.post_date DESC 
WITH Placeholders: SELECT  COUNT(*) FROM  wp_posts  WHERE 1=1  AND strftime( ? ,wp_posts.post_date) =2008 AND strftime( ? ,wp_posts.post_date) =08 AND wp_posts.post_type =  ?  AND (wp_posts.post_status =  ? )  ORDER BY wp_posts.post_date DESC  
PREPARE:	SELECT  COUNT(*) FROM  wp_posts  WHERE 1=1  AND strftime( ? ,wp_posts.post_date) =2008 AND strftime( ? ,wp_posts.post_date) =08 AND wp_posts.post_type =  ?  AND (wp_posts.post_status =  ? )  ORDER BY wp_posts.post_date DESC 
Executing:	 Array
(
    [0] => %Y
    [1] => %m
    [2] => post
    [3] => publish
)