Commit Graph

29 Commits

Author SHA1 Message Date
yuuji.yaginuma
9d43a84f73 Make sanitize_sql_ methods public
Currently, sanitize methods are private. So need `send` to use from
outside class.
However, sometimes want to use sanitize methods from outside Class when
want to generate SQL including multiple tables like search.
In order to avoid using `send` in such a case, changed methods to public.
2017-12-13 07:54:25 +09:00
Rafael Mendonça França
82472b3922
Remove deprecated support to quoted_id when typecasting an Active Record object 2017-10-23 12:50:45 -04:00
Kir Shatrov
831be98f9a Use frozen-string-literal in ActiveRecord 2017-07-19 22:27:07 +03:00
Matthew Draper
87b3e226d6 Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
2017-07-02 02:15:17 +09:30
Kir Shatrov
cfade1ec7e Enforce frozen string in Rubocop 2017-07-01 02:11:03 +03:00
Ryuta Kamizono
d15527800f Deprecate using #quoted_id in quoting
Originally `quoted_id` was used in legacy quoting mechanism. Now we use
type casting mechanism for that. Let's deprecate `quoted_id`.
2017-02-24 06:56:06 +09:00
Rafael Mendonça França
fe1f4b2ad5
Add more rubocop rules about whitespaces 2016-10-29 01:17:49 -02:00
Xavier Noria
411ccbdab2 remove redundant curlies from hash arguments 2016-08-06 19:44:11 +02:00
Xavier Noria
d22e522179 modernizes hash syntax in activerecord 2016-08-06 19:37:57 +02:00
Xavier Noria
9617db2078 applies new string literal convention in activerecord/test
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 18:26:53 +02:00
Sean Griffin
ef2744dd94 Merge pull request #22209 from yui-knk/add_test_sanitize_sql_array_handles_named_bind_variables
Add test cases for `#sanitize_sql_array` with named_bind_variables
2015-12-14 07:42:32 -07:00
yui-knk
6aec925e16 Remove some bind related test cases from finder_test.rb to sanitize_test.rb
`replace_named_bind_variables` and `replace_bind_variables` are
definded in `sanitization.rb`, so it is reasonable these tests are
on `sanitize_test.rb`.
2015-11-21 11:34:36 +09:00
yui-knk
49ff2ba2fe Add test cases for #sanitize_sql_array with named_bind_variables
And add code examples to `sanitize_sql_for_conditions`,
`sanitize_sql_for_assignment`, and `sanitize_sql_array`.
2015-11-09 21:30:54 +09:00
yui-knk
14d265217a Quote prepared statements of sanitize_sql_array
Sure unquoted SQL code pass test, but this % style prepared statements
are dangerous. Test codes and code examples are also "Rails" codes,
so quote placeholder of prepared statements.
2015-09-25 08:49:57 +09:00
Rafael Mendonça França
3a59dd2123 Remove deprecated sanitize_sql_hash_for_conditions 2015-01-04 11:58:44 -03:00
Sean Griffin
999a07e3b9 Add an assert_deprecated for sanitize_sql_hash_for_conditions 2014-11-02 14:01:57 -07:00
Kuldeep Aggarwal
03042b0476 remove warning
`warning: ambiguous first argument; put parentheses or even spaces`
2014-04-18 23:15:42 +05:30
Yves Senn
973a45230a sanitize_sql_like escapes escape_character not only backslash.
* This is a follow up to: fe4b0eee05f59831e1468ed50f55fbad0ce11e1d
* The originating PR is #14222
* It should fix the build
2014-04-16 16:53:01 +02:00
Rob Gilson
fe4b0eee05 SQL Like escaping helper method. [Rob Gilson & Yves Senn]
Closes #14222.

This is a follow up to #6104

This does not have the backwards compatibility issues brought up in
implementation to break.
2014-04-16 14:32:02 +02:00
Dmitry Polushkin
ec43584431 add activerecord test coverage for sanitize_sql_array
check it is handles empty statement
2014-02-09 12:05:42 +00:00
Paul Nikitochkin
a2ed5d2381 Process sub-query relation's binding values
Generated sub-query for Relation as array condition for `where` method
did not take in account its bind values, in result generates invalid SQL query.

Fixed by adding sub-query relation's binding values to base relation

Closes: #12586
2013-10-20 21:07:07 +03:00
Paul Nikitochkin
bc293ff690 Generate subquery for Relation passed as array condition for where
Instead of executing 2 queries for fetching records filtered by array condition with Relation,
added generation of subquery to current query.

This behaviour will be consistent when passes Relation as hash condition to where

Closes: #12415
2013-10-13 22:13:50 +03:00
Yasuo Honda
798cf2b9ef Remove current_adapter? from test_sanitize_sql_hash_handles_associations
Because of each adapter implementation differences,
`expected_value` string needed to be handled by each adapter.
This commit removes current_adapter
by using ActiveRecord::ConnectionAdapters::Quoting methods.
2013-05-08 06:40:15 +09:00
Rafael Mendonça França
0f97ac6647 Fix test asserting the sanitized SQL hash differently to some adapters 2013-05-06 22:02:34 -03:00
Zach Ohlgren
a6bc35c82c Fix bug in ActiveRecord::Sanitization#sanitize_sql_hash_for_conditions
Fixing CHANGLOG description

Remove extra line.

Remove blank lines.
2013-05-06 17:03:18 -07:00
Aaron Patterson
61774e0d49 please use ruby -I lib:test path/to/test.rb, or export RUBY_OPT 2011-06-06 15:47:13 -07:00
Jon Leighton
253bb6b926 Refactor Active Record test connection setup. Please see the RUNNING_UNIT_TESTS file for details, but essentially you can now configure things in test/config.yml. You can also run tests directly via the command line, e.g. ruby path/to/test.rb (no rake needed, uses default db connection from test/config.yml). This will help us fix the CI by enabling us to isolate the different Rails versions to different databases. 2011-06-04 23:47:03 +01:00
Manfred Stienstra
1585a7ed02 Change all calls to String#chars to String#mb_chars. 2008-09-21 18:01:15 +02:00
Manfred Stienstra
babbc1580d Fix ActiveRecord::Base.quote_bound_value for ActiveSupper::Multibyte::Chars values.
- Adds String#acts_like_string?
- Adds Chars#acts_like_string?

Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#1029 state:committed]
2008-09-11 22:51:26 +02:00