SQL debugging tip

When you’re using a lot of SQL from a programming language (be it PHP or C++), put comments inside all your queries indicating which function executed them. That way, logging becomes much more useful, like this:

sqlite3_trace: SELECT /* createobject uniquecontext */ content FROM objects WHERE id=4

(I did not come up with this trick - but it is useful enough to post here anyway.)