Commit Graph

231 Commits

Author SHA1 Message Date
Mike Bayer b6b720609d added self referential test 2007-11-10 14:36:03 +00:00
Mike Bayer ea46e556f9 - anonymous column expressions are automatically labeled.
e.g. select([x* 5]) produces "SELECT x * 5 AS anon_1".
    This allows the labelname to be present in the cursor.description
    which can then be appropriately matched to result-column processing
    rules. (we can't reliably use positional tracking for result-column
    matches since text() expressions may represent multiple columns).

  - operator overloading is now controlled by TypeEngine objects - the
    one built-in operator overload so far is String types overloading
    '+' to be the string concatenation operator.
    User-defined types can also define their own operator overloading
    by overriding the adapt_operator(self, op) method.

  - untyped bind parameters on the right side of a binary expression
    will be assigned the type of the left side of the operation, to better
    enable the appropriate bind parameter processing to take effect
    [ticket:819]
2007-11-10 03:02:16 +00:00
Jason Kirtland 681c8fc51c - mysql float types now do an end run around the base class and respect precision=None and length=None
- Added the mysteriously missing mysql cast support
- Added mysql REAL synonym for schema generation
2007-11-09 19:55:31 +00:00
Mike Bayer 2cbb133567 more changes to traverse-and-clone; a particular element will only be cloned once and is
then re-used.  the FROM calculation of a Select normalizes the list of hide_froms against all
previous incarnations of each FROM clause, using a tag attached from cloned clause to
previous.
2007-11-08 18:06:21 +00:00
Mike Bayer 7a25be0f42 - identified some cases where Alias needs to be cloned; but still cant clone
when its an alias of a Table; added some test coverage for one particular
case from the doctests
- fixed "having" example in doctests, updated eager load example
2007-11-08 00:26:23 +00:00
Mike Bayer 750439ac5f - fixed remainder of [ticket:853]
- bindparam 'shortname' is deprecated
- fixed testing.assert_compile() to actually generate bind param dict before asserting
- added bind param assertions to CRUDTest.test_update
2007-11-07 22:25:01 +00:00
Jason Kirtland bcb586a93c Migrated maxdb behavioral assumptions from unsupported to fails_on 2007-11-05 22:11:30 +00:00
Mike Bayer 00c2077cbc - oid_column proxies more intelligently off of Select, CompoundSelect - fixes platform-affected bugs in missing the correct "oid" column
- locate_all_froms() is expensive; added an attribute-level cache for it
- put a huge warning on all select.append_XXX() methods stating that derived collections like locate_all_froms() may become invalid if
already initialized
2007-11-05 18:30:30 +00:00
Mike Bayer 0e25c2d9e8 - rewrote and simplified the system used to "target" columns across
selectable expressions.  On the SQL side this is represented by the
"corresponding_column()" method. This method is used heavily by the ORM
to "adapt" elements of an expression to similar, aliased expressions,
as well as to target result set columns originally bound to a
table or selectable to an aliased, "corresponding" expression.  The new
rewrite features completely consistent and accurate behavior.
- the "orig_set" and "distance" elements as well as all associated
fanfare are gone (hooray !)
- columns now have an optional "proxies" list which is a list of all
columns they are a "proxy" for; only CompoundSelect cols proxy more than one column
(just like before).  set operations are used to determine lineage.
- CompoundSelects (i.e. unions) only create one public-facing proxy column per
column name.  primary key collections come out with just one column per embedded
PK column.
- made the alias used by eager load limited subquery anonymous.
2007-11-05 00:59:19 +00:00
Mike Bayer 303e753b2d - func. objects can be pickled/unpickled [ticket:844] 2007-11-04 22:04:22 +00:00
Mike Bayer 8ebc8ee5ba - eager loading with LIMIT/OFFSET applied no longer adds the primary
table joined to a limited subquery of itself; the eager loads now
join directly to the subquery which also provides the primary table's
columns to the result set.  This eliminates a JOIN from all eager loads
with LIMIT/OFFSET.  [ticket:843]
2007-11-03 23:17:34 +00:00
Mike Bayer 0af3f8f35b - rewritten ClauseAdapter merged from the eager_minus_join branch; this is a much simpler
and "correct" version which will copy all elements exactly once, except for those which were
replaced with target elements.  It also can match a wider variety of target elements including
joins and selects on identity alone.
2007-11-03 22:13:17 +00:00
Mike Bayer 66cd772094 - merged factor_down_bindparams branch.
- removed ClauseParameters object; compiled.params returns a regular dictionary
  now, as well as result.last_inserted_params()/last_updated_params().
