Hello,
Attached is a tiny patch to use db_placeholder() instead of implode() in tac_lite_node_access_records(). I'm using this patch on a development instance and it's been working fine.
Thanks for all your work on tac_lite!
-G
| Comment | File | Size | Author |
|---|---|---|---|
| tac-lite-6.x-db-placeholder.patch | 788 bytes | gdl |
Comments
Comment #1
Dave Cohen commentedNice. But shouldn't just the calls the
implode()be replaced? The query string should still have the%splaceholders, right?Comment #2
gdl commentedNope. db_placeholders returns a string of type-appropriate placeholders, one placeholder for each element in an array. Since the elements of the arrays $vids or $all_tids are integers, it will create a string like "%d, %d, %d" for the $vids = (1,2,3). These placeholders will be filled by db_query with the appropriate values from the arrays passed as arguments to it.
I hope that's a good explanation!
-G
Comment #3
AlexisWilke commentedDave,
db_query() knows how to handle arrays. In gdl example the (1, 2, 3) can come from $vid = { 1, 2, 3 };
Actually, many Core and 3rd party modules use array to generate an SQL statement that varies (i.e. if you add a WHERE nid = %d then you need a corresponding item in the array.)
Thank you.
Alexis
Comment #4
Dave Cohen commentedMakes sense, thanks. I'll get it in there.
Comment #5
vladimirausDrupal 6 is no longer supported.