Welcome Guest, Not a member yet? Register   Sign In
DB / Active Record comments


It would be extremely useful if we could add comments to SQL queries out of the box without hacky solutions:

PHP Code:
$this->db->select('id, name')
  ->comments('comments here')

That would produce

SELECT id, name FROM user WHERE id = 1 -- comments here


/* comments here */ SELECT id, name FROM user WHERE id = 1

These comments will show up both in built in profiler and in SQL slow query log and would make it easier and cleaner to figure out where problematic queries originate from.

Similar functionality could be achieved by messing around with select and where statements if you ignore escape function, but it just feels messy.

Would be nice to see this little feature implemented in ver 4.

Theme © iAndrew 2016 - Forum software by © MyBB