IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
313 | 313 | """ |
314 | 314 | raise NotImplementedError('subclasses of BaseDatabaseOperations may require a quote_name() method') |
315 | 315 | |
| 316 | def adapt_param(self, param): |
| 317 | """ |
| 318 | Returns adapted version of parameter. |
| 319 | """ |
| 320 | return param |
| 321 | |
316 | 322 | def random_function_sql(self): |
317 | 323 | """ |
318 | 324 | Returns an SQL expression that returns a random value. |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
1 | 1 | from __future__ import unicode_literals |
2 | 2 | |
| 3 | from psycopg2.extensions import adapt |
3 | 4 | from psycopg2.extras import Inet |
4 | 5 | |
5 | 6 | from django.conf import settings |
… |
… |
|
93 | 94 | if name.startswith('"') and name.endswith('"'): |
94 | 95 | return name # Quoting once is enough. |
95 | 96 | return '"%s"' % name |
| 97 | |
| 98 | def adapt_param(self, param): |
| 99 | return adapt(param).getquoted() |
96 | 100 | |
97 | 101 | def set_time_zone_sql(self): |
98 | 102 | return "SET TIME ZONE %s" |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
476 | 476 | raise EmptyResultSet |
477 | 477 | return nested_sql |
478 | 478 | |
| 479 | def as_quoted_sql(self): |
| 480 | """ |
| 481 | Returns SQL for this query with adapted parameters to use in string representation. |
| 482 | """ |
| 483 | sql, params = self.as_sql() |
| 484 | return sql, tuple(self.connection.ops.adapt_param(param) for param in params) |
| 485 | |
479 | 486 | def get_default_columns(self, start_alias=None, opts=None, from_parent=None): |
480 | 487 | """ |
481 | 488 | Computes the default columns for selecting every field in the base |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
216 | 216 | """ |
217 | 217 | Returns the query as a string of SQL with the parameter values |
218 | 218 | substituted in (use sql_with_params() to see the unsubstituted string). |
219 | | |
220 | | Parameter values won't necessarily be quoted correctly, since that is |
221 | | done by the database interface at execution time. |
222 | 219 | """ |
223 | 220 | sql, params = self.sql_with_params() |
224 | 221 | return sql % params |
… |
… |
|
228 | 225 | Returns the query as an SQL string and the parameters that will be |
229 | 226 | substituted into the query. |
230 | 227 | """ |
231 | | return self.get_compiler(DEFAULT_DB_ALIAS).as_sql() |
| 228 | return self.get_compiler(DEFAULT_DB_ALIAS).as_quoted_sql() |
232 | 229 | |
233 | 230 | def __deepcopy__(self, memo): |
234 | 231 | result = self.clone(memo=memo) |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
630 | 630 | '<input type="text" name="datetimerange_0" value="2006-01-10 07:30:00" />' |
631 | 631 | '<input type="text" name="datetimerange_1" value="2006-02-12 09:50:00" />' |
632 | 632 | ) |
| 633 | |
| 634 | |
| 635 | class TestRepresentation(PostgreSQLTestCase): |
| 636 | |
| 637 | def test_numeric_range(self): |
| 638 | self.assertEqual( |
| 639 | str(RangesModel.objects.filter(ints__overlap=NumericRange(1, 5)).query), |
| 640 | 'SELECT "postgres_tests_rangesmodel"."id", "postgres_tests_rangesmodel"."ints", ' |
| 641 | '"postgres_tests_rangesmodel"."bigints", "postgres_tests_rangesmodel"."floats", ' |
| 642 | '"postgres_tests_rangesmodel"."timestamps", "postgres_tests_rangesmodel"."dates" ' |
| 643 | 'FROM "postgres_tests_rangesmodel" WHERE "postgres_tests_rangesmodel"."ints" && \'[1,5)\'' |
| 644 | ) |