Commit Graph

19 Commits (subqueries)

Author SHA1 Message Date
Denis Knauf 3b60648ee7 Version 0.0.4.3 2011-10-27 15:22:49 +02:00
Denis Knauf f9ee0754f1 Version 0.0.4.2 2011-10-27 14:26:53 +02:00
Denis Knauf f3bcdd4b25 has_one-reflection (like has_many), group & having. subqueries deactivated 2011-10-25 16:31:18 +02:00
Denis Knauf d5aa6052ec lesser debug 2011-10-06 15:28:40 +02:00
Denis Knauf 11466211ac group and having clause init 2011-10-06 13:27:41 +02:00
Denis Knauf cc49fdefe9 v0.0.4.1 2011-10-06 13:24:44 +02:00
Denis Knauf 863ebca9cd fixes: OR... 2011-10-06 13:24:17 +02:00
Denis Knauf 09dfa782a8 debugging-output removed 2011-10-05 14:53:34 +02:00
Denis Knauf 75c314159b v0.0.4 2011-10-05 14:06:50 +02:00
Denis Knauf 2fdc45d1d5 "self" and or
=============

This lines mean the same:

	User.smql :self => {:id => 1}
	User.smql :id => 1
	User.smql 'self.id' => 1
	User.smql 'self.self.self.self.id' => 1

self is like a reflection to itself.

Very userful if you need the new disjunction:

	User.smql :self => [{:surname => 'Mueller', :givenname => 'Michael'}, {:givenname => 'Horst', :surname => 'Schlemmer'}], :firm => {:name => 'Hotel an der Elbe'}

SmqlToAR::Column
----------------

Rejects every `self`,  so it is really like no self,
but you use `'self'` as like as a simple reflection.
You can ask,  if it is self via Column#self?

SmqlToAR::QueryBuilder
======================

joins:  The old `#join`. Renames because SmqlToAR::And and SmqlToAR::Or which has Array#join,
        so we cannot delegate `#join` to the QueryBuilder.

`#where`
--------

Now only one argument!  Needed for SmqlToAR::And and SmqlToAR::Or.

`#build` will generates LEFT OUTER JOINS now.  Needed for disjunctions.
The most queries will work like before.
Problems:

	User.smql :articles => {}

Before it will return all users with articles,  now it will return also users without articles.
If you want to have only all users with articles,  you ask:

	User.smql :articles => {:id => true}

Will fail if id IS NULL,  but this should not happen. ;)

`SmqlToAR::And` and `SmqlToAR::Or`
==================================

`SmqlToAR::QueryBuilder`-proxies.  QueryBuilder let them build where-clauses.
And will will produce a conjunction and  Or a disjunction of course.
They delegates all QueryBuilder-methods to QueryBuilder.
Only `#where` will stored local and `#build` will do it partial.

They have the same superclass: `SmqlToAR::SubBuilder`.

The small changes
=================

* `SmqlToAR.reload_library`:  Reloads SmqlToAR-lib.  Useful while development.
* `SmqlToAR::ConditionTypes#conditions`:  Return all Conditions.  `#try_parse` uses it.
* Some classes have a new `#inspect`.
* `SmqlToAR::ConditionTypes#Exists` / `NotExists`:
  `{:id => true}` / `{:id => false}`:
  This object has setted an id or not?  `#id` must exists as column of course!
	Uses `IS NOT NULL` and `IS NULL`.
2011-10-05 13:25:56 +02:00
Denis Knauf 93fd3eeda4 pretty_print removed 2011-09-27 16:51:18 +02:00
Denis Knauf db5bbcb93a AR-through-reflections in query_builder; SmqlToAR.models returns the reflections-graph; limit, offset, sub-query "()" (not sub-conditions). unstable 0.3 2011-09-27 16:35:49 +02:00
Denis Knauf 8144c72284 0.0.2: lesser logging; IN-clauses fixed ("table"."table.id"-bug) 2011-09-16 14:55:05 +02:00
Denis Knauf 28fcd2c6ae lesser debug 2011-09-11 12:44:16 +02:00
Denis Knauf b20deed92e v0.0.1 2011-09-11 12:39:51 +02:00
Denis Knauf 967ac14819 logger in Rails fixed 2011-09-11 12:39:13 +02:00
Denis Knauf 553833ded9 readme: translationfixes 2011-09-09 00:05:43 +02:00
Denis Knauf e3df066c3a readme: translationfixes 2011-09-09 00:02:24 +02:00
Denis Knauf c61dbfe31d init 2011-09-08 17:03:52 +02:00