7.5 The Future of Oracle::OCIWe're sure that within a few years Oracle::OCI will be an advanced, mature set of packages used by every Perl Oracle user around. Author Tim Bunce actually predicts that Oracle::OCI will eventually hold the complex code, but that simpler modules will be layered on top to provide specific functionality. For example, future modules may include the following:
7.5.1 Oracle::PLSQLAnother extremely interesting development in the world of OCI will be Oracle::PLSQL. At the time we were writing this book, this module was planned but did not yet exist. We expect this module to provide fantastic connectivity between PL/SQL and Perl. In this way, it will tie in neatly with the extproc_plsql module we describe in Chapter 8. Using the upcoming Oracle::PLSQL, PL/SQL functions could be mapped directly to Perl functions, and vice versa, in a way similar to what's happened with SQLJ and Java. We expect that eventually there could be room enough for this symbiosis of Perl and PL/SQL to manage all of the following Oracle features:
For instance, Tim Bunce predicts snippets of code, such as the following example, which works with binary files to load their information into the $buffer variable: use DBI; $dbh = DBI->connect('dbi:Oracle:', $user, $pass, { ora_autolob => 0 }); $bfile = $dbh->selectcol_array( "select bfile from mylobs where id=? for update", undef, 1); use Oracle::PLSQL; $dbms_lob = new Oracle::PLSQL DBMS_LOB => \$dbh; $dbms_lob->fileexists($bfile) or die "File missing"; $length = $dbms_lob->filelength($bfile); $dbms_lob->filegetname($bfile, $diename, $filename); $dbms_lob->fileopen($bfile, $dbms_lob->{file_readonly}); $dbms_lob->read($bfile, 40, 1, $buffer); $dbms_lob->fileclose($bfile); Stay tuned to the Oracle::OCI dial for further information. 7.5.2 Contributing to the Oracle::OCI ProjectMost Oracle DBAs probably already have their hands full and won't be interested in adding to their workload. But if you do want to help with the Oracle::OCI project, we recommend that you get hold of the latest download and start trying to make it work for your own needs. It can take a while to get the hang of it, but for practice you might want to try to replicate the OCI demonstration programs provided by Oracle Corporation, listed in the next section. For further information on the project, visit Tim Bunce's CPAN site where you'll find numerous presentation downloads on DBI, DBD::Oracle, and Oracle::OCI: 7.5.3 Demo ProgramsIf you want to cut your teeth on some hard-core OCI programming, check out the code examples provided by Oracle Corporation detailing in-depth usage of OCI calls, available automatically within your current Oracle installation.[6] These C files, and supporting SQL files, generally appear in the../rdbms/demo or ../oci/samples directories. A variety of helpful information is included within the header parts of these files; for example, you'll find out what accompanying SQL files need to be preinstalled, and so on. We've listed the OCI 8.1 demonstration programs in Table 7-5.
|