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

Hi,

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')
 
  ->where('id'1)
 
  ->comments('comments here')
 
  ->get('user'); 

That would produce

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

or

Code:
/* 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.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB