Actually, if all you want to distinguish between is queries and
non-queries there is an easier way. Simply ask for cursor.description
-- the value returned is None in only two cases. 1) no statement
executed and 2) the statement executed is not a query. Seems to fit
the bill, don't you think?
On 1/11/06, Mihai Ibanescu <mi...@re...> wrote:
> On Wed, Jan 11, 2006 at 06:55:03PM -0500, Mihai Ibanescu wrote:
> > Hi,
> >
> > Is there a way one can prepare a query and determine its type?
> > (select/update/insert/delete).
> >
> > The reason: executemany() only applies to update/insert/delete. I have =
a
> > module that executes queries passed in by the user, and gets the bind p=
arams
> > from a .csv file. It would be nice to know when I can use execute vs.
> > executemany. It also helps to know if one has to fetch a result set (in=
case
> > of a select) or not do anything (for insert/update/delete).
> >
> > I know in OCI you can check the type by comparing to OCI_STMT_SELECT et=
al -
> > is the statement type somewhat exposed at the Python level?
>
> ... to reply to myself, exposing self->satementType as set by
> Cursor_GetStatementType to python, that's kind of what I'm looking for. I
> don't see it done, would others find it to be valuable?
>
> It would probably require a new read-only attribute of a Cursor object
> exposed, and a bunch of constants OCI_STMT_* defined.
>
> Misa
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log fi=
les
> for problems? Stop! Download the new AJAX search engine that makes
> searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
> http://ads.osdn.com/?ad_id=3D7637&alloc_id=3D16865&op=3Dclick
> _______________________________________________
> cx-oracle-users mailing list
> cx-...@li...
> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users
>
|