Commit Graph

307 Commits

Author SHA1 Message Date
Mike Bayer 10db67be5b - More tweaks to cx_oracle Decimal handling.
"Ambiguous" numerics with no decimal place
are coerced to int at the connection handler
level.  The advantage here is that ints
come back as ints without SQLA type
objects being involved and without needless
conversion to Decimal first.

Unfortunately, some exotic subquery cases
can even see different types between
individual result rows, so the Numeric
handler, when instructed to return Decimal,
can't take full advantage of "native decimal"
mode and must run isinstance() on every value
to check if its Decimal already. Reopen of
[ticket:1840]
2010-07-14 14:50:45 -04:00
Mike Bayer e430aa915f test/dialect 2010-07-11 14:28:21 -04:00
Mike Bayer 8548ca8cc5 - add typing/operator converts to Float/Numeric to get Oracle tests going again,
as we have an unusually high level of dependence on SQLA typing now
- force oracle seqs to return integers
2010-07-02 13:55:24 -04:00
Mike Bayer 64d92c836c - If server_version_info is outside the usual
range of (8, ), (9, ), (10, ), a warning is emitted
which suggests checking that the FreeTDS version
configuration is using 7.0 or 8.0, not 4.2.
[ticket:1825]
2010-07-02 12:57:15 -04:00
Mike Bayer 25db56bc0c - Oracle's "native decimal" metadata begins to return
ambiguous typing information about numerics
    when columns are embedded in subqueries as well
    as when ROWNUM is consulted with subqueries, as we
    do for limit/offset.  We've added these ambiguous
    conditions to the cx_oracle "convert to Decimal()"
    handler, so that we receive numerics as Decimal
    in more cases instead of as floats.  These are
    then converted, if requested, into Integer
    or Float, or otherwise kept as the lossless
    Decimal [ticket:1840].
2010-07-01 16:57:02 -04:00
Mike Bayer 5095369ce8 fix oracle char length test for newer descriptors 2010-06-27 13:05:05 -04:00
Mike Bayer 3eab798253 - Won't generate "CREATE TYPE" / "DROP TYPE" if
using types.Enum on a PG version prior to 8.3 -
the supports_native_enum flag is fully
honored.  [ticket:1836]
2010-06-25 13:11:06 -04:00
Mike Bayer 87664ce88a - The argument to "ESCAPE" of a LIKE operator or similar
is passed through render_literal_value(), which may
implement escaping of backslashes.  [ticket:1400]
- Postgresql render_literal_value() is overridden which escapes
backslashes, currently applies to the ESCAPE clause
of LIKE and similar expressions.
Ultimately this will have to detect the value of
"standard_conforming_strings" for full behavior.
[ticket:1400]
- MySQL render_literal_value() is overridden which escapes
backslashes, currently applies to the ESCAPE clause
of LIKE and similar expressions.   This behavior
is derived from detecting the value of
NO_BACKSLASH_ESCAPES.  [ticket:1400]
2010-06-24 12:19:15 -04:00
Mike Bayer 77c3bb26c2 - Firebird dialect adds CHAR, VARCHAR types which
accept a "charset" flag, to support Firebird
"CHARACTER SET" clause.  [ticket:1813]
2010-06-19 13:51:55 -04:00
Mike Bayer 6457901f96 - Fixed ora-8 compatibility flags such that they
don't cache a stale value from before the first
database connection actually occurs. [ticket:1819]
2010-06-19 13:39:32 -04:00
Mike Bayer 17073a0155 - MySQL dialect doesn't emit CAST() for MySQL version
detected < 4.0.2.  This allows the unicode
check on connect to proceed. [ticket:1826]
2010-06-19 13:21:19 -04:00
Mike Bayer 035ec314f6 - Fixed concatenation of constraints when "PRIMARY KEY"
constraint gets moved to column level due to SQLite
AUTOINCREMENT keyword being rendered.  [ticket:1812]
- remove some extra space in between constraint DDL
- added alias() to binary comparison test, fixing pg + mysql failures
2010-05-27 14:46:44 -04:00
Mike Bayer b086f9a815 - Re-established support for Oracle 8 with cx_oracle,
including that use_ansi is set to False automatically,
NVARCHAR2 and NCLOB are not rendered for Unicode,
"native unicode" check doesn't fail, cx_oracle
"native unicode" mode is disabled, VARCHAR() is emitted
with bytes count instead of char count. [ticket:1808]
2010-05-27 13:02:17 -04:00
Mike Bayer 40c7db67b4 - FOR UPDATE is emitted in the syntactically correct position
when limit/offset is used, i.e. the ROWNUM subquery.
However, Oracle can't really handle FOR UPDATE with ORDER BY
or with subqueries, so its still not very usable, but at
least SQLA gets the SQL past the Oracle parser.
[ticket:1815]
2010-05-27 11:50:16 -04:00
Mike Bayer 7009a3bc32 - func.sysdate() emits "SYSDATE()", i.e. with the ending
parenthesis, on MySQL.  [ticket:1794]
2010-05-08 15:29:08 -04:00
Mike Bayer 9d34c64095 - Fixed use_ansi=False mode, which was producing broken
WHERE clauses in pretty much all cases.  [ticket:1790]
2010-05-03 19:24:52 -04:00
Mike Bayer 731ad9b0b9 further testing reveals that cursor.rowcount is only called with update/delete and DDL,
and also that FB's cursor.rowcount is a little expensive, but not dramatically.
added a test to ensure cursor.rowcount is only called on update/delete.
the current default for firebird enable_rowcount is now True, leaving all the
options to turn it off etc..
2010-04-12 20:20:50 -04:00
Mike Bayer 47ef5ed5f7 - The functionality of result.rowcount is now disabled
by default, and can be re-enabled using the 'enable_rowcount'
flag with create_engine(), as well as the 'enable_rowcount'
execution context flag on a per-execute basis.  This because
cursor.rowcount requires cursor access (can't be evaluated
lazily since the result auto-closes) and also incurs an
expensive round-trip.
2010-04-11 16:37:49 -04:00
Mike Bayer d61a48ccfd - fixed numeric test for pg8000, factored out decimal/float codes 2010-04-09 13:01:17 -04:00
Mike Bayer 3351b65df9 - Repaired missing import in psycopg2._PGNumeric type when
unknown numeric is received.

