On 09/04/2014 04:49, INADA Naoki wrote:
> Prepared statement holds resource on server side.
> For example, following code is dangerous when combined with connection pool.
> 
> def myexecute(params):
>     cur = con.cursor()
>     cur.prepare(MY_STMT)  # allocate resource on server-side that is
> freed when connection is closed.
>     return cur.execute(params)
> 
> I think prepared statement should be bound to connection.
> 
> Connection.prapare(name, stmt, skip_on_dup=False)
> Prepare stmt as name.
> If skip_on_dup is true and same name is prepared before, do nothing.
> 
> Cursor.execute_prepared(name, params, stmt=None)
> Execute prepared statement named name.
> If stmt is not None, call Cursor.prepare(name, stmt, skip_on_dup=True)
> before execute.

This seems to complicate the code for no gain. The API previously
proposed is much better IMO.

federico

-- 
Federico Di Gregorio                         federico.digrego...@dndg.it
Di Nunzio & Di Gregorio srl                               http://dndg.it
 E tu usa il prefisso corretto Re: non R:, questa รจ una ML seria.
                                            -- cosmos, su debian-italian
_______________________________________________
DB-SIG maillist  -  DB-SIG@python.org
https://mail.python.org/mailman/listinfo/db-sig

Reply via email to