Commit graph

21 commits

Author SHA1 Message Date
Denis Knauf 08d1610987 optimizer optimized (AND[Or["abc"]] -> "abc"). ()-bugfix in where-clause. 2012-01-18 13:34:26 +01:00
Denis Knauf ce81d21bd8 v0.0.5.2. build-methods renamed to an underscored class-name with suffix _build and aliases build to these methods created. equal_join_build fixed; it never use col.joins.each. #foreigh_key 2012-01-17 10:52:31 +01:00
Denis Knauf 27639e24b7 #join: ",".to_alias OPS! 2012-01-16 12:52:01 +01:00
Denis Knauf f6b9579073 over-datanamelen-bug fixed 2012-01-12 16:54:51 +01:00
Denis Knauf 3ba285548c patch fix 2011-12-05 12:39:41 +01:00
Denis Knauf 3d08496ec4 ( ( ) ( ) ) 2011-11-30 16:20:56 +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 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 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