does this example even require the "result" output parameter ? why cant you do a SELECT from cc_util.func ?

you can almost use the "func" keyword for this but it currently does not supported dotted names like that, also does it need a "named" argument like that ? so for that function as is, the most succinct is:

result = engine.text("select cc_util.func(i_name=>:name) from dual").scalar(name=name)

if you really wanted OUT params that would be a new feature, either an OutputBindParameter or a flag on BindParameter for that, then supporting engines would have to check for those and call the appropriate method off the DBAPI. this wouldnt be a huge change.

also, a cursor is most easily accessible via:

        cursor = engine.connection().cursor()

and if you want to use it in an execute:

        engine.execute(sql, params, cursor=cursor)

or an execute of a compiled:

engine.execute_compiled(mytable.select().compile(), params, cursor=cursor)

engine docstring at:
        
http://www.sqlalchemy.org/docs/ docstrings.myt#docstrings_sqlalchemy.engine_SQLEngine

On Mar 16, 2006, at 2:38 PM, Qvx 3000 wrote:

This is what I'm currently doing:

    sql = '''BEGIN :result := cc_util.func(i_name => :name); END;'''
    oramod = __engine__.engine.module
    oracur = __engine__.engine.connection().connection.cursor()
    result_var = oracur.var(oramod.NUMBER)
    oracur.execute(sql, dict(name = name, result = result_var))
    return result.getvalue()

Is there a better way? Maybe even a way to call a stored procedure automatically.

Tvrtko



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to