Hi,

I have been trying to generate sitemap after selecting the content type and specifying start node and end node id. But I keep getting this error:

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IMAGE/PNG 'image/png', 'image/jpg', 'image/gif', 'image/jpeg') ORDER BY n.creat' at line 3: SELECT n.nid AS nid, n.created AS created, n.title AS title, f.uri AS uri FROM {node} n INNER JOIN {file_usage} fu ON n.nid = fu.id INNER JOIN {file_managed} f ON fu.fid = f.fid WHERE (n.type = :db_condition_placeholder_0) AND (n.status = :db_condition_placeholder_1) AND (f.filemime IMAGE/PNG :db_condition_placeholder_2_0, :db_condition_placeholder_2_1, :db_condition_placeholder_2_2, :db_condition_placeholder_2_3) ORDER BY n.created DESC, f.timestamp DESC LIMIT 24 OFFSET 0; Array ( [:db_condition_placeholder_0] => photo [:db_condition_placeholder_1] => 1 [:db_condition_placeholder_2_0] => image/png [:db_condition_placeholder_2_1] => image/jpg [:db_condition_placeholder_2_2] => image/gif [:db_condition_placeholder_2_3] => image/jpeg ) in _google_image_sitemap_build() (line 274 of ../public_html/drupal/sites/all/modules/google_image_sitemap/google_image_sitemap.module).

Any help would be appreciated.

Thanks

CommentFileSizeAuthor
#2 google_image_sitemap-7.x-1.0.zip11.82 KBCowBoy

Comments

CowBoy’s picture

Category: support » bug

I have the same problem when I try generating the Image Sitemap:

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IMAGE/PNG 'image/png', 'image/jpg', 'image/gif', 'image/jpeg') ORDER BY n.creat' at line 3: SELECT n.nid AS nid, n.created AS created, n.title AS title, f.uri AS uri FROM {node} n INNER JOIN {file_usage} fu ON n.nid = fu.id INNER JOIN {file_managed} f ON fu.fid = f.fid WHERE (n.type = :db_condition_placeholder_0) AND (n.status = :db_condition_placeholder_1) AND (f.filemime IMAGE/PNG :db_condition_placeholder_2_0, :db_condition_placeholder_2_1, :db_condition_placeholder_2_2, :db_condition_placeholder_2_3) ORDER BY n.created DESC, f.timestamp DESC LIMIT 200 OFFSET 4; Array ( [:db_condition_placeholder_0] => automjet [:db_condition_placeholder_1] => 1 [:db_condition_placeholder_2_0] => image/png [:db_condition_placeholder_2_1] => image/jpg [:db_condition_placeholder_2_2] => image/gif [:db_condition_placeholder_2_3] => image/jpeg ) in _google_image_sitemap_build() (line 274 of /home/www[folder]/public_html/sites/all/modules/google_image_sitemap/google_image_sitemap.module).
The website encountered an unexpected error. Please try again later.

Thanks in advance!

CowBoy’s picture

Assigned: Unassigned » CowBoy
Status: Active » Fixed
Issue tags: +image, +google, +xml, +sitemap, +fix
StatusFileSize
new11.82 KB

Just install the module and edit it. Replace line 270 of the code as shown:

1) - To be replaced: $query->condition('f.filemime', array('image/png', 'image/jpg', 'image/gif', 'image/jpeg'), 'image/png');

- Replace with: $query->condition('f.filemime', array('image/png', 'image/jpg', 'image/gif', 'image/jpeg'), 'IN');

2) Or download the attached module installation file and use it with your Drupal 7.x.

A big thanks goes to the developers of this module!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

FAAREIA’s picture

Priority: Normal » Critical
Status: Closed (fixed) » Needs review

Thanks cowboy, it work for me.
I'll change the status and see what others said about this patch.

zionduc’s picture

CowBoy's patch works fine for me too.
Thank you for this module and for this patch.

amitgoyal’s picture

Status: Needs review » Closed (fixed)

Thanks CowBoy! This has been incorporated in the new release 7.x-1.1.