Commit graph

19 commits

Author SHA1 Message Date
Denis Knauf 3d08496ec4 ( ( ) ( ) ) 2011-11-30 16:20:56 +01:00
Denis Knauf edcc68a4ed dependency to methodphitamine removed. 2011-11-30 13:52:19 +01:00
Denis Knauf 080237c5d7 bugfixes: ranges, vid===Symbol, And/Or in NotInRange 2011-11-28 15:47:48 +01:00
Denis Knauf 63be31734b debugging removed 2011-11-22 12:14:22 +01:00
Denis Knauf 69aceef180 aliased tables. firm: { "people[users]": {type: "User"}, "people[old]": {"age>:": 50 } # Every ToDo which has a User as Person or people older than 50. It is not an OR, it is an AND, but {people:{type:"User","age>":50}} or {"people":{type:"User"},"people":{"age>:":50} means every User older than 50. "users" and "old" are independet questions and both must be present, if firm should be true. 2011-11-21 10:06:46 +01:00
Denis Knauf 8eebb3ac1f VERSION 0.0.4.3 2011-10-27 15:28:34 +02:00
Denis Knauf 5c68b74ee4 lesser logging. order-bug fixed 2011-10-27 15:21:56 +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 8eeb66d99f order by subnodes 2011-10-25 14:30:09 +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 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 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 967ac14819 logger in Rails fixed 2011-09-11 12:39:13 +02:00
Denis Knauf c61dbfe31d init 2011-09-08 17:03:52 +02:00