ANNOUNCE: Oracle::OCI 0.05

[email protected] (Tim Bunce) Fri, 31 Aug 2001 22:12:23 +0100
Newsgroups perl.dbi.oracle-oci
Message-ID <[email protected]>
  file: $CPAN/authors/id/T/TI/TIMB/Oracle-OCI-0.05.tar.gz
  size: 35355 bytes
   md5: 57645748f91850daff2b0455a6008cf2

Changes in 0.05    August 31st 2001

  Requires DBD::Oracle >= 1.10.
  Added OCIType* and OCITrans* to extra.typemap thanks to Michael Fox.
  Added rdbms/public to in oci_dirs boot thanks to Michael Fox.
  Taught C::Scan to ignore __restricted in header files.
  Excluded OCI_ORACLE and OCI_FLAGS #defines (as they have no value).
  More robust linking thanks to Stephen Clouse.
  Finally got OCIAttrGet to do-the-right-thing!
  See (basic) schema describe example in t/05dbi.t.

This is the first release that's quite usable :)

Enjoy!

If anyone's interested in LOBs I'd appreciate it if they could take a
look at the 'edit a lob' loop in t/05dbi.t (around line 106). It doesn't
seem to work, in as much as the lob remains unedited. I haven't looked
at it for this release but


FYI, this now works:

$table = "your_table_name_here";
OCIDescribeAny($dbh, $dbh, oci_buf_len($table), OCI_OTYPE_NAME, 1, OCI_PTYPE_TABLE, $dschp);

OCIAttrGet($dschp, OCI_HTYPE_DESCRIBE, my $parmp_int=0, 0, OCI_ATTR_PARAM, $dbh, 4);
my $parmp = bless \$parmp_int => 'OCIParamPtr';
 
OCIAttrGet($parmp, OCI_DTYPE_PARAM, my $numcols=0, 0, OCI_ATTR_NUM_COLS, $dbh, 2);
 
OCIAttrGet($parmp, OCI_DTYPE_PARAM, my $collst_int=0, 0, OCI_ATTR_LIST_COLUMNS, $dbh, 4);
my $collst = bless \$collst_int => 'OCIParamPtr';
 
foreach my $colnum (1..$numcols) {
    my $col_parmdp_int = 0;
    my $col_parmdp = bless \$col_parmdp_int => 'OCIParamPtr';
    OCIParamGet($collst, OCI_DTYPE_PARAM, $dbh, $col_parmdp, $colnum);

    OCIAttrGet($col_parmdp, OCI_DTYPE_PARAM, oci_buf_len(my $name, 30), OCI_ATTR_NAME, $dbh, 0);
    print "COL $colnum NAME = '$name'\n";

    OCIAttrGet($col_parmdp, OCI_DTYPE_PARAM, my $col_typecode, 2, OCI_ATTR_DATA_TYPE, $dbh, 2);
    print "COL $colnum TYPE = '$col_typecode'\n";
}

[The above is hacked out of t/05dbi.t so that's were you can copy it from.]

The extra param at the end of the OCIAttrGet call tells OCIAttrGet the
width and signedness of the integer (ie -2 means a signed 2 byte integer,
while 4 means an unsigned 4 byte integer), and passing 0 means the result
is a string.

For the next release I'll let you pass in a string and that'll mean that the
result is a pointer that should be blessed into that class. That'll remove
the need for 2 of the 3 explicit 'bless' lines you see above. I'd have done
it in this release but I only had the idea after uploading it :)

Tim.