- various code trimming, method removals.
2007-11-01 03:58:21 +00:00
Jason Kirtland c2092c7254 - Refinements for maxdb's handling of SERIAL and FIXED columns
- Expanded maxdb's set of paren-less functions
2007-10-31 00:28:53 +00:00
Mike Bayer bbebcdf8f5 - fixed INSERT statements w.r.t. primary key columns that have SQL-expression
based default generators on them; SQL expression executes inline as normal
  but will not trigger a "postfetch" condition for the column, for those DB's
  who provide it via cursor.lastrowid
2007-10-28 21:28:53 +00:00
Mike Bayer 19fcf37483 - fixed expression translation of text() clauses; this repairs various
ORM scenarios where literal text is used for SQL expressions
2007-10-28 18:25:37 +00:00
Jason Kirtland 6378c34799 - Added initial version of MaxDB dialect.
- All optional test Sequences are now optional=True
2007-10-23 07:38:07 +00:00
Jason Kirtland d89b2acdd7 Added support for dialects that have both sequences and autoincrementing PKs. 2007-10-23 01:47:21 +00:00
Gaëtan de Menten ae553db3cd - Added contains operator (which generate a "LIKE %<other>%" clause).
- Added test coverage for endswith operator
2007-10-19 10:27:06 +00:00
Ants Aasma 6bbc7dd157 change the in_ API to accept a sequence or a selectable [ticket:750] 2007-10-16 22:57:05 +00:00
Mike Bayer 9b22fc0a9b - Fixed SQL compiler's awareness of top-level column labels as used
in result-set processing; nested selects which contain the same column
  names don't affect the result or conflict with result-column metadata.

- query.get() and related functions (like many-to-one lazyloading)
  use compile-time-aliased bind parameter names, to prevent
  name conflicts with bind parameters that already exist in the
  mapped selectable.
2007-10-16 16:03:59 +00:00
Jason Kirtland 9226871456 Fixed a couple of typos & hardened against future similar errors. 2007-10-16 01:17:39 +00:00
Jason Kirtland 79dafdf3d4 Restored unicode foreign key tests for [ticket:729]. 2007-10-14 18:35:51 +00:00
Jason Kirtland 224ff658e0 set svn:eol-style native 2007-10-13 20:35:42 +00:00
Jason Kirtland 833503ed23 More ORDER BY, now with use_labels. 2007-10-12 18:08:11 +00:00
Jason Kirtland df929d364d - Added small DESC exercise to test_order_by. 2007-10-12 17:46:42 +00:00
Roger Demetrescu 69ba01265e Firebird: added Float and Time types (FBFloat and FBTime). Fixed BLOB SUB_TYPE for TEXT and Binary types.
Firebird's string types are tested in testtypes.py
2007-10-12 06:02:15 +00:00
Jason Kirtland d174b3bd72 Added query coverage for ORDER BY over regular, aliased and DISTINCT columns. 2007-10-11 22:21:33 +00:00
Jason Kirtland c1a8db6791 - sqlite housekeeping- added dialect test & moved tests there, pruned the dialect's reserved words. 2007-10-11 17:35:13 +00:00
Jason Kirtland 14563004a4 - Expanded JoinTest further, exercising joins the ORM depends on explicitly
in the 'sql' tests.
2007-10-10 20:42:58 +00:00
Mike Bayer ddf875dd0c - initial sybase support checkin, [ticket:785] 2007-10-10 15:19:28 +00:00
Jason Kirtland 2b084b76c0 - Expanded the outer join tests, now covering a situation that looked like it would be wonky in oracle. 2007-10-08 03:31:52 +00:00
Jason Kirtland afa713d9e8 - Loosened up test_cant_execute_join for oracle (probably) + bonus typo fix
- Some docstring formatting waiting for pg to finish the tests...  waiting...
2007-10-08 03:01:04 +00:00
Jason Kirtland 849743acac - Added some outerjoin() execution exercises to the query tests. 2007-10-08 02:17:07 +00:00
Jason Kirtland 585b425850 - Squashed assumption of transparent type coercion support in defaults test 2007-10-07 21:57:42 +00:00
Jason Kirtland 982b622a37 - Rewrote autoincrement tests: added new scenarios, changed the orm fetchid to explicit test of last_row_ids(), and now testing transactional/autocommit modes separately to help catch any subtle issues that may exist due to assumed cursor state during post_exec(). 2007-10-07 18:54:05 +00:00
Jason Kirtland a014d289f6 - Tweaked unordered select tests to not be sensitive to result set order, also split apart some tests (aliases) that sapdb has problems with. 2007-10-07 02:01:49 +00:00
Mike Bayer b27ddac20a - fix to anonymous label generation of long table/column names [ticket:806] 2007-10-07 01:58:40 +00:00
Roger Demetrescu 11c70f9d8d Firebird dialect now uses SingletonThreadPool as its poolclass.
(this fixes all "unsuccessful metadata update\n  object XXXXX is in use" test errors)

