• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Mysql query question about using active record

#4
[eluser]Derek Allard[/eluser]
That's really clever pyro... I never thought of that, but I need to warn you that it won't work pending the next update to AR.

Tell you what, what I've done is added 2 new functions into Active Record. They provide a way for a developer to write a raw, untouched where clauses.

Go grab
http://dev.ellislab.com/svn/CodeIgniter/...ve_rec.php

and replace your current system/database/db_active_rec.php file with it.

$this->db->raw_where();

Generates an unfiltered WHERE portion of the query exactly as the developer passes it. Separates multiple calls with AND
Code:
$this->db->raw_where('(grade > 50 AND grade < 75)');
// Produces: AND WHERE (grade > 50 AND grade < 75)

$this->db->raw_or_where();

Generates an unfiltered WHERE portion of the query exactly as the developer passes it. Separates multiple calls with OR
Code:
$this->db->raw_where('(grade > 50 AND grade < 75)');
// Produces: OR WHERE (grade > 50 AND grade < 75)

Note: All values passed through raw_where() and raw_or_where() are not escaped automatically, or otherwise touched. It is the responsibility of the developer to ensure all queries are safe.


Messages In This Thread
Mysql query question about using active record - by El Forum - 01-12-2008, 08:11 AM
Mysql query question about using active record - by El Forum - 01-12-2008, 08:22 AM
Mysql query question about using active record - by El Forum - 01-12-2008, 08:25 AM
Mysql query question about using active record - by El Forum - 01-12-2008, 09:01 AM
Mysql query question about using active record - by El Forum - 01-12-2008, 12:14 PM
Mysql query question about using active record - by El Forum - 01-14-2008, 06:05 AM
Mysql query question about using active record - by El Forum - 01-14-2008, 11:47 AM
Mysql query question about using active record - by El Forum - 08-29-2008, 12:14 AM
Mysql query question about using active record - by El Forum - 08-29-2008, 06:21 AM
Mysql query question about using active record - by El Forum - 08-31-2008, 08:24 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.