- psycopg2/pg8000 dialects now aware of REAL[], FLOAT[],
DOUBLE_PRECISION[], NUMERIC[] return types without
raising an exception.

- introducing testing.provide_metadata for all these stupid little
create/drop tests
2010-04-07 16:07:55 -04:00
Mike Bayer a6480a2c31 - Postgresql now reflects sequence names associated with
SERIAL columns correctly, after the name of of the sequence
has been changed.  Thanks to Kumar McMillan for the patch.
[ticket:1071]
2010-04-06 18:53:51 -04:00
Mike Bayer eefdbd3757 - Now using cx_oracle output converters so that the
DBAPI returns natively the kinds of values we prefer:
- NUMBER values with positive precision + scale convert
to cx_oracle.STRING and then to Decimal.   This
allows perfect precision for the Numeric type when
using cx_oracle.  [ticket:1759]
- STRING/FIXED_CHAR now convert to unicode natively.
SQLAlchemy's String types then don't need to
apply any kind of conversions.
2010-04-03 15:33:55 -04:00
Mike Bayer f432bc8fe1 - the Numeric type raises an *enormous* warning when expected
to convert floats to Decimal from a DBAPI that returns floats.
This includes SQLite, Oracle, Sybase, MS-SQL.
[ticket:1759]
2010-04-03 10:58:13 -04:00
Mike Bayer 7535e19fec - No longer guessing that TINYINT(1) should be BOOLEAN
when reflecting - TINYINT(1) is returned.  Use Boolean/
BOOLEAN in table definition to get boolean conversion
behavior.  [ticket:1752]
2010-03-27 17:27:28 -04:00
Brad Allen a1b821a8c6 merged with mainline tip 2010-03-26 14:57:01 -06:00
Mike Bayer d56d420e80 mssql+mxodbc should use executedirect for all selects and execute for insert/update/delete. To support this, an is_crud property has been added to the DefaultExecutionContext. The behavior is forcable either way per execution using execution_options(native_odbc_parameters=True|False). Some tests have been added to demonstrate usage. (patch by zzzeek committed by bradallen) 2010-03-26 14:47:53 -06:00
Mike Bayer 6a8863238c clarify this test 2010-03-26 12:18:21 -04:00
Mike Bayer db052dfba8 - the TIME and TIMESTAMP types are now availble from the
postgresql dialect directly, which add the PG-specific
argument 'precision' to both.   'precision' and
'timezone' are correctly reflected for both TIME and
TIMEZONE types. [ticket:997]
2010-03-26 12:03:54 -04:00
Mike Bayer 6acc9e6d9e - The Oracle dialect will issue VARCHAR type definitions
using character counts, i.e. VARCHAR2(50 CHAR), so that
the column is sized in terms of characters and not bytes.
Column reflection of character types will also use
ALL_TAB_COLUMNS.CHAR_LENGTH instead of
ALL_TAB_COLUMNS.DATA_LENGTH.  Both of these behaviors take
effect when the server version is 9 or higher - for
version 8, the old behaviors are used.  [ticket:1744]
2010-03-25 22:26:11 +00:00
Mike Bayer 3f0bd7269b - The psycopg2 dialect will log NOTICE messages via the
"sqlalchemy.dialects.postgresql" logger name.
[ticket:877]
2010-03-25 17:02:50 -04:00
Mike Bayer 7cf74e9cca oracle cleanup 2010-03-19 22:29:08 -04:00
Mike Bayer 268c64a6aa try < 0 2010-03-19 21:42:35 -04:00
Mike Bayer 5cd6539191 just mark this test as crashing for now 2010-03-19 21:39:36 -04:00
Mike Bayer cdda68aea3 - Added support for rendering and reflecting
TIMESTAMP WITH TIME ZONE, i.e. TIMESTAMP(timezone=True).
[ticket:651]

