j4mie/idiorm — pull request #59 by brianherbert (2012-05-21 03:54:40+00:00)
Title: Adds the ability to keep specific fields raw when inserting and updating

Usage on INSERT:
```php
$location = ORM::for_table('locations')->create();
$location->keep_raw('lat_lon');
$location->fsq_venue_id = $fsq_venue_id;
$location->lat_lon = "GeomFromText('POINT($lat $lon)')";
$location->name = $name;
$location->save();
```

Usage on UPDATE:
```php
$location = ORM::for_table('locations')->find_one($location->id());
$location->keep_raw('lat_lon');
$location->lat_lon = "GeomFromText('POINT(1.2347 2.3436)')";
$location->name = 'modified name';
$location->save();
```

The keep_raw() function allows you to use special functionality provided by MySQL (and other DBs compatible with Idiorm) without forcing the developer to write a raw query. Of course it's still up to the developer to validate and protect themselves when using any raw functionality but this make code much cleaner and easier to read.

There's a new variable in the ORM class, $_keep_raw which holds a list of column names that the dev wants to keep raw. This is used in building placeholders (used by inserts) and when building updates directly. It's also used in save() to determine which variables to prepare.