Minor fixes in tests
2007-10-07 00:06:05 +00:00
Mike Bayer 29291f4c32 - oracle does not implicitly convert to unicode for non-typed result
sets (i.e. when no TypeEngine/String/Unicode type is even being used;
  previously it was detecting DBAPI types and converting regardless).
  should fix [ticket:800]
- fixed oracle out_parameters, likely broke in beta6
- fixed oracle _normalize_case for encoded names, gets unicode reflection test to work
- a few extra tests tweaked/unsupported for oracle
2007-10-06 16:12:58 +00:00
Mike Bayer f67fcd1822 - move PG RETURNING tests to postgres dialect test
- added server_version_info() support for PG dialect
- exclude PG versions < 8.4 for RETURNING tests
2007-10-04 03:19:38 +00:00
Ants Aasma e82ca71cc5 add support for returning results from inserts and updates for postgresql 8.2+. [ticket:797] 2007-10-02 23:57:54 +00:00
Jason Kirtland 73b0c40946 - Tweaked the sql.text date test 2007-10-02 20:58:58 +00:00
Jason Kirtland 1880e6d8c3 - Unraveled DateTest, removed bogus coverage omission for MySQL TIME types 2007-10-02 20:51:17 +00:00
Jason Kirtland 3a04b7e4d4 Avoid tickling the MySQL-python 1.2.2 executemany parsing bug on a couple tests. 2007-09-26 23:35:14 +00:00
Mike Bayer 3e672bbfc8 - created a link between QueryContext and SelectionContext; the attribute
dictionary of QueryContext is now passed to SelectionContext inside
of Query.instances(), allowing messages to be passed between the two stages.
- removed the recent "exact match" behavior of Alias objects, they're back to
their usual behavior.
- tightened up the relationship between the Query's generation
  of "eager load" aliases, and Query.instances() which actually grabs the
  eagerly loaded rows.  If the aliases were not specifically generated for
  that statement by EagerLoader, the EagerLoader will not take effect
  when the rows are fetched.  This prevents columns from being grabbed accidentally
  as being part of an eager load when they were not meant for such, which can happen
  with textual SQL as well as some inheritance situations.  It's particularly important
  since the "anonymous aliasing" of columns uses simple integer counts now to generate
  labels.
2007-09-26 17:08:19 +00:00
Mike Bayer e37a3a961c - the behavior of String/Unicode types regarding that they auto-convert
to TEXT/CLOB when no length is present now occurs *only* for an exact type
  of String or Unicode with no arguments.  If you use VARCHAR or NCHAR
  (subclasses of String/Unicode) with no length, they will be interpreted
  by the dialect as VARCHAR/NCHAR; no "magic" conversion happens there.
  This is less surprising behavior and in particular this helps Oracle keep
  string-based bind parameters as VARCHARs and not CLOBs [ticket:793].
2007-09-26 14:55:44 +00:00
Mike Bayer a0838e0c47 - columns from Alias objects, when used to target result-row columns, must match exactly
to the label used in the generated statement.  This is so searching for columns in a
  result row which match aliases won't accidentally match non-aliased columns.
  fixes errors which can arise in eager loading scenarios.
2007-09-24 19:27:52 +00:00
Mike Bayer 8c14291b6d - adjusted operator precedence of NOT to match '==' and others, so that
~(x <operator> y) produces NOT (x <op> y), which is better compatible with MySQL.
   [ticket:764].  this doesn't apply to "~(x==y)" as it does in 0.3 since ~(x==y)
   compiles to "x != y", but still applies to operators like BETWEEN.
2007-09-08 20:28:26 +00:00
Mike Bayer 5ba8a25afe added assertion case for [ticket:764] 2007-09-08 20:13:54 +00:00