[Sqlalchemy-commits] [4050] sqlalchemy/trunk: Include column name in length-less String warning (mo
Brought to you by:
zzzeek
From: <co...@sq...> - 2008-01-10 23:16:58
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!-- #msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; } #msg dt { float: left; width: 6em; font-weight: bold; } #msg dt:after { content:':';} #msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; } #msg dl a { font-weight: bold} #msg dl a:link { color:#fc3; } #msg dl a:active { color:#ff0; } #msg dl a:visited { color:#cc6; } h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; } #msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; } #msg ul, pre { overflow: auto; } #header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; } #patch { width: 100%; } #patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;} #patch .propset h4, #patch .binary h4 {margin:0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;} #patch .propset .diff, #patch .binary .diff {padding:10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;} #patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;} #patch .lines, .info {color:#888;background:#fff;} --></style> <title>[4050] sqlalchemy/trunk: Include column name in length-less String warning (more [ticket:912])</title> </head> <body> <div id="msg"> <dl> <dt>Revision</dt> <dd>4050</dd> <dt>Author</dt> <dd>jek</dd> <dt>Date</dt> <dd>2008-01-10 18:16:56 -0500 (Thu, 10 Jan 2008)</dd> </dl> <h3>Log Message</h3> <pre>Include column name in length-less String warning (more [ticket:912])</pre> <h3>Modified Paths</h3> <ul> <li><a href="#sqlalchemytrunklibsqlalchemydatabasesaccesspy">sqlalchemy/trunk/lib/sqlalchemy/databases/access.py</a></li> <li><a href="#sqlalchemytrunklibsqlalchemydatabasesfirebirdpy">sqlalchemy/trunk/lib/sqlalchemy/databases/firebird.py</a></li> <li><a href="#sqlalchemytrunklibsqlalchemydatabasesinformixpy">sqlalchemy/trunk/lib/sqlalchemy/databases/informix.py</a></li> <li><a href="#sqlalchemytrunklibsqlalchemydatabasesmaxdbpy">sqlalchemy/trunk/lib/sqlalchemy/databases/maxdb.py</a></li> <li><a href="#sqlalchemytrunklibsqlalchemydatabasesmssqlpy">sqlalchemy/trunk/lib/sqlalchemy/databases/mssql.py</a></li> <li><a href="#sqlalchemytrunklibsqlalchemydatabasesmysqlpy">sqlalchemy/trunk/lib/sqlalchemy/databases/mysql.py</a></li> <li><a href="#sqlalchemytrunklibsqlalchemydatabasesoraclepy">sqlalchemy/trunk/lib/sqlalchemy/databases/oracle.py</a></li> <li><a href="#sqlalchemytrunklibsqlalchemydatabasespostgrespy">sqlalchemy/trunk/lib/sqlalchemy/databases/postgres.py</a></li> <li><a href="#sqlalchemytrunklibsqlalchemydatabasessqlitepy">sqlalchemy/trunk/lib/sqlalchemy/databases/sqlite.py</a></li> <li><a href="#sqlalchemytrunklibsqlalchemydatabasessybasepy">sqlalchemy/trunk/lib/sqlalchemy/databases/sybase.py</a></li> <li><a href="#sqlalchemytrunklibsqlalchemytypespy">sqlalchemy/trunk/lib/sqlalchemy/types.py</a></li> <li><a href="#sqlalchemytrunklibsqlalchemyutilpy">sqlalchemy/trunk/lib/sqlalchemy/util.py</a></li> <li><a href="#sqlalchemytrunktestsqltesttypespy">sqlalchemy/trunk/test/sql/testtypes.py</a></li> </ul> </div> <div id="patch"> <h3>Diff</h3> <a id="sqlalchemytrunklibsqlalchemydatabasesaccesspy"></a> <div class="modfile"><h4>Modified: sqlalchemy/trunk/lib/sqlalchemy/databases/access.py (4049 => 4050)</h4> <pre class="diff"><span> <span class="info">--- sqlalchemy/trunk/lib/sqlalchemy/databases/access.py 2008-01-10 22:45:07 UTC (rev 4049) +++ sqlalchemy/trunk/lib/sqlalchemy/databases/access.py 2008-01-10 23:16:56 UTC (rev 4050) </span><span class="lines">@@ -378,7 +378,7 @@ </span><span class="cx"> </span><span class="cx"> class AccessSchemaGenerator(compiler.SchemaGenerator): </span><span class="cx"> def get_column_specification(self, column, **kwargs): </span><del>- colspec = self.preparer.format_column(column) + " " + column.type.dialect_impl(self.dialect, _for_ddl=True).get_col_spec() </del><ins>+ colspec = self.preparer.format_column(column) + " " + column.type.dialect_impl(self.dialect, _for_ddl=column).get_col_spec() </ins><span class="cx"> </span><span class="cx"> # install a sequence if we have an implicit IDENTITY column </span><span class="cx"> if (not getattr(column.table, 'has_sequence', False)) and column.primary_key and \ </span></span></pre></div> <a id="sqlalchemytrunklibsqlalchemydatabasesfirebirdpy"></a> <div class="modfile"><h4>Modified: sqlalchemy/trunk/lib/sqlalchemy/databases/firebird.py (4049 => 4050)</h4> <pre class="diff"><span> <span class="info">--- sqlalchemy/trunk/lib/sqlalchemy/databases/firebird.py 2008-01-10 22:45:07 UTC (rev 4049) +++ sqlalchemy/trunk/lib/sqlalchemy/databases/firebird.py 2008-01-10 23:16:56 UTC (rev 4050) </span><span class="lines">@@ -587,7 +587,7 @@ </span><span class="cx"> </span><span class="cx"> def get_column_specification(self, column, **kwargs): </span><span class="cx"> colspec = self.preparer.format_column(column) </span><del>- colspec += " " + column.type.dialect_impl(self.dialect, _for_ddl=True).get_col_spec() </del><ins>+ colspec += " " + column.type.dialect_impl(self.dialect, _for_ddl=column).get_col_spec() </ins><span class="cx"> </span><span class="cx"> default = self.get_column_default_string(column) </span><span class="cx"> if default is not None: </span></span></pre></div> <a id="sqlalchemytrunklibsqlalchemydatabasesinformixpy"></a> <div class="modfile"><h4>Modified: sqlalchemy/trunk/lib/sqlalchemy/databases/informix.py (4049 => 4050)</h4> <pre class="diff"><span> <span class="info">--- sqlalchemy/trunk/lib/sqlalchemy/databases/informix.py 2008-01-10 22:45:07 UTC (rev 4049) +++ sqlalchemy/trunk/lib/sqlalchemy/databases/informix.py 2008-01-10 23:16:56 UTC (rev 4050) </span><span class="lines">@@ -20,7 +20,7 @@ </span><span class="cx"> def __init__( self , con ): </span><span class="cx"> self.__cursor = con.cursor() </span><span class="cx"> self.rowcount = 0 </span><del>- </del><ins>+ </ins><span class="cx"> def offset( self , n ): </span><span class="cx"> if n > 0: </span><span class="cx"> self.fetchmany( n ) </span><span class="lines">@@ -29,13 +29,13 @@ </span><span class="cx"> self.rowcount = 0 </span><span class="cx"> else: </span><span class="cx"> self.rowcount = self.__cursor.rowcount </span><del>- </del><ins>+ </ins><span class="cx"> def execute( self , sql , params ): </span><span class="cx"> if params is None or len( params ) == 0: </span><span class="cx"> params = [] </span><del>- </del><ins>+ </ins><span class="cx"> return self.__cursor.execute( sql , params ) </span><del>- </del><ins>+ </ins><span class="cx"> def __getattr__( self , name ): </span><span class="cx"> if name not in ( 'offset' , '__cursor' , 'rowcount' , '__del__' , 'execute' ): </span><span class="cx"> return getattr( self.__cursor , name ) </span><span class="lines">@@ -46,7 +46,7 @@ </span><span class="cx"> return 'NUMERIC' </span><span class="cx"> else: </span><span class="cx"> return "NUMERIC(%(precision)s, %(length)s)" % {'precision': self.precision, 'length' : self.length} </span><del>- </del><ins>+ </ins><span class="cx"> class InfoInteger(sqltypes.Integer): </span><span class="cx"> def get_col_spec(self): </span><span class="cx"> return "INTEGER" </span><span class="lines">@@ -62,7 +62,7 @@ </span><span class="cx"> class InfoDateTime(sqltypes.DateTime ): </span><span class="cx"> def get_col_spec(self): </span><span class="cx"> return "DATETIME YEAR TO SECOND" </span><del>- </del><ins>+ </ins><span class="cx"> def bind_processor(self, dialect): </span><span class="cx"> def process(value): </span><span class="cx"> if value is not None: </span><span class="lines">@@ -70,7 +70,7 @@ </span><span class="cx"> value = value.replace( microsecond = 0 ) </span><span class="cx"> return value </span><span class="cx"> return process </span><del>- </del><ins>+ </ins><span class="cx"> class InfoTime(sqltypes.Time ): </span><span class="cx"> def get_col_spec(self): </span><span class="cx"> return "DATETIME HOUR TO SECOND" </span><span class="lines">@@ -82,15 +82,15 @@ </span><span class="cx"> value = value.replace( microsecond = 0 ) </span><span class="cx"> return value </span><span class="cx"> return process </span><del>- </del><ins>+ </ins><span class="cx"> def result_processor(self, dialect): </span><span class="cx"> def process(value): </span><span class="cx"> if isinstance( value , datetime.datetime ): </span><span class="cx"> return value.time() </span><span class="cx"> else: </span><del>- return value </del><ins>+ return value </ins><span class="cx"> return process </span><del>- </del><ins>+ </ins><span class="cx"> class InfoText(sqltypes.String): </span><span class="cx"> def get_col_spec(self): </span><span class="cx"> return "VARCHAR(255)" </span><span class="lines">@@ -98,7 +98,7 @@ </span><span class="cx"> class InfoString(sqltypes.String): </span><span class="cx"> def get_col_spec(self): </span><span class="cx"> return "VARCHAR(%(length)s)" % {'length' : self.length} </span><del>- </del><ins>+ </ins><span class="cx"> def bind_processor(self, dialect): </span><span class="cx"> def process(value): </span><span class="cx"> if value == '': </span><span class="lines">@@ -106,27 +106,27 @@ </span><span class="cx"> else: </span><span class="cx"> return value </span><span class="cx"> return process </span><del>- </del><ins>+ </ins><span class="cx"> class InfoChar(sqltypes.CHAR): </span><span class="cx"> def get_col_spec(self): </span><span class="cx"> return "CHAR(%(length)s)" % {'length' : self.length} </span><del>- </del><ins>+ </ins><span class="cx"> class InfoBinary(sqltypes.Binary): </span><span class="cx"> def get_col_spec(self): </span><span class="cx"> return "BYTE" </span><del>- </del><ins>+ </ins><span class="cx"> class InfoBoolean(sqltypes.Boolean): </span><span class="cx"> default_type = 'NUM' </span><span class="cx"> def get_col_spec(self): </span><span class="cx"> return "SMALLINT" </span><del>- </del><ins>+ </ins><span class="cx"> def result_processor(self, dialect): </span><span class="cx"> def process(value): </span><span class="cx"> if value is None: </span><span class="cx"> return None </span><span class="cx"> return value and True or False </span><span class="cx"> return process </span><del>- </del><ins>+ </ins><span class="cx"> def bind_processor(self, dialect): </span><span class="cx"> def process(value): </span><span class="cx"> if value is True: </span><span class="lines">@@ -138,7 +138,7 @@ </span><span class="cx"> else: </span><span class="cx"> return value and True or False </span><span class="cx"> return process </span><del>- </del><ins>+ </ins><span class="cx"> colspecs = { </span><span class="cx"> sqltypes.Integer : InfoInteger, </span><span class="cx"> sqltypes.Smallinteger : InfoSmallInteger, </span><span class="lines">@@ -156,26 +156,26 @@ </span><span class="cx"> </span><span class="cx"> </span><span class="cx"> ischema_names = { </span><del>- 0 : InfoString, # CHAR </del><ins>+ 0 : InfoString, # CHAR </ins><span class="cx"> 1 : InfoSmallInteger, # SMALLINT </span><del>- 2 : InfoInteger, # INT </del><ins>+ 2 : InfoInteger, # INT </ins><span class="cx"> 3 : InfoNumeric, # Float </span><span class="cx"> 3 : InfoNumeric, # SmallFloat </span><del>- 5 : InfoNumeric, # DECIMAL </del><ins>+ 5 : InfoNumeric, # DECIMAL </ins><span class="cx"> 6 : InfoInteger, # Serial </span><del>- 7 : InfoDate, # DATE </del><ins>+ 7 : InfoDate, # DATE </ins><span class="cx"> 8 : InfoNumeric, # MONEY </span><span class="cx"> 10 : InfoDateTime, # DATETIME </span><del>- 11 : InfoBinary, # BYTE - 12 : InfoText, # TEXT - 13 : InfoString, # VARCHAR - 15 : InfoString, # NCHAR - 16 : InfoString, # NVARCHAR </del><ins>+ 11 : InfoBinary, # BYTE + 12 : InfoText, # TEXT + 13 : InfoString, # VARCHAR + 15 : InfoString, # NCHAR + 16 : InfoString, # NVARCHAR </ins><span class="cx"> 17 : InfoInteger, # INT8 </span><span class="cx"> 18 : InfoInteger, # Serial8 </span><span class="cx"> 43 : InfoString, # LVARCHAR </span><del>- -1 : InfoBinary, # BLOB - -1 : InfoText, # CLOB </del><ins>+ -1 : InfoBinary, # BLOB + -1 : InfoText, # CLOB </ins><span class="cx"> } </span><span class="cx"> </span><span class="cx"> def descriptor(): </span><span class="lines">@@ -204,11 +204,11 @@ </span><span class="cx"> </span><span class="cx"> def create_cursor( self ): </span><span class="cx"> return informix_cursor( self.connection.connection ) </span><del>- </del><ins>+ </ins><span class="cx"> class InfoDialect(default.DefaultDialect): </span><span class="cx"> # for informix 7.31 </span><span class="cx"> max_identifier_length = 18 </span><del>- </del><ins>+ </ins><span class="cx"> def __init__(self, use_ansi=True,**kwargs): </span><span class="cx"> self.use_ansi = use_ansi </span><span class="cx"> default.DefaultDialect.__init__(self, **kwargs) </span><span class="lines">@@ -229,7 +229,7 @@ </span><span class="cx"> cu = connect.cursor() </span><span class="cx"> cu.execute( 'SET LOCK MODE TO WAIT' ) </span><span class="cx"> #cu.execute( 'SET ISOLATION TO REPEATABLE READ' ) </span><del>- </del><ins>+ </ins><span class="cx"> def type_descriptor(self, typeobj): </span><span class="cx"> return sqltypes.adapt_type(typeobj, colspecs) </span><span class="cx"> </span><span class="lines">@@ -238,20 +238,20 @@ </span><span class="cx"> dsn = '%s@%s' % ( url.database , url.host ) </span><span class="cx"> else: </span><span class="cx"> dsn = url.database </span><del>- </del><ins>+ </ins><span class="cx"> if url.username: </span><span class="cx"> opt = { 'user':url.username , 'password': url.password } </span><span class="cx"> else: </span><span class="cx"> opt = {} </span><del>- </del><ins>+ </ins><span class="cx"> return ([dsn,], opt ) </span><del>- </del><ins>+ </ins><span class="cx"> def create_execution_context(self , *args, **kwargs): </span><span class="cx"> return InfoExecutionContext(self, *args, **kwargs) </span><del>- </del><ins>+ </ins><span class="cx"> def oid_column_name(self,column): </span><span class="cx"> return "rowid" </span><del>- </del><ins>+ </ins><span class="cx"> def table_names(self, connection, schema): </span><span class="cx"> s = "select tabname from systables" </span><span class="cx"> return [row[0] for row in connection.execute(s)] </span><span class="lines">@@ -259,7 +259,7 @@ </span><span class="cx"> def has_table(self, connection, table_name,schema=None): </span><span class="cx"> cursor = connection.execute("""select tabname from systables where tabname=?""", table_name.lower() ) </span><span class="cx"> return bool( cursor.fetchone() is not None ) </span><del>- </del><ins>+ </ins><span class="cx"> def reflecttable(self, connection, table, include_columns): </span><span class="cx"> c = connection.execute ("select distinct OWNER from systables where tabname=?", table.name.lower() ) </span><span class="cx"> rows = c.fetchall() </span><span class="lines">@@ -278,12 +278,12 @@ </span><span class="cx"> raise exceptions.AssertionError("There are multiple tables with name %s in the schema, you must specifie owner"%table.name) </span><span class="cx"> </span><span class="cx"> c = connection.execute ("""select colname , coltype , collength , t3.default , t1.colno from syscolumns as t1 , systables as t2 , OUTER sysdefaults as t3 </span><del>- where t1.tabid = t2.tabid and t2.tabname=? and t2.owner=? </del><ins>+ where t1.tabid = t2.tabid and t2.tabname=? and t2.owner=? </ins><span class="cx"> and t3.tabid = t2.tabid and t3.colno = t1.colno </span><span class="cx"> order by t1.colno""", table.name.lower(), owner ) </span><span class="cx"> rows = c.fetchall() </span><del>- - if not rows: </del><ins>+ + if not rows: </ins><span class="cx"> raise exceptions.NoSuchTableError(table.name) </span><span class="cx"> </span><span class="cx"> for name , colattr , collength , default , colno in rows: </span><span class="lines">@@ -293,11 +293,11 @@ </span><span class="cx"> </span><span class="cx"> # in 7.31, coltype = 0x000 </span><span class="cx"> # ^^-- column type </span><del>- # ^-- 1 not null , 0 null </del><ins>+ # ^-- 1 not null , 0 null </ins><span class="cx"> nullable , coltype = divmod( colattr , 256 ) </span><span class="cx"> if coltype not in ( 0 , 13 ) and default: </span><span class="cx"> default = default.split()[-1] </span><del>- </del><ins>+ </ins><span class="cx"> if coltype == 0 or coltype == 13: # char , varchar </span><span class="cx"> coltype = ischema_names.get(coltype, InfoString)(collength) </span><span class="cx"> if default: </span><span class="lines">@@ -313,26 +313,26 @@ </span><span class="cx"> except KeyError: </span><span class="cx"> warnings.warn(RuntimeWarning("Did not recognize type '%s' of column '%s'" % (coltype, name))) </span><span class="cx"> coltype = sqltypes.NULLTYPE </span><del>- </del><ins>+ </ins><span class="cx"> colargs = [] </span><span class="cx"> if default is not None: </span><span class="cx"> colargs.append(schema.PassiveDefault(sql.text(default))) </span><del>- </del><ins>+ </ins><span class="cx"> table.append_column(schema.Column(name, coltype, nullable = (nullable == 0), *colargs)) </span><span class="cx"> </span><span class="cx"> # FK </span><del>- c = connection.execute("""select t1.constrname as cons_name , t1.constrtype as cons_type , - t4.colname as local_column , t7.tabname as remote_table , - t6.colname as remote_column - from sysconstraints as t1 , systables as t2 , - sysindexes as t3 , syscolumns as t4 , - sysreferences as t5 , syscolumns as t6 , systables as t7 , </del><ins>+ c = connection.execute("""select t1.constrname as cons_name , t1.constrtype as cons_type , + t4.colname as local_column , t7.tabname as remote_table , + t6.colname as remote_column + from sysconstraints as t1 , systables as t2 , + sysindexes as t3 , syscolumns as t4 , + sysreferences as t5 , syscolumns as t6 , systables as t7 , </ins><span class="cx"> sysconstraints as t8 , sysindexes as t9 </span><span class="cx"> where t1.tabid = t2.tabid and t2.tabname=? and t2.owner=? and t1.constrtype = 'R' </span><span class="cx"> and t3.tabid = t2.tabid and t3.idxname = t1.idxname </span><span class="cx"> and t4.tabid = t2.tabid and t4.colno = t3.part1 </span><span class="cx"> and t5.constrid = t1.constrid and t8.constrid = t5.primary </span><del>- and t6.tabid = t5.ptabid and t6.colno = t9.part1 and t9.idxname = t8.idxname </del><ins>+ and t6.tabid = t5.ptabid and t6.colno = t9.part1 and t9.idxname = t8.idxname </ins><span class="cx"> and t7.tabid = t5.ptabid""", table.name.lower(), owner ) </span><span class="cx"> rows = c.fetchall() </span><span class="cx"> fks = {} </span><span class="lines">@@ -348,15 +348,15 @@ </span><span class="cx"> fk[0].append(local_column) </span><span class="cx"> if refspec not in fk[1]: </span><span class="cx"> fk[1].append(refspec) </span><del>- </del><ins>+ </ins><span class="cx"> for name, value in fks.iteritems(): </span><span class="cx"> table.append_constraint(schema.ForeignKeyConstraint(value[0], value[1] , None )) </span><del>- </del><ins>+ </ins><span class="cx"> # PK </span><del>- c = connection.execute("""select t1.constrname as cons_name , t1.constrtype as cons_type , - t4.colname as local_column - from sysconstraints as t1 , systables as t2 , - sysindexes as t3 , syscolumns as t4 </del><ins>+ c = connection.execute("""select t1.constrname as cons_name , t1.constrtype as cons_type , + t4.colname as local_column + from sysconstraints as t1 , systables as t2 , + sysindexes as t3 , syscolumns as t4 </ins><span class="cx"> where t1.tabid = t2.tabid and t2.tabname=? and t2.owner=? and t1.constrtype = 'P' </span><span class="cx"> and t3.tabid = t2.tabid and t3.idxname = t1.idxname </span><span class="cx"> and t4.tabid = t2.tabid and t4.colno = t3.part1""", table.name.lower(), owner ) </span><span class="lines">@@ -365,17 +365,17 @@ </span><span class="cx"> table.primary_key.add( table.c[local_column] ) </span><span class="cx"> </span><span class="cx"> class InfoCompiler(compiler.DefaultCompiler): </span><del>- """Info compiler modifies the lexical structure of Select statements to work under </del><ins>+ """Info compiler modifies the lexical structure of Select statements to work under </ins><span class="cx"> non-ANSI configured Oracle databases, if the use_ansi flag is False.""" </span><span class="cx"> def __init__(self, dialect, statement, parameters=None, **kwargs): </span><span class="cx"> self.limit = 0 </span><span class="cx"> self.offset = 0 </span><del>- </del><ins>+ </ins><span class="cx"> compiler.DefaultCompiler.__init__( self , dialect , statement , parameters , **kwargs ) </span><del>- </del><ins>+ </ins><span class="cx"> def default_from(self): </span><span class="cx"> return " from systables where tabname = 'systables' " </span><del>- </del><ins>+ </ins><span class="cx"> def get_select_precolumns( self , select ): </span><span class="cx"> s = select._distinct and "DISTINCT " or "" </span><span class="cx"> # only has limit </span><span class="lines">@@ -385,27 +385,27 @@ </span><span class="cx"> else: </span><span class="cx"> s += "" </span><span class="cx"> return s </span><del>- </del><ins>+ </ins><span class="cx"> def visit_select(self, select): </span><span class="cx"> if select._offset: </span><span class="cx"> self.offset = select._offset </span><span class="cx"> self.limit = select._limit or 0 </span><span class="cx"> # the column in order by clause must in select too </span><del>- </del><ins>+ </ins><span class="cx"> def __label( c ): </span><span class="cx"> try: </span><span class="cx"> return c._label.lower() </span><span class="cx"> except: </span><span class="cx"> return '' </span><del>- - # TODO: dont modify the original select, generate a new one </del><ins>+ + # TODO: dont modify the original select, generate a new one </ins><span class="cx"> a = [ __label(c) for c in select._raw_columns ] </span><span class="cx"> for c in select.order_by_clause.clauses: </span><span class="cx"> if ( __label(c) not in a ) and getattr( c , 'name' , '' ) != 'oid': </span><span class="cx"> select.append_column( c ) </span><del>- </del><ins>+ </ins><span class="cx"> return compiler.DefaultCompiler.visit_select(self, select) </span><del>- </del><ins>+ </ins><span class="cx"> def limit_clause(self, select): </span><span class="cx"> return "" </span><span class="cx"> </span><span class="lines">@@ -418,7 +418,7 @@ </span><span class="cx"> return "CURRENT YEAR TO SECOND" </span><span class="cx"> else: </span><span class="cx"> return compiler.DefaultCompiler.visit_function( self , func ) </span><del>- </del><ins>+ </ins><span class="cx"> def visit_clauselist(self, list): </span><span class="cx"> try: </span><span class="cx"> li = [ c for c in list.clauses if c.name != 'oid' ] </span><span class="lines">@@ -434,41 +434,41 @@ </span><span class="cx"> colspec += " SERIAL" </span><span class="cx"> self.has_serial = True </span><span class="cx"> else: </span><del>- colspec += " " + column.type.dialect_impl(self.dialect, _for_ddl=True).get_col_spec() </del><ins>+ colspec += " " + column.type.dialect_impl(self.dialect, _for_ddl=column).get_col_spec() </ins><span class="cx"> default = self.get_column_default_string(column) </span><span class="cx"> if default is not None: </span><span class="cx"> colspec += " DEFAULT " + default </span><del>- </del><ins>+ </ins><span class="cx"> if not column.nullable: </span><span class="cx"> colspec += " NOT NULL" </span><del>- </del><ins>+ </ins><span class="cx"> return colspec </span><del>- </del><ins>+ </ins><span class="cx"> def post_create_table(self, table): </span><span class="cx"> if hasattr( self , 'has_serial' ): </span><span class="cx"> del self.has_serial </span><span class="cx"> return '' </span><del>- </del><ins>+ </ins><span class="cx"> def visit_primary_key_constraint(self, constraint): </span><span class="cx"> # for informix 7.31 not support constraint name </span><span class="cx"> name = constraint.name </span><span class="cx"> constraint.name = None </span><span class="cx"> super(InfoSchemaGenerator, self).visit_primary_key_constraint(constraint) </span><span class="cx"> constraint.name = name </span><del>- </del><ins>+ </ins><span class="cx"> def visit_unique_constraint(self, constraint): </span><span class="cx"> # for informix 7.31 not support constraint name </span><span class="cx"> name = constraint.name </span><span class="cx"> constraint.name = None </span><span class="cx"> super(InfoSchemaGenerator, self).visit_unique_constraint(constraint) </span><span class="cx"> constraint.name = name </span><del>- </del><ins>+ </ins><span class="cx"> def visit_foreign_key_constraint( self , constraint ): </span><span class="cx"> if constraint.name is not None: </span><span class="cx"> constraint.use_alter = True </span><span class="cx"> else: </span><span class="cx"> super( InfoSchemaGenerator , self ).visit_foreign_key_constraint( constraint ) </span><del>- </del><ins>+ </ins><span class="cx"> def define_foreign_key(self, constraint): </span><span class="cx"> # for informix 7.31 not support constraint name </span><span class="cx"> if constraint.use_alter: </span><span class="lines">@@ -490,7 +490,7 @@ </span><span class="cx"> class InfoIdentifierPreparer(compiler.IdentifierPreparer): </span><span class="cx"> def __init__(self, dialect): </span><span class="cx"> super(InfoIdentifierPreparer, self).__init__(dialect, initial_quote="'") </span><del>- </del><ins>+ </ins><span class="cx"> def _requires_quotes(self, value): </span><span class="cx"> return False </span><span class="cx"> </span></span></pre></div> <a id="sqlalchemytrunklibsqlalchemydatabasesmaxdbpy"></a> <div class="modfile"><h4>Modified: sqlalchemy/trunk/lib/sqlalchemy/databases/maxdb.py (4049 => 4050)</h4> <pre class="diff"><span> <span class="info">--- sqlalchemy/trunk/lib/sqlalchemy/databases/maxdb.py 2008-01-10 22:45:07 UTC (rev 4049) +++ sqlalchemy/trunk/lib/sqlalchemy/databases/maxdb.py 2008-01-10 23:16:56 UTC (rev 4050) </span><span class="lines">@@ -953,7 +953,7 @@ </span><span class="cx"> class MaxDBSchemaGenerator(compiler.SchemaGenerator): </span><span class="cx"> def get_column_specification(self, column, **kw): </span><span class="cx"> colspec = [self.preparer.format_column(column), </span><del>- column.type.dialect_impl(self.dialect, _for_ddl=True).get_col_spec()] </del><ins>+ column.type.dialect_impl(self.dialect, _for_ddl=column).get_col_spec()] </ins><span class="cx"> </span><span class="cx"> if not column.nullable: </span><span class="cx"> colspec.append('NOT NULL') </span></span></pre></div> <a id="sqlalchemytrunklibsqlalchemydatabasesmssqlpy"></a> <div class="modfile"><h4>Modified: sqlalchemy/trunk/lib/sqlalchemy/databases/mssql.py (4049 => 4050)</h4> <pre class="diff"><span> <span class="info">--- sqlalchemy/trunk/lib/sqlalchemy/databases/mssql.py 2008-01-10 22:45:07 UTC (rev 4049) +++ sqlalchemy/trunk/lib/sqlalchemy/databases/mssql.py 2008-01-10 23:16:56 UTC (rev 4050) </span><span class="lines">@@ -20,7 +20,7 @@ </span><span class="cx"> Note that the start & increment values for sequences are optional </span><span class="cx"> and will default to 1,1. </span><span class="cx"> </span><del>-* Support for ``SET IDENTITY_INSERT ON`` mode (automagic on / off for </del><ins>+* Support for ``SET IDENTITY_INSERT ON`` mode (automagic on / off for </ins><span class="cx"> ``INSERT`` s) </span><span class="cx"> </span><span class="cx"> * Support for auto-fetching of ``@@IDENTITY/@@SCOPE_IDENTITY()`` on ``INSERT`` </span><span class="lines">@@ -34,7 +34,7 @@ </span><span class="cx"> </span><span class="cx"> * pymssql has problems with binary and unicode data that this module </span><span class="cx"> does **not** work around </span><del>- </del><ins>+ </ins><span class="cx"> """ </span><span class="cx"> </span><span class="cx"> import datetime, random, warnings, re, sys, operator </span><span class="lines">@@ -44,7 +44,7 @@ </span><span class="cx"> from sqlalchemy.engine import default, base </span><span class="cx"> from sqlalchemy import types as sqltypes </span><span class="cx"> from sqlalchemy.util import Decimal as _python_Decimal </span><del>- </del><ins>+ </ins><span class="cx"> MSSQL_RESERVED_WORDS = util.Set(['function']) </span><span class="cx"> </span><span class="cx"> class MSNumeric(sqltypes.Numeric): </span><span class="lines">@@ -67,9 +67,9 @@ </span><span class="cx"> # Not sure that this exception is needed </span><span class="cx"> return value </span><span class="cx"> else: </span><del>- return str(value) </del><ins>+ return str(value) </ins><span class="cx"> return process </span><del>- </del><ins>+ </ins><span class="cx"> def get_col_spec(self): </span><span class="cx"> if self.precision is None: </span><span class="cx"> return "NUMERIC" </span><span class="lines">@@ -87,7 +87,7 @@ </span><span class="cx"> return str(value) </span><span class="cx"> return None </span><span class="cx"> return process </span><del>- </del><ins>+ </ins><span class="cx"> class MSInteger(sqltypes.Integer): </span><span class="cx"> def get_col_spec(self): </span><span class="cx"> return "INTEGER" </span><span class="lines">@@ -123,7 +123,7 @@ </span><span class="cx"> </span><span class="cx"> def __init__(self, *a, **kw): </span><span class="cx"> super(MSTime, self).__init__(False) </span><del>- </del><ins>+ </ins><span class="cx"> def get_col_spec(self): </span><span class="cx"> return "DATETIME" </span><span class="cx"> </span><span class="lines">@@ -135,7 +135,7 @@ </span><span class="cx"> value = datetime.datetime.combine(self.__zero_date, value) </span><span class="cx"> return value </span><span class="cx"> return process </span><del>- </del><ins>+ </ins><span class="cx"> def result_processor(self, dialect): </span><span class="cx"> def process(value): </span><span class="cx"> if type(value) is datetime.datetime: </span><span class="lines">@@ -144,7 +144,7 @@ </span><span class="cx"> return datetime.time(0, 0, 0) </span><span class="cx"> return value </span><span class="cx"> return process </span><del>- </del><ins>+ </ins><span class="cx"> class MSDateTime_adodbapi(MSDateTime): </span><span class="cx"> def result_processor(self, dialect): </span><span class="cx"> def process(value): </span><span class="lines">@@ -154,7 +154,7 @@ </span><span class="cx"> return datetime.datetime(value.year, value.month, value.day) </span><span class="cx"> return value </span><span class="cx"> return process </span><del>- </del><ins>+ </ins><span class="cx"> class MSDateTime_pyodbc(MSDateTime): </span><span class="cx"> def bind_processor(self, dialect): </span><span class="cx"> def process(value): </span><span class="lines">@@ -162,7 +162,7 @@ </span><span class="cx"> return datetime.datetime(value.year, value.month, value.day) </span><span class="cx"> return value </span><span class="cx"> return process </span><del>- </del><ins>+ </ins><span class="cx"> class MSDate_pyodbc(MSDate): </span><span class="cx"> def bind_processor(self, dialect): </span><span class="cx"> def process(value): </span><span class="lines">@@ -170,7 +170,7 @@ </span><span class="cx"> return datetime.datetime(value.year, value.month, value.day) </span><span class="cx"> return value </span><span class="cx"> return process </span><del>- </del><ins>+ </ins><span class="cx"> def result_processor(self, dialect): </span><span class="cx"> def process(value): </span><span class="cx"> # pyodbc returns SMALLDATETIME values as datetime.datetime(). truncate it back to datetime.date() </span><span class="lines">@@ -178,7 +178,7 @@ </span><span class="cx"> return value.date() </span><span class="cx"> return value </span><span class="cx"> return process </span><del>- </del><ins>+ </ins><span class="cx"> class MSDate_pymssql(MSDate): </span><span class="cx"> def result_processor(self, dialect): </span><span class="cx"> def process(value): </span><span class="lines">@@ -187,11 +187,11 @@ </span><span class="cx"> return value.date() </span><span class="cx"> return value </span><span class="cx"> return process </span><del>- </del><ins>+ </ins><span class="cx"> class MSText(sqltypes.Text): </span><span class="cx"> def get_col_spec(self): </span><span class="cx"> if self.dialect.text_as_varchar: </span><del>- return "VARCHAR(max)" </del><ins>+ return "VARCHAR(max)" </ins><span class="cx"> else: </span><span class="cx"> return "TEXT" </span><span class="cx"> </span><span class="lines">@@ -238,7 +238,7 @@ </span><span class="cx"> return None </span><span class="cx"> return value and True or False </span><span class="cx"> return process </span><del>- </del><ins>+ </ins><span class="cx"> def bind_processor(self, dialect): </span><span class="cx"> def process(value): </span><span class="cx"> if value is True: </span><span class="lines">@@ -250,27 +250,27 @@ </span><span class="cx"> else: </span><span class="cx"> return value and True or False </span><span class="cx"> return process </span><del>- </del><ins>+ </ins><span class="cx"> class MSTimeStamp(sqltypes.TIMESTAMP): </span><span class="cx"> def get_col_spec(self): </span><span class="cx"> return "TIMESTAMP" </span><del>- </del><ins>+ </ins><span class="cx"> class MSMoney(sqltypes.TypeEngine): </span><span class="cx"> def get_col_spec(self): </span><span class="cx"> return "MONEY" </span><del>- </del><ins>+ </ins><span class="cx"> class MSSmallMoney(MSMoney): </span><span class="cx"> def get_col_spec(self): </span><span class="cx"> return "SMALLMONEY" </span><del>- </del><ins>+ </ins><span class="cx"> class MSUniqueIdentifier(sqltypes.TypeEngine): </span><span class="cx"> def get_col_spec(self): </span><span class="cx"> return "UNIQUEIDENTIFIER" </span><del>- </del><ins>+ </ins><span class="cx"> class MSVariant(sqltypes.TypeEngine): </span><span class="cx"> def get_col_spec(self): </span><span class="cx"> return "SQL_VARIANT" </span><del>- </del><ins>+ </ins><span class="cx"> def descriptor(): </span><span class="cx"> return {'name':'mssql', </span><span class="cx"> 'description':'MSSQL', </span><span class="lines">@@ -297,7 +297,7 @@ </span><span class="cx"> def pre_exec(self): </span><span class="cx"> """MS-SQL has a special mode for inserting non-NULL values </span><span class="cx"> into IDENTITY columns. </span><del>- </del><ins>+ </ins><span class="cx"> Activate it if the feature is turned on and needed. </span><span class="cx"> """ </span><span class="cx"> if self.compiled.isinsert: </span><span class="lines">@@ -328,7 +328,7 @@ </span><span class="cx"> and fetch recently inserted IDENTIFY values (works only for </span><span class="cx"> one column). </span><span class="cx"> """ </span><del>- </del><ins>+ </ins><span class="cx"> if self.compiled.isinsert and self.HASIDENT and not self.IINSERT: </span><span class="cx"> if not len(self._last_inserted_ids) or self._last_inserted_ids[0] is None: </span><span class="cx"> if self.dialect.use_scope_identity: </span><span class="lines">@@ -339,17 +339,17 @@ </span><span class="cx"> self._last_inserted_ids = [int(row[0])] + self._last_inserted_ids[1:] </span><span class="cx"> # print "LAST ROW ID", self._last_inserted_ids </span><span class="cx"> super(MSSQLExecutionContext, self).post_exec() </span><del>- </del><ins>+ </ins><span class="cx"> _ms_is_select = re.compile(r'\s*(?:SELECT|sp_columns)', </span><span class="cx"> re.I | re.UNICODE) </span><del>- </del><ins>+ </ins><span class="cx"> def returns_rows_text(self, statement): </span><span class="cx"> return self._ms_is_select.match(statement) is not None </span><span class="cx"> </span><span class="cx"> </span><del>-class MSSQLExecutionContext_pyodbc (MSSQLExecutionContext): </del><ins>+class MSSQLExecutionContext_pyodbc (MSSQLExecutionContext): </ins><span class="cx"> def pre_exec(self): </span><del>- """where appropriate, issue "select scope_identity()" in the same statement""" </del><ins>+ """where appropriate, issue "select scope_identity()" in the same statement""" </ins><span class="cx"> super(MSSQLExecutionContext_pyodbc, self).pre_exec() </span><span class="cx"> if self.compiled.isinsert and self.HASIDENT and (not self.IINSERT) \ </span><span class="cx"> and len(self.parameters) == 1 and self.dialect.use_scope_identity: </span><span class="lines">@@ -418,7 +418,7 @@ </span><span class="cx"> return dialect(*args, **kwargs) </span><span class="cx"> else: </span><span class="cx"> return object.__new__(cls, *args, **kwargs) </span><del>- </del><ins>+ </ins><span class="cx"> def __init__(self, auto_identity_insert=True, **params): </span><span class="cx"> super(MSSQLDialect, self).__init__(**params) </span><span class="cx"> self.auto_identity_insert = auto_identity_insert </span><span class="lines">@@ -442,7 +442,7 @@ </span><span class="cx"> else: </span><span class="cx"> raise ImportError('No DBAPI module detected for MSSQL - please install pyodbc, pymssql, or adodbapi') </span><span class="cx"> dbapi = classmethod(dbapi) </span><del>- </del><ins>+ </ins><span class="cx"> def create_connect_args(self, url): </span><span class="cx"> opts = url.translate_connect_args(username='user') </span><span class="cx"> opts.update(url.query) </span><span class="lines">@@ -477,20 +477,20 @@ </span><span class="cx"> </span><span class="cx"> def last_inserted_ids(self): </span><span class="cx"> return self.context.last_inserted_ids </span><del>- </del><ins>+ </ins><span class="cx"> def do_execute(self, cursor, statement, params, context=None, **kwargs): </span><span class="cx"> if params == {}: </span><span class="cx"> params = () </span><span class="cx"> try: </span><span class="cx"> super(MSSQLDialect, self).do_execute(cursor, statement, params, context=context, **kwargs) </span><del>- finally: </del><ins>+ finally: </ins><span class="cx"> if context.IINSERT: </span><span class="cx"> cursor.execute("SET IDENTITY_INSERT %s OFF" % self.identifier_preparer.format_table(context.compiled.statement.table)) </span><del>- </del><ins>+ </ins><span class="cx"> def do_executemany(self, cursor, statement, params, context=None, **kwargs): </span><span class="cx"> try: </span><span class="cx"> super(MSSQLDialect, self).do_executemany(cursor, statement, params, context=context, **kwargs) </span><del>- finally: </del><ins>+ finally: </ins><span class="cx"> if context.IINSERT: </span><span class="cx"> cursor.execute("SET IDENTITY_INSERT %s OFF" % self.identifier_preparer.format_table(context.compiled.statement.table)) </span><span class="cx"> </span><span class="lines">@@ -511,7 +511,7 @@ </span><span class="cx"> def raw_connection(self, connection): </span><span class="cx"> """Pull the raw pymmsql connection out--sensative to "pool.ConnectionFairy" and pymssql.pymssqlCnx Classes""" </span><span class="cx"> try: </span><del>- # TODO: probably want to move this to individual dialect subclasses to </del><ins>+ # TODO: probably want to move this to individual dialect subclasses to </ins><span class="cx"> # save on the exception throw + simplify </span><span class="cx"> return connection.connection.__dict__['_pymssqlCnx__cnx'] </span><span class="cx"> except: </span><span class="lines">@@ -536,14 +536,14 @@ </span><span class="cx"> and sql.and_(columns.c.table_name==tablename, columns.c.table_schema==current_schema) </span><span class="cx"> or columns.c.table_name==tablename, </span><span class="cx"> ) </span><del>- </del><ins>+ </ins><span class="cx"> c = connection.execute(s) </span><span class="cx"> row = c.fetchone() </span><span class="cx"> return row is not None </span><del>- </del><ins>+ </ins><span class="cx"> def reflecttable(self, connection, table, include_columns): </span><span class="cx"> import sqlalchemy.databases.information_schema as ischema </span><del>- </del><ins>+ </ins><span class="cx"> # Get base columns </span><span class="cx"> if table.schema is not None: </span><span class="cx"> current_schema = table.schema </span><span class="lines">@@ -556,7 +556,7 @@ </span><span class="cx"> and sql.and_(columns.c.table_name==table.name, columns.c.table_schema==current_schema) </span><span class="cx"> or columns.c.table_name==table.name, </span><span class="cx"> order_by=[columns.c.ordinal_position]) </span><del>- </del><ins>+ </ins><span class="cx"> c = connection.execute(s) </span><span class="cx"> found_table = False </span><span class="cx"> while True: </span><span class="lines">@@ -565,9 +565,9 @@ </span><span class="cx"> break </span><span class="cx"> found_table = True </span><span class="cx"> (name, type, nullable, charlen, numericprec, numericscale, default) = ( </span><del>- row[columns.c.column_name], - row[columns.c.data_type], - row[columns.c.is_nullable] == 'YES', </del><ins>+ row[columns.c.column_name], + row[columns.c.data_type], + row[columns.c.is_nullable] == 'YES', </ins><span class="cx"> row[columns.c.character_maximum_length], </span><span class="cx"> row[columns.c.numeric_precision], </span><span class="cx"> row[columns.c.numeric_scale], </span><span class="lines">@@ -582,21 +582,21 @@ </span><span class="cx"> args.append(a) </span><span class="cx"> coltype = self.ischema_names.get(type, None) </span><span class="cx"> if coltype == MSString and charlen == -1: </span><del>- coltype = MSText() </del><ins>+ coltype = MSText() </ins><span class="cx"> else: </span><span class="cx"> if coltype is None: </span><span class="cx"> warnings.warn(RuntimeWarning("Did not recognize type '%s' of column '%s'" % (type, name))) </span><span class="cx"> coltype = sqltypes.NULLTYPE </span><del>- </del><ins>+ </ins><span class="cx"> elif coltype in (MSNVarchar, AdoMSNVarchar) and charlen == -1: </span><span class="cx"> args[0] = None </span><span class="cx"> coltype = coltype(*args) </span><span class="cx"> colargs= [] </span><span class="cx"> if default is not None: </span><span class="cx"> colargs.append(schema.PassiveDefault(sql.text(default))) </span><del>- </del><ins>+ </ins><span class="cx"> table.append_column(schema.Column(name, coltype, nullable=nullable, autoincrement=False, *colargs)) </span><del>- </del><ins>+ </ins><span class="cx"> if not found_table: </span><span class="cx"> raise exceptions.NoSuchTableError(table.name) </span><span class="cx"> </span><span class="lines">@@ -631,7 +631,7 @@ </span><span class="cx"> # Add constraints </span><span class="cx"> RR = self.uppercase_table(ischema.ref_constraints) #information_schema.referential_constraints </span><span class="cx"> TC = self.uppercase_table(ischema.constraints) #information_schema.table_constraints </span><del>- C = self.uppercase_table(ischema.pg_key_constraints).alias('C') #information_schema.constraint_column_usage: the constrained column </del><ins>+ C = self.uppercase_table(ischema.pg_key_constraints).alias('C') #information_schema.constraint_column_usage: the constrained column </ins><span class="cx"> R = self.uppercase_table(ischema.pg_key_constraints).alias('R') #information_schema.constraint_column_usage: the referenced column </span><span class="cx"> </span><span class="cx"> # Primary key constraints </span><span class="lines">@@ -672,7 +672,7 @@ </span><span class="cx"> class MSSQLDialect_pymssql(MSSQLDialect): </span><span class="cx"> supports_sane_rowcount = False </span><span class="cx"> max_identifier_length = 30 </span><del>- </del><ins>+ </ins><span class="cx"> def import_dbapi(cls): </span><span class="cx"> import pymssql as module </span><span class="cx"> # pymmsql doesn't have a Binary method. we use string </span><span class="lines">@@ -680,7 +680,7 @@ </span><span class="cx"> module.Binary = lambda st: str(st) </span><span class="cx"> return module </span><span class="cx"> import_dbapi = classmethod(import_dbapi) </span><del>- </del><ins>+ </ins><span class="cx"> colspecs = MSSQLDialect.colspecs.copy() </span><span class="cx"> colspecs[sqltypes.Date] = MSDate_pymssql </span><span class="cx"> </span><span class="lines">@@ -723,7 +723,7 @@ </span><span class="cx"> ## This code is leftover from the initial implementation, for reference </span><span class="cx"> ## def do_begin(self, connection): </span><span class="cx"> ## """implementations might want to put logic here for turning autocommit on/off, etc.""" </span><del>-## pass </del><ins>+## pass </ins><span class="cx"> </span><span class="cx"> ## def do_rollback(self, connection): </span><span class="cx"> ## """implementations might want to put logic here for turning autocommit on/off, etc.""" </span><span class="lines">@@ -740,7 +740,7 @@ </span><span class="cx"> </span><span class="cx"> ## def do_commit(self, connection): </span><span class="cx"> ## """implementations might want to put logic here for turning autocommit on/off, etc. </span><del>-## do_commit is set for pymmsql connections--ADO seems to handle transactions without any issue </del><ins>+## do_commit is set for pymmsql connections--ADO seems to handle transactions without any issue </ins><span class="cx"> ## """ </span><span class="cx"> ## # ADO Uses Implicit Transactions. </span><span class="cx"> ## # This is very pymssql specific. We use this instead of its commit, because it hangs on failed rollbacks. </span><span class="lines">@@ -757,7 +757,7 @@ </span><span class="cx"> # PyODBC unicode is broken on UCS-4 builds </span><span class="cx"> supports_unicode = sys.maxunicode == 65535 </span><span class="cx"> supports_unicode_statements = supports_unicode </span><del>- </del><ins>+ </ins><span class="cx"> def __init__(self, **params): </span><span class="cx"> super(MSSQLDialect_pyodbc, self).__init__(**params) </span><span class="cx"> # whether use_scope_identity will work depends on the version of pyodbc </span><span class="lines">@@ -766,12 +766,12 @@ </span><span class="cx"> self.use_scope_identity = hasattr(pyodbc.Cursor, 'nextset') </span><span class="cx"> except: </span><span class="cx"> pass </span><del>- </del><ins>+ </ins><span class="cx"> def import_dbapi(cls): </span><span class="cx"> import pyodbc as module </span><span class="cx"> return module </span><span class="cx"> import_dbapi = classmethod(import_dbapi) </span><del>- </del><ins>+ </ins><span class="cx"> colspecs = MSSQLDialect.colspecs.copy() </span><span class="cx"> if supports_unicode: </span><span class="cx"> colspecs[sqltypes.Unicode] = AdoMSNVarchar </span><span class="lines">@@ -883,10 +883,10 @@ </span><span class="cx"> raise exceptions.InvalidRequestError('MSSQL does not support LIMIT with an offset') </span><span class="cx"> return s </span><span class="cx"> </span><del>- def limit_clause(self, select): </del><ins>+ def limit_clause(self, select): </ins><span class="cx"> # Limit in mssql is after the select keyword </span><span class="cx"> return "" </span><del>- </del><ins>+ </ins><span class="cx"> def _schema_aliased_table(self, table): </span><span class="cx"> if getattr(table, 'schema', None) is not None: </span><span class="cx"> if table not in self.tablealiases: </span><span class="lines">@@ -894,7 +894,7 @@ </span><span class="cx"> return self.tablealiases[table] </span><span class="cx"> else: </span><span class="cx"> return None </span><del>- </del><ins>+ </ins><span class="cx"> def visit_table(self, table, mssql_aliased=False, **kwargs): </span><span class="cx"> if mssql_aliased: </span><span class="cx"> return super(MSSQLCompiler, self).visit_table(table, **kwargs) </span><span class="lines">@@ -905,7 +905,7 @@ </span><span class="cx"> return self.process(alias, mssql_aliased=True, **kwargs) </span><span class="cx"> else: </span><span class="cx"> return super(MSSQLCompiler, self).visit_table(table, **kwargs) </span><del>- </del><ins>+ </ins><span class="cx"> def visit_alias(self, alias, **kwargs): </span><span class="cx"> # translate for schema-qualified table aliases </span><span class="cx"> self.tablealiases[alias.original] = alias </span><span class="lines">@@ -956,8 +956,8 @@ </span><span class="cx"> </span><span class="cx"> class MSSQLSchemaGenerator(compiler.SchemaGenerator): </span><span class="cx"> def get_column_specification(self, column, **kwargs): </span><del>- colspec = self.preparer.format_column(column) + " " + column.type.dialect_impl(self.dialect, _for_ddl=True).get_col_spec() - </del><ins>+ colspec = self.preparer.format_column(column) + " " + column.type.dialect_impl(self.dialect, _for_ddl=column).get_col_spec() + </ins><span class="cx"> # install a IDENTITY Sequence if we have an implicit IDENTITY column </span><span class="cx"> if (not getattr(column.table, 'has_sequence', False)) and column.primary_key and \ </span><span class="cx"> column.autoincrement and isinstance(column.type, sqltypes.Integer) and not column.foreign_keys: </span><span class="lines">@@ -974,7 +974,7 @@ </span><span class="cx"> default = self.get_column_default_string(column) </span><span class="cx"> if default is not None: </span><span class="cx"> colspec += " DEFAULT " + default </span><del>- </del><ins>+ </ins><span class="cx"> return colspec </span><span class="cx"> </span><span class="cx"> class MSSQLSchemaDropper(compiler.SchemaDropper): </span></span></pre></div> <a id="sqlalchemytrunklibsqlalchemydatabasesmysqlpy"></a> <div class="modfile"><h4>Modified: sqlalchemy/trunk/lib/sqlalchemy/databases/mysql.py (4049 => 4050)</h4> <pre class="diff"><span> <span class="info">--- sqlalchemy/trunk/lib/sqlalchemy/databases/mysql.py 2008-01-10 22:45:07 UTC (rev 4049) +++ sqlalchemy/trunk/lib/sqlalchemy/databases/mysql.py 2008-01-10 23:16:56 UTC (rev 4050) </span><span class="lines">@@ -1956,7 +1956,8 @@ </span><span class="cx"> """Builds column DDL.""" </span><span class="cx"> </span><span class="cx"> colspec = [self.preparer.format_column(column), </span><del>- column.type.dialect_impl(self.dialect, _for_ddl=True).get_col_spec()] </del><ins>+ column.type.dialect_impl(self.dialect, + _for_ddl=column).get_col_spec()] </ins><span class="cx"> </span><span class="cx"> default = self.get_column_default_string(column) </span><span class="cx"> if default is not None: </span></span></pre></div> <a id="sqlalchemytrunklibsqlalchemydatabasesoraclepy"></a> <div class="modfile"><h4>Modified: sqlalchemy/trunk/lib/sqlalchemy/databases/oracle.py (4049 => 4050)</h4> <pre class="diff"><span> <span class="info">--- sqlalchemy/trunk/lib/sqlalchemy/databases/oracle.py 2008-01-10 22:45:07 UTC (rev 4049) +++ sqlalchemy/trunk/lib/sqlalchemy/databases/oracle.py 2008-01-10 23:16:56 UTC (rev 4050) </span><span class="lines">@@ -44,11 +44,11 @@ </span><span class="cx"> else: </span><span class="cx"> return value.date() </span><span class="cx"> return process </span><del>- </del><ins>+ </ins><span class="cx"> class OracleDateTime(sqltypes.DateTime): </span><span class="cx"> def get_col_spec(self): </span><span class="cx"> return "DATE" </span><del>- </del><ins>+ </ins><span class="cx"> def result_processor(self, dialect): </span><span class="cx"> def process(value): </span><span class="cx"> if value is None or isinstance(value,datetime.datetime): </span><span class="lines">@@ -58,7 +58,7 @@ </span><span class="cx"> return datetime.datetime(value.year,value.month, </span><span class="cx"> value.day,value.hour, value.minute, value.second) </span><span class="cx"> return process </span><del>- </del><ins>+ </ins><span class="cx"> # Note: </span><span class="cx"> # Oracle DATE == DATETIME </span><span class="cx"> # Oracle does not allow milliseconds in DATE </span><span class="lines">@@ -135,7 +135,7 @@ </span><span class="cx"> else: </span><span class="cx"> return value </span><span class="cx"> return process </span><del>- </del><ins>+ </ins><span class="cx"> class OracleBoolean(sqltypes.Boolean): </span><span class="cx"> def get_col_spec(self): </span><span class="cx"> return "SMALLINT" </span><span class="lines">@@ -146,7 +146,7 @@ </span><span class="cx"> return None </span><span class="cx"> return value and True or False </span><span class="cx"> re... [truncated message content] |