[further update: This was due to initial node.uid being reset by node_submit() function to 0, meaning that some subsequent queries failed, $node object passed needs to contain $node->name, $node->uid is not enough. A difficult spot as most queries still work and the node_revisions table has correct uid set!]
[update!: looks as though this is a revisioning issue, causing user to be set as 0 - effecting the SQL]
We're trying to execute the following SQL from within our custom module:
UPDATE node, content_field_collections SET node.language='en' WHERE node.tnid<>0 AND content_field_collections.nid = node.nid AND content_field_collections.field_collections_value =131
This runs just fine from PHPMyAdmin, but when executed from within the module it fails!
Thoughts are:
Is this a permissions issue of some kind?
Is there a limit on the number of db_query commands you can execute?
Any pointers appreciated :-)
Comments
Coding help.
http://heine.familiedeelstra.com/coding-help-tips point 1.
@ Heine - Point 4. Code is
@ Heine - Point 4. Code is supplied. Extended code is not required as this is an isolated SQL issue, to discuss the possible limitations of db_query or permissions that may cause a query to fail from within Drupal.
To answer your question No
To answer your question: No (if you have the same user) and No.
Let the support ping-pong commence.
What is the error you are
What is the error you are getting?
Contact me to contract me for D7 -> D10/11 migrations.
Thanks Jay. I doesn't throw
Thanks Jay. It doesn't throw any errors! It just fails to apply the text to the node.language field when executed from the module script.
Do you have any error message?
What type of error are you getting? If this is being passed directly to db_query then I think it's unlikely to be a permissions issue.
Is this D6 or D7?
Are you using table prefixes?
It would be worth enabling the devel module and turning on query logging to make sure that the query you think it's running is actually the one running against the DB (or is Drupal mangling it?).
Otherwise, add some debug into the db module (D6 would be includes/database/mysqli.inc) and see what it's doing/how far it gets.
nik
Looking into revisioning!
Node Author had slipped to User 0 - looks as though, due to revisioning (vid)
http://drupal.org/node/747816#comment-3426950
Solved
See further update note in original post.
node.uid issue, $node->name also required in object passed to node_submit() to retain $node->uid