summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.markdown13
1 files changed, 13 insertions, 0 deletions
diff --git a/README.markdown b/README.markdown
index 968e722..8aa1c7d 100644
--- a/README.markdown
+++ b/README.markdown
@@ -25,6 +25,11 @@ Features
Changelog
---------
+#### 1.3.0 - release XXXX-XX-XX
+
+* Add in raw_execute - closes issue 40 [[tag](https://github.com/tag)]
+* Add query logging to `delete_many` [[tag](https://github.com/tag)]
+
#### 1.2.1 - release 2012-11-15
* Fix minor bug caused by IdiormStringException not extending Exception
@@ -393,6 +398,8 @@ The other functions (`AVG`, `MAX` and `SUM`) work in exactly the same manner. Su
#### Raw queries ####
+##### Return Idiorm instances #####
+
If you need to perform more complex queries, you can completely specify the query to execute by using the `raw_query` method. This method takes a string and optionally an array of parameters. The string can contain placeholders, either in question mark or named placeholder syntax, which will be used to bind the parameters to the query.
$people = ORM::for_table('person')->raw_query('SELECT p.* FROM person p JOIN role r ON p.role_id = r.id WHERE r.name = :role', array('role' => 'janitor'))->find_many();
@@ -401,6 +408,12 @@ The ORM class instance(s) returned will contain data for all the columns returne
Note that using `raw_query` is advanced and possibly dangerous, and Idiorm does not make any attempt to protect you from making errors when using this method. If you find yourself calling `raw_query` often, you may have misunderstood the purpose of using an ORM, or your application may be too complex for Idiorm. Consider using a more full-featured database abstraction system.
+##### Direct PDO access raw queries #####
+
+It is possible to skip Idiorm's query building system altogether by using `raw_execute`. You will not get an Idiorm instance as a result and it is also potentially dangerous just like the method above.
+
+ $people = ORM::raw_execute('INSERT OR REPLACE INTO `widget` (`id`, `name`) SELECT `id`, `name` FROM `other_table` WHERE id = ?', array(10));
+
### Getting data from objects ###
Once you've got a set of records (objects) back from a query, you can access properties on those objects (the values stored in the columns in its corresponding table) in two ways: by using the `get` method, or simply by accessing the property on the object directly: