Changeset 244:542828d3c373 in livinglogic.python.orasql

Show
Ignore:
Timestamp:
03/19/08 16:40:41 (12 years ago)
Author:
Walter Doerwald <walter@…>
Branch:
default
Message:

Update Cursor docstring. Don't use the x-methods any longer.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/ll/orasql/__init__.py

    r242 r244  
    329329        cursor = self.cursor() 
    330330        if schema == "all": 
    331             cursor.xexecute("select object_type as type, count(*) as count from all_objects group by object_type") 
    332         else: 
    333             cursor.xexecute("select object_type as type, count(*) as count from user_objects group by object_type") 
    334         for row in cursor.xfetchall(): 
     331            cursor.execute("select object_type as type, count(*) as count from all_objects group by object_type") 
     332        else: 
     333            cursor.execute("select object_type as type, count(*) as count from user_objects group by object_type") 
     334        for row in cursor.fetchall(): 
    335335            class_ = Object.name2type.get(row.type.lower(), None) 
    336336            if class_ is not None: 
     
    366366        else: 
    367367            cursor.execute("select null as owner, table_name from user_tables minus select null as owner, mview_name as table_name from user_mviews") 
    368         for rec in cursor.xfetchall(): 
     368        for rec in cursor.fetchall(): 
    369369            yield Table(rec.table_name, rec.owner, self) 
    370370 
     
    391391        else: 
    392392            cursor.execute("select null as owner, constraint_name from user_constraints where constraint_type='R' order by table_name, constraint_name") 
    393         for rec in cursor.xfetchall(): 
     393        for rec in cursor.fetchall(): 
    394394            yield ForeignKey(rec.constraint_name, rec.owner, self) 
    395395 
     
    448448            # select * from all_sequences where sequence_owner=nvl(:owner, user) and sequence_name=:name 
    449449            if schema == "all": 
    450                 cursor.xexecute("select decode(sequence_owner, user, null, sequence_owner) as sequence_owner, sequence_name from all_sequences") 
     450                cursor.execute("select decode(sequence_owner, user, null, sequence_owner) as sequence_owner, sequence_name from all_sequences") 
    451451            else: 
    452                 cursor.xexecute("select null as sequence_owner, sequence_name from user_sequences") 
    453             for rec in cursor.xfetchall(): 
     452                cursor.execute("select null as sequence_owner, sequence_name from user_sequences") 
     453            for rec in cursor.fetchall(): 
    454454                for obj in do(Sequence(rec.sequence_name, rec.sequence_owner, self)): 
    455455                    yield obj 
     
    457457        def dotables(): 
    458458            if schema == "all": 
    459                 cursor.xexecute("select decode(owner, user, null, owner) as owner, table_name from all_tables") 
     459                cursor.execute("select decode(owner, user, null, owner) as owner, table_name from all_tables") 
    460460            else: 
    461                 cursor.xexecute("select null as owner, table_name from user_tables") 
    462             for rec in cursor.xfetchall(): 
     461                cursor.execute("select null as owner, table_name from user_tables") 
     462            for rec in cursor.fetchall(): 
    463463                obj = Table(rec.table_name, rec.owner, self) 
    464464                if mode == "create" or mode == "flat": 
     
    469469                    # Primary key 
    470470                    if schema == "all": 
    471                         cursor.xexecute("select decode(owner, user, null, owner) as owner, constraint_name from all_constraints where constraint_type='P' and owner=:owner and table_name=:name", owner=rec.owner, name=rec.table_name) 
     471                        cursor.execute("select decode(owner, user, null, owner) as owner, constraint_name from all_constraints where constraint_type='P' and owner=:owner and table_name=:name", owner=rec.owner, name=rec.table_name) 
    472472                    else: 
    473                         cursor.xexecute("select null as owner, constraint_name from user_constraints where constraint_type='P' and table_name=:name", name=rec.table_name) 
    474                     for rec2 in cursor.xfetchall(): 
     473                        cursor.execute("select null as owner, constraint_name from user_constraints where constraint_type='P' and table_name=:name", name=rec.table_name) 
     474                    for rec2 in cursor.fetchall(): 
    475475                        for subobj in do(PrimaryKey(rec2.constraint_name, rec2.owner, self)): 
    476476                            yield subobj 
     
    478478                    # Comments 
    479479                    if schema == "all": 
    480                         cursor.xexecute("select column_name from all_tab_columns where owner=:owner and table_name=:name order by column_id", owner=rec.owner, name=rec.table_name) 
     480                        cursor.execute("select column_name from all_tab_columns where owner=:owner and table_name=:name order by column_id", owner=rec.owner, name=rec.table_name) 
    481481                    else: 
    482                         cursor.xexecute("select column_name from user_tab_columns where table_name=:name order by column_id", name=rec.table_name) 
    483                     for rec2 in cursor.xfetchall(): 
     482                        cursor.execute("select column_name from user_tab_columns where table_name=:name order by column_id", name=rec.table_name) 
     483                    for rec2 in cursor.fetchall(): 
    484484                        # No dependency checks neccessary, but use do anyway 
    485485                        for subobj in do(Comment("%s.%s" % (rec.table_name, rec2.column_name), rec.owner, self)): 
     
    492492        def doconstraints(): 
    493493            if schema == "all": 
    494                 cursor.xexecute("select constraint_type, decode(owner, user, null, owner) as owner, constraint_name from all_constraints where constraint_type in ('R', 'U') order by owner, table_name, constraint_type, constraint_name") 
     494                cursor.execute("select constraint_type, decode(owner, user, null, owner) as owner, constraint_name from all_constraints where constraint_type in ('R', 'U') order by owner, table_name, constraint_type, constraint_name") 
    495495            else: 
    496                 cursor.xexecute("select constraint_type, null as owner, constraint_name from user_constraints where constraint_type in ('R', 'U') order by table_name, constraint_type, constraint_name") 
     496                cursor.execute("select constraint_type, null as owner, constraint_name from user_constraints where constraint_type in ('R', 'U') order by table_name, constraint_type, constraint_name") 
    497497            types = {"U": UniqueConstraint, "R": ForeignKey} 
    498             for rec in cursor.xfetchall(): 
     498            for rec in cursor.fetchall(): 
    499499                for subobj in do(types[rec.constraint_type](rec.constraint_name, rec.owner, self)): 
    500500                    yield subobj 
     
    502502        def doindexes(): 
    503503            if schema == "all": 
    504                 cursor.xexecute("select decode(owner, user, null, owner) as owner, index_name from all_indexes where index_type in ('NORMAL', 'FUNCTION-BASED NORMAL') order by owner, table_name, index_name") 
     504                cursor.execute("select decode(owner, user, null, owner) as owner, index_name from all_indexes where index_type in ('NORMAL', 'FUNCTION-BASED NORMAL') order by owner, table_name, index_name") 
    505505            else: 
    506                 cursor.xexecute("select null as owner, index_name from user_indexes where index_type in ('NORMAL', 'FUNCTION-BASED NORMAL') order by table_name, index_name") 
    507             for rec in cursor.xfetchall(): 
     506                cursor.execute("select null as owner, index_name from user_indexes where index_type in ('NORMAL', 'FUNCTION-BASED NORMAL') order by table_name, index_name") 
     507            for rec in cursor.fetchall(): 
    508508                for subobj in do(Index(rec.index_name, rec.owner, self)): 
    509509                    yield subobj 
     
    511511        def dosynonyms(): 
    512512            if schema == "all": 
    513                 cursor.xexecute("select decode(owner, user, null, owner) as owner, synonym_name from all_synonyms") 
     513                cursor.execute("select decode(owner, user, null, owner) as owner, synonym_name from all_synonyms") 
    514514            else: 
    515                 cursor.xexecute("select null as owner, synonym_name from user_synonyms") 
    516             for rec in cursor.xfetchall(): 
     515                cursor.execute("select null as owner, synonym_name from user_synonyms") 
     516            for rec in cursor.fetchall(): 
    517517                for subobj in do(Synonym(rec.synonym_name, rec.owner, self)): 
    518518                    yield subobj 
     
    520520        def doviews(): 
    521521            if schema == "all": 
    522                 cursor.xexecute("select decode(owner, user, null, owner) as owner, view_name from all_views") 
     522                cursor.execute("select decode(owner, user, null, owner) as owner, view_name from all_views") 
    523523            else: 
    524                 cursor.xexecute("select null as owner, view_name from user_views") 
    525             for rec in cursor.xfetchall(): 
     524                cursor.execute("select null as owner, view_name from user_views") 
     525            for rec in cursor.fetchall(): 
    526526                for subobj in do(View(rec.view_name, rec.owner, self)): 
    527527                    yield subobj 
     
    529529        def domviews(): 
    530530            if schema == "all": 
    531                 cursor.xexecute("select decode(owner, user, null, owner) as owner, mview_name from all_mviews") 
     531                cursor.execute("select decode(owner, user, null, owner) as owner, mview_name from all_mviews") 
    532532            else: 
    533                 cursor.xexecute("select null as owner, mview_name from user_mviews") 
    534             for rec in cursor.xfetchall(): 
     533                cursor.execute("select null as owner, mview_name from user_mviews") 
     534            for rec in cursor.fetchall(): 
    535535                for subobj in do(MaterializedView(rec.mview_name, rec.owner, self)): 
    536536                    yield subobj 
     
    539539            for type in (Function, Procedure, Package, PackageBody, Type, Trigger, JavaSource): 
    540540                if schema == "all": 
    541                     cursor.xexecute("select decode(owner, user, null, owner) as owner, object_name from all_objects where lower(object_type)=lower(:type)", type=type.type) 
     541                    cursor.execute("select decode(owner, user, null, owner) as owner, object_name from all_objects where lower(object_type)=lower(:type)", type=type.type) 
    542542                else: 
    543                     cursor.xexecute("select null as owner, object_name from user_objects where lower(object_type)=lower(:type)", type=type.type) 
    544                 for rec in cursor.xfetchall(): 
     543                    cursor.execute("select null as owner, object_name from user_objects where lower(object_type)=lower(:type)", type=type.type) 
     544                for rec in cursor.fetchall(): 
    545545                    for subobj in do(type(rec.object_name, rec.owner, self)): 
    546546                        yield subobj 
     
    556556    def _getobject(self, name, owner=None): 
    557557        cursor = self.cursor() 
    558         cursor.xexecute("select object_name, decode(owner, user, null, owner) as owner, object_type from all_objects where object_name = :object_name and owner = nvl(:owner, user)", object_name=name, owner=owner) 
    559         rec = cursor.xfetchone() 
     558        cursor.execute("select object_name, decode(owner, user, null, owner) as owner, object_type from all_objects where object_name = :object_name and owner = nvl(:owner, user)", object_name=name, owner=owner) 
     559        rec = cursor.fetchone() 
    560560        if rec is not None: 
    561561            type = rec.object_type.lower() 
     
    581581            "select object_name, decode(owner, user, null, owner) as owner, object_type from all_objects where lower(object_name) = lower(:object_name) and lower(owner) = lower(nvl(:owner, user))", 
    582582        ): 
    583             cursor.xexecute(query, object_name=name, owner=owner) 
    584             rec = cursor.xfetchone() 
     583            cursor.execute(query, object_name=name, owner=owner) 
     584            rec = cursor.fetchone() 
    585585            if rec is not None: 
    586586                type = rec.object_type.lower() 
     
    638638class Cursor(Cursor): 
    639639    """ 
    640     A subclass of the cursor class in :mod:`cx_Oracle`. A :class:`Cursor` object 
    641     provides the following additional methods: :meth:`xexecute`, 
    642     :meth:`xexecutemany`, :meth:`xfetchone`, :meth:`xfetchmany`, :meth:`xfetchall` 
    643     and :meth:`xfetch`. The "execute" methods support a unicode statement and 
    644     unicode parameters (they will be encoded in the client encoding before being 
    645     passed to the database). The "fetch" methods will return records as 
    646     :class:`Record` objects and string values and ``CLOB`` values, if the 
    647     cursors :attr:`readlobs` attribute has the appropriate value) will be 
    648     returned as :class:`unicode` objects (except for :class:`BLOB` values). 
    649     (Note that strings in the national character set (and :class:`NCLOB` values) 
    650     are not supported). 
     640    A subclass of the cursor class in :mod:`cx_Oracle`. The "execute" methods 
     641    support a unicode statement and unicode parameters (they will be encoded in 
     642    the client encoding before being passed to the database). The "fetch" methods 
     643    will return records as :class:`FetchRecord` objects and string values and 
     644    ``CLOB`` values, if the cursors :attr:`readlobs` attribute has the 
     645    appropriate value) will be returned as :class:`unicode` objects (except for 
     646    :class:`BLOB` values). (Note that strings in the national character set 
     647    (and :class:`NCLOB` values) are not supported). 
    651648    """ 
    652649    def __init__(self, connection, readlobs=None): 
     
    741738    def cdate(self, connection=None): 
    742739        (connection, cursor) = self.getcursor(connection) 
    743         cursor.xexecute("select created from all_objects where lower(object_type)=:type and object_name=:name and owner=nvl(:owner, user)", type=self.__class__.type, name=self.name, owner=self.owner) 
    744         row = cursor.xfetchone() 
     740        cursor.execute("select created from all_objects where lower(object_type)=:type and object_name=:name and owner=nvl(:owner, user)", type=self.__class__.type, name=self.name, owner=self.owner) 
     741        row = cursor.fetchone() 
    745742        if row is None: 
    746743            raise SQLObjectNotFoundError(self) 
     
    749746    def udate(self, connection=None): 
    750747        (connection, cursor) = self.getcursor(connection) 
    751         cursor.xexecute("select last_ddl_time from all_objects where lower(object_type)=:type and object_name=:name and owner=nvl(:owner, user)", type=self.__class__.type, name=self.name, owner=self.owner) 
    752         row = cursor.xfetchone() 
     748        cursor.execute("select last_ddl_time from all_objects where lower(object_type)=:type and object_name=:name and owner=nvl(:owner, user)", type=self.__class__.type, name=self.name, owner=self.owner) 
     749        row = cursor.fetchone() 
    753750        if row is None: 
    754751            raise SQLObjectNotFoundError(self) 
     
    763760    def createddl(self, connection=None, term=True): 
    764761        (connection, cursor) = self.getcursor(connection) 
    765         cursor.xexecute("select text from all_source where lower(type)=lower(:type) and owner=nvl(:owner, user) and name=:name order by line", type=self.__class__.type, owner=self.owner, name=self.name) 
    766         code = "\n".join((rec.text or "").rstrip() for rec in cursor.xfetch()) # sqlplus strips trailing spaces when executing SQL scripts, so we do that too 
     762        cursor.execute("select text from all_source where lower(type)=lower(:type) and owner=nvl(:owner, user) and name=:name order by line", type=self.__class__.type, owner=self.owner, name=self.name) 
     763        code = "\n".join((rec.text or "").rstrip() for rec in cursor) # sqlplus strips trailing spaces when executing SQL scripts, so we do that too 
    767764        if not code: 
    768765            raise SQLObjectNotFoundError(self) 
     
    899896        """ 
    900897        (connection, cursor) = self.getcursor(connection) 
    901         cursor.xexecute("select referenced_type, decode(referenced_owner, user, null, referenced_owner) as referenced_owner, referenced_name from all_dependencies where type=upper(:type) and name=:name and owner=nvl(:owner, user) and type != 'NON-EXISTENT'", type=self.type, name=self.name, owner=self.owner) 
    902         for rec in cursor.xfetchall(): 
     898        cursor.execute("select referenced_type, decode(referenced_owner, user, null, referenced_owner) as referenced_owner, referenced_name from all_dependencies where type=upper(:type) and name=:name and owner=nvl(:owner, user) and type != 'NON-EXISTENT'", type=self.type, name=self.name, owner=self.owner) 
     899        for rec in cursor.fetchall(): 
    903900            try: 
    904901                type = Object.name2type[rec.referenced_type.lower()] 
     
    932929        """ 
    933930        (connection, cursor) = self.getcursor(connection) 
    934         cursor.xexecute("select type, decode(owner, user, null, owner) as owner, name from all_dependencies where referenced_type=upper(:type) and referenced_name=:name and referenced_owner=nvl(:owner, user) and type != 'NON-EXISTENT'", type=self.type, name=self.name, owner=self.owner) 
    935         for rec in cursor.xfetchall(): 
     931        cursor.execute("select type, decode(owner, user, null, owner) as owner, name from all_dependencies where referenced_type=upper(:type) and referenced_name=:name and referenced_owner=nvl(:owner, user) and type != 'NON-EXISTENT'", type=self.type, name=self.name, owner=self.owner) 
     932        for rec in cursor.fetchall(): 
    936933            try: 
    937934                type = Object.name2type[rec.type.lower()] 
     
    983980        cursor = connection.cursor() 
    984981        if schema=="all": 
    985             cursor.xexecute("select decode(owner, user, null, owner) as owner, object_name from all_objects where lower(object_type) = :type", type=cls.type) 
    986         else: 
    987             cursor.xexecute("select null as owner, object_name from user_objects where lower(object_type) = :type", type=cls.type) 
    988         return (cls(row.object_name, row.owner, connection) for row in cursor.xfetch()) 
     982            cursor.execute("select decode(owner, user, null, owner) as owner, object_name from all_objects where lower(object_type) = :type", type=cls.type) 
     983        else: 
     984            cursor.execute("select null as owner, object_name from user_objects where lower(object_type) = :type", type=cls.type) 
     985        return (cls(row.object_name, row.owner, connection) for row in cursor) 
    989986 
    990987    def __iter__(self): 
     
    10281025    def _createddl(self, connection, term, copyvalue): 
    10291026        (connection, cursor) = self.getcursor(connection) 
    1030         cursor.xexecute("select * from all_sequences where sequence_owner=nvl(:owner, user) and sequence_name=:name", owner=self.owner, name=self.name) 
    1031         rec = cursor.xfetchone() 
     1027        cursor.execute("select * from all_sequences where sequence_owner=nvl(:owner, user) and sequence_name=:name", owner=self.owner, name=self.name) 
     1028        rec = cursor.fetchone() 
    10321029        if rec is None: 
    10331030            raise SQLObjectNotFoundError(self) 
     
    11331130        if self.ismview(connection): 
    11341131            return "" 
    1135         cursor.xexecute("select * from all_tab_columns where owner=nvl(:owner, user) and table_name=:name order by column_id asc", owner=self.owner, name=self.name) 
    1136         recs = cursor.xfetchall() 
     1132        cursor.execute("select * from all_tab_columns where owner=nvl(:owner, user) and table_name=:name order by column_id asc", owner=self.owner, name=self.name) 
     1133        recs = cursor.fetchall() 
    11371134        if not recs: 
    11381135            raise SQLObjectNotFoundError(self) 
     
    11691166        """ 
    11701167        (connection, cursor) = self.getcursor(connection) 
    1171         cursor.xexecute("select mview_name from all_mviews where owner=nvl(:owner, user) and mview_name=:name", owner=self.owner, name=self.name) 
    1172         rec = cursor.xfetchone() 
     1168        cursor.execute("select mview_name from all_mviews where owner=nvl(:owner, user) and mview_name=:name", owner=self.owner, name=self.name) 
     1169        rec = cursor.fetchone() 
    11731170        if rec is not None: 
    11741171            rec = MaterializedView(self.name, self.owner, connection) 
     
    11851182        cursor = connection.cursor() 
    11861183        if schema == "all": 
    1187             cursor.xexecute("select decode(owner, user, null, owner) as owner, table_name from all_tables") 
    1188         else: 
    1189             cursor.xexecute("select null as owner, table_name from user_tables") 
    1190         return (cls(row.table_name, row.owner, connection=connection) for row in cursor.xfetch()) 
     1184            cursor.execute("select decode(owner, user, null, owner) as owner, table_name from all_tables") 
     1185        else: 
     1186            cursor.execute("select null as owner, table_name from user_tables") 
     1187        return (cls(row.table_name, row.owner, connection=connection) for row in cursor) 
    11911188 
    11921189    def itercolumns(self, connection=None): 
     
    11951192        """ 
    11961193        (connection, cursor) = self.getcursor(connection) 
    1197         cursor.xexecute("select column_name from all_tab_columns where owner=nvl(:owner, user) and table_name=:name order by column_id", owner=self.owner, name=self.name) 
    1198  
    1199         for rec in cursor.xfetchall(): 
     1194        cursor.execute("select column_name from all_tab_columns where owner=nvl(:owner, user) and table_name=:name order by column_id", owner=self.owner, name=self.name) 
     1195 
     1196        for rec in cursor.fetchall(): 
    12001197            yield Column("%s.%s" % (self.name, rec.column_name), self.owner, connection) 
    12011198 
     
    12061203        (connection, cursor) = self.getcursor(connection) 
    12071204        query = "select * from %s" % self.getfullname() 
    1208         cursor.xexecute(query) 
    1209         return cursor.xfetch() 
     1205        cursor.execute(query) 
     1206        return iter(cursor) 
    12101207 
    12111208    def itercomments(self, connection=None): 
     
    12141211        """ 
    12151212        (connection, cursor) = self.getcursor(connection) 
    1216         cursor.xexecute("select column_name from all_tab_columns where owner=nvl(:owner, user) and table_name=:name order by column_id", owner=self.owner, name=self.name) 
    1217         for rec in cursor.xfetchall(): 
     1213        cursor.execute("select column_name from all_tab_columns where owner=nvl(:owner, user) and table_name=:name order by column_id", owner=self.owner, name=self.name) 
     1214        for rec in cursor.fetchall(): 
    12181215            yield Comment("%s.%s" % (self.name, rec.column_name), self.owner, connection) 
    12191216 
     
    12241221        (connection, cursor) = self.getcursor(connection) 
    12251222        # Primary and unique key(s) 
    1226         cursor.xexecute("select decode(owner, user, null, owner) as owner, constraint_type, constraint_name from all_constraints where constraint_type in ('P', 'U', 'R') and owner=nvl(:owner, user) and table_name=:name", owner=self.owner, name=self.name) 
     1223        cursor.execute("select decode(owner, user, null, owner) as owner, constraint_type, constraint_name from all_constraints where constraint_type in ('P', 'U', 'R') and owner=nvl(:owner, user) and table_name=:name", owner=self.owner, name=self.name) 
    12271224        types = {"P": PrimaryKey, "U": UniqueConstraint, "R": ForeignKey} 
    1228         for rec in cursor.xfetchall(): 
     1225        for rec in cursor.fetchall(): 
    12291226            yield types[rec.constraint_type](rec.constraint_name, rec.owner, connection) 
    12301227 
     
    12731270    def createddl(self, connection=None, term=True): 
    12741271        (connection, cursor) = self.getcursor(connection) 
    1275         cursor.xexecute("select decode(owner, user, null, owner) as owner, constraint_name, table_name, r_owner, r_constraint_name from all_constraints where constraint_type='P' and owner=nvl(:owner, user) and constraint_name=:name", owner=self.owner, name=self.name) 
    1276         rec2 = cursor.xfetchone() 
     1272        cursor.execute("select decode(owner, user, null, owner) as owner, constraint_name, table_name, r_owner, r_constraint_name from all_constraints where constraint_type='P' and owner=nvl(:owner, user) and constraint_name=:name", owner=self.owner, name=self.name) 
     1273        rec2 = cursor.fetchone() 
    12771274        if rec2 is None: 
    12781275            raise SQLObjectNotFoundError(self) 
    1279         cursor.xexecute("select column_name from all_cons_columns where owner=nvl(:owner, user) and constraint_name=:name", owner=self.owner, name=self.name) 
     1276        cursor.execute("select column_name from all_cons_columns where owner=nvl(:owner, user) and constraint_name=:name", owner=self.owner, name=self.name) 
    12801277        tablename = getfullname(rec2.table_name, rec2.owner) 
    12811278        pkname = getfullname(self.name, None) 
    1282         code = "alter table %s add constraint %s primary key(%s)" % (tablename, pkname, ", ".join(r.column_name for r in cursor.xfetch())) 
     1279        code = "alter table %s add constraint %s primary key(%s)" % (tablename, pkname, ", ".join(r.column_name for r in cursor)) 
    12831280        if term: 
    12841281            code += ";\n" 
     
    12891286    def dropddl(self, connection=None, term=True): 
    12901287        (connection, cursor) = self.getcursor(connection) 
    1291         cursor.xexecute("select decode(owner, user, null, owner) as owner, table_name from all_constraints where owner=nvl(:owner, user) and constraint_name=:name", owner=self.owner, name=self.name) 
    1292         rec = cursor.xfetchone() 
     1288        cursor.execute("select decode(owner, user, null, owner) as owner, table_name from all_constraints where owner=nvl(:owner, user) and constraint_name=:name", owner=self.owner, name=self.name) 
     1289        rec = cursor.fetchone() 
    12931290        tablename = getfullname(rec.table_name, rec.owner) 
    12941291        pkname = getfullname(self.name, None) 
     
    13021299    def cdate(self, connection=None): 
    13031300        (connection, cursor) = self.getcursor(connection) 
    1304         cursor.xexecute("select last_change from all_constraints where constraint_type='P' and constraint_name=:name and owner=nvl(:owner, user)", name=self.name, owner=self.owner) 
     1301        cursor.execute("select last_change from all_constraints where constraint_type='P' and constraint_name=:name and owner=nvl(:owner, user)", name=self.name, owner=self.owner) 
    13051302        row = cursor.fetchone() 
    13061303        if row is None: 
     
    13101307    def udate(self, connection=None): 
    13111308        (connection, cursor) = self.getcursor(connection) 
    1312         cursor.xexecute("select last_change from all_constraints where constraint_type='P' and constraint_name=:name and owner=nvl(:owner, user)", name=self.name, owner=self.owner) 
     1309        cursor.execute("select last_change from all_constraints where constraint_type='P' and constraint_name=:name and owner=nvl(:owner, user)", name=self.name, owner=self.owner) 
    13131310        row = cursor.fetchone() 
    13141311        if row is None: 
     
    13181315    def iterreferencedby(self, connection=None): 
    13191316        (connection, cursor) = self.getcursor(connection) 
    1320         cursor.xexecute("select decode(owner, user, null, owner) as owner, constraint_name from all_constraints where constraint_type='R' and r_owner=nvl(:owner, user) and r_constraint_name=:name", owner=self.owner, name=self.name) 
    1321         for rec in cursor.xfetchall(): 
     1317        cursor.execute("select decode(owner, user, null, owner) as owner, constraint_name from all_constraints where constraint_type='R' and r_owner=nvl(:owner, user) and r_constraint_name=:name", owner=self.owner, name=self.name) 
     1318        for rec in cursor.fetchall(): 
    13221319            yield ForeignKey(rec.constraint_name, rec.owner, connection) 
    13231320 
    1324         cursor.xexecute("select decode(owner, user, null, owner) as owner, index_name from all_indexes where owner=nvl(:owner, user) and index_name=:name", owner=self.owner, name=self.name) 
    1325         rec = cursor.xfetchone() # Is there an index for this constraint? 
     1321        cursor.execute("select decode(owner, user, null, owner) as owner, index_name from all_indexes where owner=nvl(:owner, user) and index_name=:name", owner=self.owner, name=self.name) 
     1322        rec = cursor.fetchone() # Is there an index for this constraint? 
    13261323        if rec is not None: 
    13271324            yield Index(rec.index_name, rec.owner, connection) 
     
    13291326    def iterreferences(self, connection=None): 
    13301327        (connection, cursor) = self.getcursor(connection) 
    1331         cursor.xexecute("select decode(owner, user, null, owner) as owner, table_name from all_constraints where constraint_type='P' and owner=nvl(:owner, user) and constraint_name=:name", owner=self.owner, name=self.name) 
    1332         for rec in cursor.xfetchall(): 
     1328        cursor.execute("select decode(owner, user, null, owner) as owner, table_name from all_constraints where constraint_type='P' and owner=nvl(:owner, user) and constraint_name=:name", owner=self.owner, name=self.name) 
     1329        for rec in cursor.fetchall(): 
    13331330            yield Table(rec.table_name, rec.owner, connection) 
    13341331 
     
    13381335        """ 
    13391336        (connection, cursor) = self.getcursor(connection) 
    1340         cursor.xexecute("select table_name from all_constraints where constraint_type='P' and owner=nvl(:owner, user) and constraint_name=:name", owner=self.owner, name=self.name) 
    1341         rec = cursor.xfetchone() 
     1337        cursor.execute("select table_name from all_constraints where constraint_type='P' and owner=nvl(:owner, user) and constraint_name=:name", owner=self.owner, name=self.name) 
     1338        rec = cursor.fetchone() 
    13421339        return Table(rec.table_name, self.owner, connection) 
    13431340 
     
    13581355        (connection, cursor) = self.getcursor(connection) 
    13591356        tcname = self.name.split(".") 
    1360         cursor.xexecute("select comments from all_col_comments where owner=nvl(:owner, user) and table_name=:tname and column_name=:cname", owner=self.owner, tname=tcname[0], cname=tcname[1]) 
    1361         row = cursor.xfetchone() 
     1357        cursor.execute("select comments from all_col_comments where owner=nvl(:owner, user) and table_name=:tname and column_name=:cname", owner=self.owner, tname=tcname[0], cname=tcname[1]) 
     1358        row = cursor.fetchone() 
    13621359        if row is None: 
    13631360            raise SQLObjectNotFoundError(self) 
     
    14021399        (connection, cursor) = self.getcursor(connection) 
    14031400        # Add constraint_type to the query, so we don't pick up another constraint by accident 
    1404         cursor.xexecute("select decode(r_owner, user, null, r_owner) as r_owner, r_constraint_name, table_name from all_constraints where constraint_type='R' and owner=nvl(:owner, user) and constraint_name=:name", owner=self.owner, name=self.name) 
    1405         rec = cursor.xfetchone() 
     1401        cursor.execute("select decode(r_owner, user, null, r_owner) as r_owner, r_constraint_name, table_name from all_constraints where constraint_type='R' and owner=nvl(:owner, user) and constraint_name=:name", owner=self.owner, name=self.name) 
     1402        rec = cursor.fetchone() 
    14061403        if rec is None: 
    14071404            raise SQLObjectNotFoundError(self) 
    1408         cursor.xexecute("select column_name from all_cons_columns where owner=nvl(:owner, user) and constraint_name=:name order by position", owner=self.owner, name=self.name) 
    1409         fields1 = ", ".join(r.column_name for r in cursor.xfetch()) 
    1410         cursor.xexecute("select table_name, column_name from all_cons_columns where owner=nvl(:owner, user) and constraint_name=:name order by position", owner=rec.r_owner, name=rec.r_constraint_name) 
    1411         fields2 = ", ".join("%s(%s)" % (getfullname(r.table_name, rec.r_owner), r.column_name) for r in cursor.xfetch()) 
     1405        cursor.execute("select column_name from all_cons_columns where owner=nvl(:owner, user) and constraint_name=:name order by position", owner=self.owner, name=self.name) 
     1406        fields1 = ", ".join(r.column_name for r in cursor) 
     1407        cursor.execute("select table_name, column_name from all_cons_columns where owner=nvl(:owner, user) and constraint_name=:name order by position", owner=rec.r_owner, name=rec.r_constraint_name) 
     1408        fields2 = ", ".join("%s(%s)" % (getfullname(r.table_name, rec.r_owner), r.column_name) for r in cursor) 
    14121409        tablename = getfullname(rec.table_name, self.owner) 
    14131410        fkname = getfullname(self.name, None) 
     
    14211418    def _ddl(self, connection, cmd, term): 
    14221419        (connection, cursor) = self.getcursor(connection) 
    1423         cursor.xexecute("select table_name from all_constraints where owner=nvl(:owner, user) and constraint_name=:name", owner=self.owner, name=self.name) 
    1424         rec = cursor.xfetchone() 
     1420        cursor.execute("select table_name from all_constraints where owner=nvl(:owner, user) and constraint_name=:name", owner=self.owner, name=self.name) 
     1421        rec = cursor.fetchone() 
    14251422        if rec is None: 
    14261423            raise SQLObjectNotFoundError(self) 
     
    14451442    def cdate(self, connection=None): 
    14461443        (connection, cursor) = self.getcursor(connection) 
    1447         cursor.xexecute("select last_change from all_constraints where constraint_type='R' and constraint_name=:name and owner=nvl(:owner, user)", name=self.name, owner=self.owner) 
     1444        cursor.execute("select last_change from all_constraints where constraint_type='R' and constraint_name=:name and owner=nvl(:owner, user)", name=self.name, owner=self.owner) 
    14481445        row = cursor.fetchone() 
    14491446        if row is None: 
     
    14531450    def udate(self, connection=None): 
    14541451        (connection, cursor) = self.getcursor(connection) 
    1455         cursor.xexecute("select last_change from all_constraints where constraint_type='R' and constraint_name=:name and owner=nvl(:owner, user)", name=self.name, owner=self.owner) 
     1452        cursor.execute("select last_change from all_constraints where constraint_type='R' and constraint_name=:name and owner=nvl(:owner, user)", name=self.name, owner=self.owner) 
    14561453        row = cursor.fetchone() 
    14571454        if row is None: 
     
    14731470        """ 
    14741471        (connection, cursor) = self.getcursor(connection) 
    1475         cursor.xexecute("select table_name from all_constraints where constraint_type='R' and owner=nvl(:owner, user) and constraint_name=:name", owner=self.owner, name=self.name) 
    1476         rec = cursor.xfetchone() 
     1472        cursor.execute("select table_name from all_constraints where constraint_type='R' and owner=nvl(:owner, user) and constraint_name=:name", owner=self.owner, name=self.name) 
     1473        rec = cursor.fetchone() 
    14771474        return Table(rec.table_name, self.owner, connection) 
    14781475 
     
    14821479        """ 
    14831480        (connection, cursor) = self.getcursor(connection) 
    1484         cursor.xexecute("select decode(r_owner, user, null, r_owner) as r_owner, r_constraint_name from all_constraints where constraint_type='R' and owner=nvl(:owner, user) and constraint_name=:name", owner=self.owner, name=self.name) 
    1485         rec = cursor.xfetchone() 
     1481        cursor.execute("select decode(r_owner, user, null, r_owner) as r_owner, r_constraint_name from all_constraints where constraint_type='R' and owner=nvl(:owner, user) and constraint_name=:name", owner=self.owner, name=self.name) 
     1482        rec = cursor.fetchone() 
    14861483        return PrimaryKey(rec.r_constraint_name, rec.r_owner, connection) 
    14871484 
     
    14911488        """ 
    14921489        (connection, cursor) = self.getcursor(connection) 
    1493         cursor.xexecute("select status from all_constraints where constraint_type='R' and owner=nvl(:owner, user) and constraint_name=:name", owner=self.owner, name=self.name) 
     1490        cursor.execute("select status from all_constraints where constraint_type='R' and owner=nvl(:owner, user) and constraint_name=:name", owner=self.owner, name=self.name) 
    14941491        rec = cursor.fetchone() 
    14951492        return rec[0] == "ENABLED" 
     
    15131510        if self.isconstraint(connection): 
    15141511            return "" 
    1515         cursor.xexecute("select index_name, table_name, uniqueness from all_indexes where table_owner=nvl(:owner, user) and index_name=:name", owner=self.owner, name=self.name) 
    1516         rec = cursor.xfetchone() 
     1512        cursor.execute("select index_name, table_name, uniqueness from all_indexes where table_owner=nvl(:owner, user) and index_name=:name", owner=self.owner, name=self.name) 
     1513        rec = cursor.fetchone() 
    15171514        if rec is None: 
    15181515            raise SQLObjectNotFoundError(self) 
     
    15231520        else: 
    15241521            unique = "" 
    1525         cursor.xexecute("select aie.column_expression, aic.column_name from all_ind_columns aic, all_ind_expressions aie where aic.table_owner=aie.table_owner(+) and aic.index_name=aie.index_name(+) and aic.column_position=aie.column_position(+) and aic.table_owner=nvl(:owner, user) and aic.index_name=:name order by aic.column_position", owner=self.owner, name=self.name) 
    1526         code = "create%s index %s on %s (%s)" % (unique, indexname, tablename, ", ".join(r.column_expression or r.column_name for r in cursor.xfetch())) 
     1522        cursor.execute("select aie.column_expression, aic.column_name from all_ind_columns aic, all_ind_expressions aie where aic.table_owner=aie.table_owner(+) and aic.index_name=aie.index_name(+) and aic.column_position=aie.column_position(+) and aic.table_owner=nvl(:owner, user) and aic.index_name=:name order by aic.column_position", owner=self.owner, name=self.name) 
     1523        code = "create%s index %s on %s (%s)" % (unique, indexname, tablename, ", ".join(r.column_expression or r.column_name for r in cursor)) 
    15271524        if term: 
    15281525            code += ";\n" 
     
    15471544        """ 
    15481545        (connection, cursor) = self.getcursor(connection) 
    1549         cursor.xexecute("select constraint_type from all_constraints where owner=nvl(:owner, user) and constraint_name=:name and constraint_type in ('U', 'P')", owner=self.owner, name=self.name) 
    1550         rec = cursor.xfetchone() 
     1546        cursor.execute("select constraint_type from all_constraints where owner=nvl(:owner, user) and constraint_name=:name and constraint_type in ('U', 'P')", owner=self.owner, name=self.name) 
     1547        rec = cursor.fetchone() 
    15511548        if rec is not None: 
    15521549            rec = {"U": UniqueConstraint, "P": PrimaryKey}[rec.constraint_type](self.name, self.owner, connection) 
     
    15731570        """ 
    15741571        (connection, cursor) = self.getcursor(connection) 
    1575         cursor.xexecute("select table_name from all_indexes where table_owner=nvl(:owner, user) and index_name=:name", owner=self.owner, name=self.name) 
    1576         rec = cursor.xfetchone() 
     1572        cursor.execute("select table_name from all_indexes where table_owner=nvl(:owner, user) and index_name=:name", owner=self.owner, name=self.name) 
     1573        rec = cursor.fetchone() 
    15771574        return Table(rec.table_name, self.owner, connection) 
    15781575 
     
    15941591        (connection, cursor) = self.getcursor(connection) 
    15951592        # Add constraint_type to the query, so we don't pick up another constraint by accident 
    1596         cursor.xexecute("select table_name from all_constraints where constraint_type='U' and owner=nvl(:owner, user) and constraint_name=:name", owner=self.owner, name=self.name) 
    1597         rec = cursor.xfetchone() 
     1593        cursor.execute("select table_name from all_constraints where constraint_type='U' and owner=nvl(:owner, user) and constraint_name=:name", owner=self.owner, name=self.name) 
     1594        rec = cursor.fetchone() 
    15981595        if rec is None: 
    15991596            raise SQLObjectNotFoundError(self) 
    16001597        tablename = getfullname(rec.table_name, self.owner) 
    16011598        uniquename = getfullname(self.name, None) 
    1602         cursor.xexecute("select column_name from all_cons_columns where owner=nvl(:owner, user) and constraint_name=:name", owner=self.owner, name=self.name) 
    1603         code = "alter table %s add constraint %s unique(%s)" % (tablename, uniquename, ", ".join(r.column_name for r in cursor.xfetch())) 
     1599        cursor.execute("select column_name from all_cons_columns where owner=nvl(:owner, user) and constraint_name=:name", owner=self.owner, name=self.name) 
     1600        code = "alter table %s add constraint %s unique(%s)" % (tablename, uniquename, ", ".join(r.column_name for r in cursor)) 
    16041601        if term: 
    16051602            code += ";\n" 
     
    16101607    def dropddl(self, connection=None, term=True): 
    16111608        (connection, cursor) = self.getcursor(connection) 
    1612         cursor.xexecute("select table_name from all_constraints where constraint_type='U' and owner=nvl(:owner, user) and constraint_name=:name", owner=self.owner, name=self.name) 
    1613         rec = cursor.xfetchone() 
     1609        cursor.execute("select table_name from all_constraints where constraint_type='U' and owner=nvl(:owner, user) and constraint_name=:name", owner=self.owner, name=self.name) 
     1610        rec = cursor.fetchone() 
    16141611        if rec is None: 
    16151612            raise SQLObjectNotFoundError(self) 
     
    16251622    def cdate(self, connection=None): 
    16261623        (connection, cursor) = self.getcursor(connection) 
    1627         cursor.xexecute("select last_change from all_constraints where constraint_type='U' and constraint_name=:name and owner=nvl(:owner, user)", name=self.name, owner=self.owner) 
     1624        cursor.execute("select last_change from all_constraints where constraint_type='U' and constraint_name=:name and owner=nvl(:owner, user)", name=self.name, owner=self.owner) 
    16281625        row = cursor.fetchone() 
    16291626        if row is None: 
     
    16331630    def udate(self, connection=None): 
    16341631        (connection, cursor) = self.getcursor(connection) 
    1635         cursor.xexecute("select last_change from all_constraints where constraint_type='U' and constraint_name=:name and owner=nvl(:owner, user)", name=self.name, owner=self.owner) 
     1632        cursor.execute("select last_change from all_constraints where constraint_type='U' and constraint_name=:name and owner=nvl(:owner, user)", name=self.name, owner=self.owner) 
    16361633        row = cursor.fetchone() 
    16371634        if row is None: 
     
    16411638    def iterreferencedby(self, connection=None): 
    16421639        (connection, cursor) = self.getcursor(connection) 
    1643         cursor.xexecute("select decode(owner, user, null, owner) as owner, constraint_name from all_constraints where constraint_type='R' and r_owner=nvl(:owner, user) and r_constraint_name=:name", owner=self.owner, name=self.name) 
    1644         for rec in cursor.xfetchall(): 
     1640        cursor.execute("select decode(owner, user, null, owner) as owner, constraint_name from all_constraints where constraint_type='R' and r_owner=nvl(:owner, user) and r_constraint_name=:name", owner=self.owner, name=self.name) 
     1641        for rec in cursor.fetchall(): 
    16451642            yield ForeignKey(rec.constraint_name, rec.owner, connection) 
    16461643 
    1647         cursor.xexecute("select decode(owner, user, null, owner) as owner, index_name from all_indexes where owner=nvl(:owner, user) and index_name=:name", owner=self.owner, name=self.name) 
    1648         rec = cursor.xfetchone() # Ist there an index for this constraint? 
     1644        cursor.execute("select decode(owner, user, null, owner) as owner, index_name from all_indexes where owner=nvl(:owner, user) and index_name=:name", owner=self.owner, name=self.name) 
     1645        rec = cursor.fetchone() # Ist there an index for this constraint? 
    16491646        if rec is not None: 
    16501647            yield Index(rec.index_name, rec.owner, connection) 
     
    16521649    def iterreferences(self, connection=None): 
    16531650        (connection, cursor) = self.getcursor(connection) 
    1654         cursor.xexecute("select decode(owner, user, null, owner) as owner, table_name from all_constraints where constraint_type='U' and owner=nvl(:owner, user) and constraint_name=:name", owner=self.owner, name=self.name) 
    1655         for rec in cursor.xfetchall(): 
     1651        cursor.execute("select decode(owner, user, null, owner) as owner, table_name from all_constraints where constraint_type='U' and owner=nvl(:owner, user) and constraint_name=:name", owner=self.owner, name=self.name) 
     1652        for rec in cursor.fetchall(): 
    16561653            yield Table(rec.table_name, rec.owner, connection) 
    16571654 
     
    16611658        """ 
    16621659        (connection, cursor) = self.getcursor(connection) 
    1663         cursor.xexecute("select table_name from all_constraints where constraint_type='U' and owner=nvl(:owner, user) and constraint_name=:name", owner=self.owner, name=self.name) 
    1664         rec = cursor.xfetchone() 
     1660        cursor.execute("select table_name from all_constraints where constraint_type='U' and owner=nvl(:owner, user) and constraint_name=:name", owner=self.owner, name=self.name) 
     1661        rec = cursor.fetchone() 
    16651662        return Table(rec.table_name, self.owner, connection) 
    16661663 
     
    16801677    def createddl(self, connection=None, term=True): 
    16811678        (connection, cursor) = self.getcursor(connection) 
    1682         cursor.xexecute("select table_owner, table_name, db_link from all_synonyms where owner=nvl(:owner, user) and synonym_name=:name", owner=self.owner, name=self.name) 
    1683         rec = cursor.xfetchone() 
     1679        cursor.execute("select table_owner, table_name, db_link from all_synonyms where owner=nvl(:owner, user) and synonym_name=:name", owner=self.owner, name=self.name) 
     1680        rec = cursor.fetchone() 
    16841681        if rec is None: 
    16851682            raise SQLObjectNotFoundError(self) 
     
    17321729        """ 
    17331730        (connection, cursor) = self.getcursor(connection) 
    1734         cursor.xexecute("select table_owner, table_name, db_link from all_synonyms where owner=nvl(:owner, user) and synonym_name=:name", owner=self.owner, name=self.name) 
    1735         rec = cursor.xfetchone() 
     1731        cursor.execute("select table_owner, table_name, db_link from all_synonyms where owner=nvl(:owner, user) and synonym_name=:name", owner=self.owner, name=self.name) 
     1732        rec = cursor.fetchone() 
    17361733        if rec is None: 
    17371734            raise SQLObjectNotFoundError(self) 
     
    17471744    def createddl(self, connection=None, term=True): 
    17481745        (connection, cursor) = self.getcursor(connection) 
    1749         cursor.xexecute("select text from all_views where owner=nvl(:owner, user) and view_name=:name", owner=self.owner, name=self.name) 
    1750         rec = cursor.xfetchone() 
     1746        cursor.execute("select text from all_views where owner=nvl(:owner, user) and view_name=:name", owner=self.owner, name=self.name) 
     1747        rec = cursor.fetchone() 
    17511748        if rec is None: 
    17521749            raise SQLObjectNotFoundError(self) 
     
    17701767        (connection, cursor) = self.getcursor(connection) 
    17711768        query = "select * from %s" % self.getfullname() 
    1772         cursor.xexecute(query) 
    1773         return cursor.xfetch() 
     1769        cursor.execute(query) 
     1770        return iter(cursor) 
    17741771 
    17751772 
     
    17821779    def createddl(self, connection=None, term=True): 
    17831780        (connection, cursor) = self.getcursor(connection) 
    1784         cursor.xexecute("select * from all_mviews where owner=nvl(:owner, user) and mview_name=:name", owner=self.owner, name=self.name) 
    1785         rec = cursor.xfetchone() 
     1781        cursor.execute("select * from all_mviews where owner=nvl(:owner, user) and mview_name=:name", owner=self.owner, name=self.name) 
     1782        rec = cursor.fetchone() 
    17861783        if rec is None: 
    17871784            raise SQLObjectNotFoundError(self) 
     
    18211818    def createddl(self, connection=None, term=True): 
    18221819        (connection, cursor) = self.getcursor(connection) 
    1823         cursor.xexecute("select file_spec from all_libraries where owner=nvl(:owner, user) and library_name=:name", owner=self.owner, name=self.name) 
    1824         rec = cursor.xfetchone() 
     1820        cursor.execute("select file_spec from all_libraries where owner=nvl(:owner, user) and library_name=:name", owner=self.owner, name=self.name) 
     1821        rec = cursor.fetchone() 
    18251822        if rec is None: 
    18261823            raise SQLObjectNotFoundError(self) 
     
    18811878    def _calcargs(self, cursor): 
    18821879        if self._argsbypos is None: 
    1883             cursor.xexecute("select object_id from all_objects where owner=nvl(:owner, user) and object_name=:name and object_type=:type", owner=self.owner, name=self.name, type=self.type.upper()) 
     1880            cursor.execute("select object_id from all_objects where owner=nvl(:owner, user) and object_name=:name and object_type=:type", owner=self.owner, name=self.name, type=self.type.upper()) 
    18841881            if cursor.fetchone() is None: 
    18851882                raise SQLObjectNotFoundError(self) 
    18861883            self._argsbypos = [] 
    18871884            self._argsbyname = {} 
    1888             cursor.xexecute("select lower(argument_name) as name, lower(in_out) as in_out, lower(data_type) as datatype from all_arguments where owner=nvl(:owner, user) and object_name=:name and data_level=0 order by sequence", owner=self.owner, name=self.name) 
     1885            cursor.execute("select lower(argument_name) as name, lower(in_out) as in_out, lower(data_type) as datatype from all_arguments where owner=nvl(:owner, user) and object_name=:name and data_level=0 order by sequence", owner=self.owner, name=self.name) 
    18891886            i = 0 # argument position (skip return value) 
    1890             for record in cursor.xfetch(): 
     1887            for record in cursor: 
    18911888                arginfo = Argument(record.name, i, record.datatype, "in" in record.in_out, "out" in record.in_out) 
    18921889                if record.name is None: # this is the return value 
     
    20512048    def createddl(self, connection=None, term=True): 
    20522049        (connection, cursor) = self.getcursor(connection) 
    2053         cursor.xexecute("select text from all_source where type='JAVA SOURCE' and owner=nvl(:owner, user) and name=:name order by line", owner=self.owner, name=self.name) 
    2054         code = "\n".join((rec.text or "").rstrip() for rec in cursor.xfetch()) 
     2050        cursor.execute("select text from all_source where type='JAVA SOURCE' and owner=nvl(:owner, user) and name=:name order by line", owner=self.owner, name=self.name) 
     2051        code = "\n".join((rec.text or "").rstrip() for rec in cursor) 
    20552052        code = code.strip() 
    20562053 
     
    21332130 
    21342131        if schema == "all": 
    2135             cursor.xexecute("select decode(table_schema, user, null, table_schema) as owner, privilege, table_name as object, decode(grantor, user, null, grantor) as grantor, grantee from all_tab_privs order by table_schema, table_name, privilege") 
    2136         else: 
    2137             cursor.xexecute("select null as owner, privilege, table_name as object, decode(grantor, user, null, grantor) as grantor, grantee from user_tab_privs where owner=user order by table_name, privilege") 
    2138         return (Privilege(rec.privilege, rec.object, rec.grantor, rec.grantee, rec.owner, cursor.connection) for rec in cursor.xfetch()) 
     2132            cursor.execute("select decode(table_schema, user, null, table_schema) as owner, privilege, table_name as object, decode(grantor, user, null, grantor) as grantor, grantee from all_tab_privs order by table_schema, table_name, privilege") 
     2133        else: 
     2134            cursor.execute("select null as owner, privilege, table_name as object, decode(grantor, user, null, grantor) as grantor, grantee from user_tab_privs where owner=user order by table_name, privilege") 
     2135        return (Privilege(rec.privilege, rec.object, rec.grantor, rec.grantee, rec.owner, cursor.connection) for rec in cursor) 
    21392136 
    21402137    def grantddl(self, connection=None, term=True, mapgrantee=True): 
     
    21852182    def _getcolumnrecord(self, cursor): 
    21862183        name = self.name.split(".") 
    2187         cursor.xexecute("select * from all_tab_columns where owner=nvl(:owner, user) and table_name=:table_name and column_name=:column_name", owner=self.owner, table_name=name[0], column_name=name[1]) 
    2188         rec = cursor.xfetchone() 
     2184        cursor.execute("select * from all_tab_columns where owner=nvl(:owner, user) and table_name=:table_name and column_name=:column_name", owner=self.owner, table_name=name[0], column_name=name[1]) 
     2185        rec = cursor.fetchone() 
    21892186        if rec is None: 
    21902187            raise SQLObjectNotFoundError(self) 
     
    22822279        # The column creation date is the table creation date 
    22832280        (connection, cursor) = self.getcursor(connection) 
    2284         cursor.xexecute("select created from all_objects where lower(object_type)='table' and object_name=:name and owner=nvl(:owner, user)", name=self.name.split(".")[0], owner=self.owner) 
     2281        cursor.execute("select created from all_objects where lower(object_type)='table' and object_name=:name and owner=nvl(:owner, user)", name=self.name.split(".")[0], owner=self.owner) 
    22852282        row = cursor.fetchone() 
    22862283        if row is None: 
     
    22912288        # The column modification date is the table modification date 
    22922289        (connection, cursor) = self.getcursor(connection) 
    2293         cursor.xexecute("select last_ddl_time from all_objects where lower(object_type)='table' and object_name=:name and owner=nvl(:owner, user)", name=self.name.split(".")[0], owner=self.owner) 
     2290        cursor.execute("select last_ddl_time from all_objects where lower(object_type)='table' and object_name=:name and owner=nvl(:owner, user)", name=self.name.split(".")[0], owner=self.owner) 
    22942291        row = cursor.fetchone() 
    22952292        if row is None: 
     
    23362333        name = self.name.split(".") 
    23372334        (connection, cursor) = self.getcursor(connection) 
    2338         cursor.xexecute("select comments from all_col_comments where owner=nvl(:owner, user) and table_name=:table_name and column_name=:column_name", owner=self.owner, table_name=name[0], column_name=name[1]) 
    2339         rec = cursor.xfetchone() 
     2335        cursor.execute("select comments from all_col_comments where owner=nvl(:owner, user) and table_name=:table_name and column_name=:column_name", owner=self.owner, table_name=name[0], column_name=name[1]) 
     2336        rec = cursor.fetchone() 
    23402337        if rec is None: 
    23412338            raise SQLObjectNotFoundError(self)