When I'm installing/enabling the External RDF Vocabulary Importer module, and it attempts to do an initial import of a few namespaces I get a full screen of errors. I'm using MySQL 5.1 and it appears to be a problem with the range field.
user warning: 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 'range) VALUES ('dc', 'title', 'Title', 'A name given to the resource.', '', '')' at line 1 query: INSERT INTO drupal_evoc_rdf_properties (prefix, id, label, comment, domain, range) VALUES ('dc', 'title', 'Title', 'A name given to the resource.', '', '') in /drupal/includes/common.inc on line 3422.
This record is inserted with drupal_write_record, so I'm not sure what could be done other than rename the field? If fields were surronded by `` in dwr then things work fine.
Comments
Comment #1
scor commentedso this might a bug in the drupal_write_record core function. There is a related issue at #266610: Function drupal_write_record() should enclose field names by backticks but it is currently "won't fix".
Comment #2
febbraro commentedI think you are likely right here, but not sure what to do about that.
What I did to get the functionality to work was I renamed the field 'range' (and all references to it) to rdf_range and it all worked great. Any chance you would agree with renaming to make it work on MySQL 5.1? If you think it is a good idea, just tell me the names you want I would gladly provide the patch that does the renaming.
Comment #3
febbraro commentedI think you are likely right here, but not sure what to do about that.
What I did to get the functionality to work was I renamed the field 'range' (and all references to it) to rdf_range and it all worked great. Any chance you would agree with renaming to make it work on MySQL 5.1? If you think it is a good idea, just tell me the names you want I would gladly provide the patch that does the renaming.
Comment #4
scor commentedthat's lame (drupal_write_record) but I don't see a work around. go ahead with rdf_domain and rdf_range then.
Comment #5
febbraro commentedGive this a review, let me know if you have any feedback
Comment #6
krao commentedFriend thanks for the patch, I was working properly.
Comment #7
scor commentedfixed
Comment #9
mswimmer commentedIt might be a good idea to make this patch permanent. In MySQL 5.1 the keyword 'range' is a reserved word (http://dev.mysql.com/doc/mysqld-version-reference/en/mysqld-version-refe...) and drupal doesn't put quotes around the column names when accessing them. This means that any SQL query with range in it will fail with an error. The patch does work, though I hope that Drupal starts putting column names in quotes as this would be safer.
Comment #10
scor commented@mswimmer: I suppose you're talking about Drupal's API functions in general? You're right, though with PHP PDO in Drupal 7, things have changed for the better so this should not be a problem anymore.