| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|
|
|
|
|
|
|
| |
The only reason we're using strings is to pre-populate the cache, but
`Class#name` returns a new string instance on every call. This is a
pretty major source of memory usage. We don't technically need to
pre-populate the cache, and not doing so allows us to go back to using
cache objects
|
|
|
|
|
|
|
|
|
|
|
|
| |
This removes the need for us to do the re-ordering by walking the AST in
ActiveRecord. We're using a block to communicate with the collector,
since the collector needs to be the thing which knows about the index,
while the visitor is the thing that needs to know the syntax. The
BindParam needs to know about neither of these things, so it's been
changed to stop being a subclass of SqlLiteral
I could also see an alternative implementation using format strings if
for some reason blocks cause a problem.
|
|
|
|
|
|
|
| |
The goal of these methods should be to generate in nodes, not handle
every possible permutation of more than one value. The `#between` and
`#not_between` methods have been extracted, which better represent the
semantics of handling ranges in SQL.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently, doing
```ruby
relation[:id].not_eq(4).and(relation[:id].not_in(1..3))
```
will generate
```sql
"id" != 4 AND "id" < 1 OR "id" > 3
```
Which would incorrectly include records with an id of 4, as the OR
statement has higher precidence than the AND statement. The `or`
method on `Node` properly groups the statement in parenthesis.
|
| |
|
|
|
|
|
|
|
| |
visitors are not shared among threads, so any mutations to the cache
should be OK. The cache is also pre-populated on construction, but we
should pull that out so we can share the cache among visitors in the
future.
|
| |
|
|\
| |
| | |
Added a visitor for Set objects
|
| | |
|
|\ \
| | |
| | | |
Wrap nested Nodes::Grouping in brackets only once
|
| | | |
|
| | |
| | |
| | |
| | | |
- Fix typo: `test_opertaion_ordering` => `test_operation_ordering`
|
| | | |
|
|/ / |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
An equality with a string column and integer like
SELECT * FROM `users` WHERE `login_token` = 0 LIMIT 1;
will match match any string that doesn't start with a digit in certain
databases, like mysql. Make sure we quote the integer to avoid this
problem in a database independant way.
|
| | |
|
| |
| |
| |
| | |
this lets our old depth first and dot visitors to work normally
|
|\ \
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
* master:
remove order_clauses since we do not use it
fix whitespace and unsupported method args
Add Regexp and NotRegexp nodes for PostgreSQL
Revert "Merge pull request #253 from corrupt952/master"
flatten object.children in visit_Arel_Node_And
Added right and full outer joins
Conflicts:
lib/arel/visitors/to_sql.rb
lib/arel/visitors/visitor.rb
|
| | | |
|
| | |
| | |
| | |
| | |
| | | |
This reverts commit 6d3ed6d96c4a3ac85b97d81bad95b7254b2aa2d4, reversing
changes made to a35fede61ac1a2fcff519ad052f2fcb8808922b9.
|
| | | |
|
| | | |
|
|/ / |
|
| |
| |
| |
| | |
also fixed the test case for : test/visitors/test_to_sql.rb:22 which pass in the parameter attribute e.g the parameter a.
|
| |
| |
| |
| |
| | |
If we add the casting node to the ast at build time, then we can avoid
doing the lookup at visit time.
|
| |
| |
| |
| | |
The evaluates the assignment of two unqualified columns.
|
| | |
|
| |
| |
| |
| | |
using matches() or does_not_match().
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The last_column feature of the ToSql visitor and its descendants is what
enabled quoting based on the column last visited -- in other words, if
you have a standard condition like an equality with a string attribute
on the left side and an integer on the right side, then when ARel visits
the node, it'll first visit the left side attribute, setting the
column of the string attribute as the last column, and resulting in the
right side of the condition getting the appropriate quoting.
The downside is that this means that visitors can't be shared between
threads, because of the state mutation. It also makes for some really
weird behavior in the event that the visitor visits a node that happens
to contain an attribute you weren't expecting to be there, since it'll
potentially quote something based on that attribute. So, it prevents
reversing an equality condition. column = value will work, but not value
= column, since the last column wouldn't be the column you're hoping
for.
This is a first pass at fixing this by changing the signature of the
visit methods to accept the currently-relevant attribute, if any.
|
| | |
|
|\ \
| | |
| | | |
bugfix: some aggregations lacked DISTINCT emission
|
| |/ |
|
|/ |
|
|
|
|
| |
This is in response to discussion on 62207fa
|
| |
|
| |
|
| |
|
|
|
|
| |
generating SQL, rather than the TreeManager. (There is a related commit coming in Active Record.)
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is useful for dynamically created predicates e.g:
expr1 = table.create_false
expr2 = table.create_false
expr1 = create_a_predicate() if some_condition
expr2 = create_another_predicate() if some_other_condition
table.where(expr1.and(expr2))
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
Because the ToSql visitor instance is shared across all threads, there is a
race condition around column types for binary nodes. It's possible, for instance,
to end up with ActiveRecord converting a string value in the final SQL to an
integer during heavy concurrent operations.
|
| |
|
| |
|
|\
| |
| |
| |
| | |
* 'master' of github.com:rails/arel:
Add an #table_name method to Table and TableAlias, which always returns the actual table name, not the alias. Then fix ToSql#column_for to use this table name when checking whether the table exists (rather than before, where it was checking whether a table with the alias name exists, which was incorrect).
|
| |
| |
| |
| | |
actual table name, not the alias. Then fix ToSql#column_for to use this table name when checking whether the table exists (rather than before, where it was checking whether a table with the alias name exists, which was incorrect).
|
|\ \
| |/
|/|
| |
| | |
* stiff/master:
implemented support for math operations in numeric attributes
|