Changeset 165:cdd99a0a2dbb in livinglogic.python.orasql

Show
Ignore:
Timestamp:
08/22/06 18:01:49 (13 years ago)
Author:
Walter Doerwald <walter@…>
Branch:
default
Message:

Raise an exception if a procedure doesn't exist.

Files:
3 modified

Legend:

Unmodified
Added
Removed
  • NEWS.xml

    r164 r165  
    33<item>The class <class>Column</class> has gained a few new methods: 
    44<method>datatype</method>, <method>default</method>, <method>nullable</method> 
    5 and <method>comment</method>. 
     5and <method>comment</method>.</item> 
     6 
     7<item>Calling a procedure will now raise a <class>SQLObjectNotFoundError</class> 
     8error, if the procedure doesn't exist.</item> 
    69</ulist> 
    710</section> 
  • src/ll/orasql/__init__.py

    r164 r165  
    17831783    def _calcargs(self, cursor): 
    17841784        if self._argsbypos is None: 
     1785            cursor.execute("select object_id from all_objects where owner=nvl(:owner, user) and object_name=:name and object_type='PROCEDURE'", owner=self.owner, name=self.name) 
     1786            if cursor.fetchone() is None: 
     1787                raise SQLObjectNotFoundError(self) 
    17851788            self._argsbypos = [] 
    17861789            self._argsbyname = {} 
    1787             cursor.execute("select lower(argument_name) as name, lower(in_out) as in_out, lower(data_type) as datatype from user_arguments where lower(object_name)=lower(:name) and data_level=0 order by sequence", name=self.name) 
     1790            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", name=self.name) 
    17881791            for (i, record) in enumerate(cursor): 
    17891792                arginfo = Argument(record.name, i, record.datatype, "in" in record.in_out, "out" in record.in_out) 
  • test/test_orasql.py

    r164 r165  
    166166 
    167167 
     168def test_procedure_nonexistant(): 
     169    db = orasql.connect(dbname) 
     170    py.raises(orasql.SQLObjectNotFoundError, orasql.Procedure("DOESNOTEXIST"), db.cursor()) 
     171 
     172 
    168173def test_createorder(): 
    169174    # check that the default output order of iterobjects() (i.e. create order) works