By jmm42 on
Can someone translate this syntax:
db_delete('artwork')
->condition('aid', $aids, 'IN')
->executeinto an equivalent SQL command syntax?
This is my interpretation:
DELETE FROM {artwork} WHERE (aid = $aid)
Or, would it be:
DELETE FROM {artwork} WHERE aid IN ($aids)
But, I'm kind of confused with the 'IN' parameter.
Comments
Not the former
Based on: http://drupal.org/node/310081, the former is incorrect.
From:
I am confident that the latter is correct based on the API:
However, may be 'slightly' off. It can be verified by issuing the following line:
print (string)$query;in place of:
->execute();As suggested by - http://tiger-fish.com/blog/drupal-7-debugging-sql-queries
$aids is an array (it should
$aids is an array (it should be when you are using it with IN, or else a simple = can be used).
If $aids is this:
Which means delete when the aid is either 1, 30 or 432.
Contact me to contract me for D7 -> D10/11 migrations.