Re: enhancement: DBD::Oracle and OCI_ATTR_STMT_TYPE
John Scoles <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.dbi.sybase.devel |
|---|---|
| Organization | The Pythian Group |
| Message-ID | <[email protected]> |
Well would not be hard to do as we already have
char *
oci_stmt_type_name(int stmt_type)
{
dTHX;
SV *sv;
switch (stmt_type) {
case OCI_STMT_SELECT: return "SELECT";
case OCI_STMT_UPDATE: return "UPDATE";
case OCI_STMT_DELETE: return "DELETE";
case OCI_STMT_INSERT: return "INSERT";
case OCI_STMT_CREATE: return "CREATE";
case OCI_STMT_DROP: return "DROP";
case OCI_STMT_ALTER: return "ALTER";
case OCI_STMT_BEGIN: return "BEGIN";
case OCI_STMT_DECLARE: return "DECLARE";
}
sv = sv_2mortal(newSVpv("",0));
sv_grow(sv, 50);
sprintf(SvPVX(sv),"(STMT TYPE %d)", stmt_type);
return SvPVX(sv);
}
function internally in OCI8.c, I guess I could add it to the XS and get
it into Perl. just need a name for it though. dbd_stmt_type_name? or in
this case ora_stmt_type_name??
Norbert Debes wrote:
> Hi,
>
> I'm an enthusiastic user of Perl DBI and DBD::Oracle. Thanks to Tim
> Bunce and all the others who help maintain it!
>
> I wrote a sort of SQL*Plus replacement called DBB which runs arbitrary
> SQL statements and prints SELECT output with automatic column sizing
> (readable instantly without any COLUMN x FORMAT), because I'm always
> annoyed that SQL*Plus can't format it's output in a readable way. It
> would be cool to have OCI_ATTR_STMT_TYPE available from DBD::Oracle.
> Then I could provide feedback such as "ALTER Statement executed".
> Currently there seems to be now way to find out what type of statement
> was executed (i.e. ALTER, DELETE, INSERT).
>
> DBB is included with my book "Secret ORACLE" which also has an intro
> to DBI and DBD::Oracle: http://www.oradbpro.com/publications.html
>
> Here's a quote from OCI doc:
> Table 4–1 OCI_ATTR_STMT_TYPE Values and Statement Types
> Attribute Value Statement Type
> OCI_STMT_SELECT SELECT statement
> OCI_STMT_UPDATE UPDATE statement
> OCI_STMT_DELETE DELETE statement
> OCI_STMT_INSERT INSERT statement
> OCI_STMT_CREATE CREATE statement
> OCI_STMT_DROP DROP statement
> OCI_STMT_ALTER ALTER statement
> OCI_STMT_BEGIN BEGIN... (PL/SQL)
> OCI_STMT_DECLARE DECLARE... (PL/SQL)
> --
> Kind regards
>
> Norbert Debes
>
> ORADBPRO Consulting Services <http://www.oradbpro.com>
> http://www.oradbpro.com
> GSM: +49 177 6895186
> Fax: +49 1212 536735037
> SMTP: [email protected] <mailto:[email protected]>
>
>
>