Changeset 4418:7b3f6364cddf in livinglogic.python.xist

Show
Ignore:
Timestamp:
03/08/11 18:56:35 (9 years ago)
Author:
Walter Doerwald <walter@…>
Branch:
default
Message:

Add ll.orasql.Table.organization() (for index organized tables).

Files:
2 modified

Legend:

Unmodified
Added
Removed
  • NEWS.rst

    r4417 r4418  
    3636*   Oracle URLs now should support schema objects with fancy names (i.e. ones 
    3737    that contain accented characters). 
     38 
     39*   :class:`ll.orasql.Table` has a new method :meth:`organization` that returns 
     40    ``"heap"`` or normal tables and ``"index"`` for index organized tables. 
    3841 
    3942 
  • src/ll/orasql/__init__.py

    r4416 r4418  
    13061306        """ 
    13071307        return self.mview(connection) is not None 
     1308 
     1309    def organization(self, connection=None): 
     1310        """ 
     1311        Return the organization of this table: either ``"heap"`` (for "normal" 
     1312        tables) or ``"index"`` (for index organized tables). 
     1313        """ 
     1314        (connection, cursor) = self.getcursor(connection) 
     1315        cursor.execute("select iot_type from all_tables where owner=nvl(:owner, user) and table_name=:name", owner=self.owner, name=self.name) 
     1316        rec = cursor.fetchone() 
     1317        if rec is None: 
     1318            raise SQLObjectNotFoundError(self) 
     1319        return "heap" if rec.iot_type is None else "index" 
    13081320 
    13091321    @classmethod