~ubuntu-branches/debian/sid/sqlalchemy/sid

« back to all changes in this revision

Viewing changes to lib/sqlalchemy/dialects/mssql/base.py

  • Committer: Package Import Robot
  • Author(s): Piotr Ożarowski
  • Date: 2014-06-27 20:17:13 UTC
  • mfrom: (1.4.28)
  • Revision ID: package-import@ubuntu.com-20140627201713-g6p1kq8q1qenztrv
Tags: 0.9.6-1
* New upstream release
* Remove Python 3.X build tag files, thanks to Matthias Urlichs for the
  patch (closes: #747852)
* python-fdb isn't in the Debian archive yet so default dialect for firebird://
  URLs is changed to obsolete kinterbasdb, thanks to Russell Stuart for the
  patch (closes: #752145)

Show diffs side-by-side

added added

removed removed

Lines of Context:
740
740
                                        self.process(binary.right, **kw))
741
741
 
742
742
    def get_select_precolumns(self, select):
743
 
        """ MS-SQL puts TOP, it's version of LIMIT here """
 
743
        """ MS-SQL puts TOP, its version of LIMIT, here """
744
744
        if select._distinct or select._limit is not None:
745
745
            s = select._distinct and "DISTINCT " or ""
746
746
 
1216
1216
            self.implicit_returning = True
1217
1217
 
1218
1218
    def _get_default_schema_name(self, connection):
1219
 
        user_name = connection.scalar("SELECT user_name()")
1220
 
        if user_name is not None:
1221
 
            # now, get the default schema
1222
 
            query = sql.text("""
 
1219
        query = sql.text("""
1223
1220
            SELECT default_schema_name FROM
1224
1221
            sys.database_principals
1225
 
            WHERE name = :name
1226
 
            AND type = 'S'
1227
 
            """)
1228
 
            try:
1229
 
                default_schema_name = connection.scalar(query, name=user_name)
1230
 
                if default_schema_name is not None:
1231
 
                    return util.text_type(default_schema_name)
1232
 
            except:
1233
 
                pass
1234
 
        return self.schema_name
 
1222
            WHERE principal_id=database_principal_id()
 
1223
        """)
 
1224
        default_schema_name = connection.scalar(query)
 
1225
        if default_schema_name is not None:
 
1226
            return util.text_type(default_schema_name)
 
1227
        else:
 
1228
            return self.schema_name
1235
1229
 
1236
1230
    @_db_plus_owner
1237
1231
    def has_table(self, connection, tablename, dbname, owner, schema):