- Oracle INTERVAL type can now be reflected.
2010-03-19 18:10:53 -04:00
Mike Bayer 2438b38881 fix sqlite tests 2010-03-19 17:52:34 -04:00
Mike Bayer bb45ff1dbb - the string approach appears to be necessary for large numbers, however.
Don't know how to get large decimals through to Sybase.
2010-03-19 11:35:32 -04:00
Brad Allen 2282a4b8af Merge 2010-03-18 08:53:06 -06:00
Brad Allen 87c50f2aac Because of changes to SQLAlchemy bind parameter placement, removed all mxodbc test disabling statements having this pattern: @testing.crashes('mssql+mxodbc', """Invalid bind parameter placement: 2010-03-17 16:27:39 -06:00
Brad Allen e6a7f1ce0c Merged from main tip, and resolved conflicts in mxodbc dialect and connector. 2010-03-17 16:06:42 -06:00
Mike Bayer 065fcbd9d2 - The official name for the relation() function is now
relationship(), to eliminate confusion over the relational
algebra term.  relation() however will remain available
in equal capacity for the foreseeable future.  [ticket:1740]
2010-03-17 17:48:29 -04:00
Mike Bayer 55367ac4a2 - mxodbc can use default execute() call
- modified SQLCompiler to support rendering of bind parameters as literal
inline strings for specific sections, if specified by the compiler
subclass, using either literal_binds=True passed to process() or any visit
method, or by setting to False the "binds_in_columns_clause" flag for SQL-92
compatible columns clauses..  The compiler subclass is responsible for
implementing the literal quoting function which should make use of the DBAPI's native
capabilities.
- SQLCompiler now passes **kw to most process() methods (should be all,
ideally) so that literal_binds is propagated.
- added some rudimentary tests for mxodbc.
2010-03-16 20:58:46 -04:00
Brad Allen d6b5550f42 Disabling tests for mssql+mxodbc where mxODBC cursor.execute chokes on invalid placement of bind parameter "?" within the SQL statement. 2010-03-16 16:57:54 -06:00
Mike Bayer 811ece1397 - The except_() method now renders as MINUS on Oracle,
which is more or less equivalent on that platform.
[ticket:1712]
2010-03-16 22:38:18 +00:00
Brad Allen 00ac90accb merged mainline default branch 2010-03-15 11:42:35 -06:00
Philip Jenvey 1e7fcd8798 adjust per a couple zxjdbc failures 2010-03-13 10:29:09 -08:00
Philip Jenvey 7ea254ea7a disable interval tests on oracle+zxjdbc for now, and also test_fk_nonpassive 2010-03-12 17:50:33 -08:00
Brad Allen 5ca404af22 Merged latest changes from the mainline (default branch) 2010-03-12 13:09:31 -06:00
Mike Bayer 1b16954864 - introduce an optimizing type _NativeUnicodeMixin to oracle plus supporting
changes to Enum/SchemaType to re-support adaptation of string types.
This approach can be adapted by "conditional" unicode returning dialects
(i.e. pyodbc and possibly mxodbc) to remove the overhead
of isinstance(value, unicode) calls when the dialect returned type is
of dbapi.UNICODE, dbapi.NVARCHAR, etc.
2010-03-12 18:30:38 +00:00
Brad Allen 8b8073af0d Added decorators to suppress unwanted warning messages during testing (not working yet, but committed for review purposes). 2010-03-11 16:33:05 -06:00
Brad Allen 630c84fdd7 merged latest commits from default branch on server 2010-03-11 10:29:40 -06:00