Posted by John Scoles on Feb 10, 2010
The “Beer” version of DBD::Oracle (1.24) has been released. You can find it at CPAN DBD::Oracle.
DBD::Oracle is a Perl module that works with the DBI module to provide access to Oracle databases. It is maintained by me, John Scoles, under the auspices of Pythian as Open Source/Free Software.
This is largely a maintenance release that fixes a number of bugs. New stuff includes some more improvements to embedded types from Charles Jardine.
Timestamps in Embedded Object now use precision to 6 places.
The big enhancement this round is extending the code to allow more than one row to be returned with a single fetch. Those of you who use Rowcache size will now find that your queries will run much faster.
I have also added the ora_ncs_buff_mtpl parameter, so you can now have very fine grain control over the size of the data buffer using for NCHAR conversions of lobs.
One more little note — thanks to my mistake in compressing a file last week, the version number on CPAN is 1.24a, while the internal Version is still 1.24.
Here is the complete change list: Read the rest of this entry . . .
Posted by John Scoles on Dec 31, 2009
My old arch-nemesis, the in-line if ($q = $q == $a ? $b : $c;) reared its ugly little head again.
This time, it was in context of an web page that displayed some form values, something like this:
CGI::textfield({name => 'price_dollars',
width => '5',
value => ($mode eq 'Edit' ? $line_item[$count]->price_dollars() : '0') });
CGI::textfield({name => 'price_cents',
value => ($mode eq 'Edit' ? $line_item[$count]->price_cents(): '00' });
This carried on for 15 other fields on the form. So, we have 17 if else statements all checking to see if the form is in ‘Edit’ mode. If there were, say, ten line items on the form . . . well no need to go any further, other than to say that is a whole lot of if statements.
While this does not take up much space, this multiplicity of ifs is not really necessary or even good, since to the compiler, an inline if and a bracketed one are the same. The inline is only a shorthand to make our code more readable.
We could of course just declare 17 scalars at each iteration, and then a use single if statment to set these scalars, like this . . .
Read the rest of this entry . . .
Posted by John Scoles on Dec 7, 2009
One thing I find fascinating in Perl is that I am always seeing new ways to perform the same mundane task.
Today I had to output some tabular data, so I thought it would be nice if I alternated colours for each row. Easy enough in Perl—just create a hash with your colours as the value and then the swapping variable as the key, like this:
my %colours=(1=>'red', 0=>'green');
my $swap=1;
foreach $item (@stuff) {
my $colour=$colours{$swap};
...
Then I though about how to flip the $swap value. I could simply use the tried and true—and like me—Luddite style: Read the rest of this entry . . .
Posted by John Scoles on Dec 3, 2009
I finally had the opportunity the other day to try and install DBD::Oracle on an IBM AIX 5.1 box, and for once I have some good news to tell.
Anyone who has ever tried this will know of some of the troubles I speak of. When dealing with DBI and any DBD on a AIX box, you either must either be lucky enough to have the same compiler installed that built the version of Perl that comes with the box (I have never seen this happen); or you have to spend a great deal of time downloading and installing your own GCC and the building your own version of Perl.
Fortunately, all the hard work was done for me by other members of my team, and I was only a Johnny-come-lately to the whole process.
In our case, these are the steps that we followed:
- get a working version of GCC on the box
- rebuild and install your own version of Perl
- build and install DBI using your local version of Perl
All of the above worked without a major problem. It was only when we tried to build DBD::Oracle that we ran into a problem:
Read the rest of this entry . . .
Posted by John Scoles on Nov 30, 2009
This is a little story of a little bug. This gremlin suddenly appeared in a CGI.PM web-based application I work with. To make a long story short, an email was coming out something like this . . .
389939
Subject:Update to Report #389939 by B. bloggins Description:389939 #389939: TPDD Now Deploying to monitoring for the MySQL servers.
. . . when it should have been some thing like this:
Subject: TPDD Update to Report #389939 by B. bloggins
TPDD Now Deploying to monitoring for the MySQL servers.
After about an hour tracking things back, my team and I narrowed it down to this line of code:
Read the rest of this entry . . .
Posted by John Scoles on Nov 24, 2009
No, I do not have squiggly worms in my head, and no, I haven’t gone over to the dark-side. It’s just that I had an opportunity over the past few days to attempt to use Microsoft’s Server Management Objects (SMO) with Perl to manage a SQL Server 2005 DB.
To make a long story into a short post, I blundered into the Win32::CLR module on CPAN, a little gem from Toshiyuki Yamato.
Here is all you need to get started. Read the rest of this entry . . .
Posted by John Scoles on May 5, 2009
Thanks to a patch from Tomas Pokorny, you can now select Oracle user-defined types directly into a Perl object.
User-defined types include Object, Varray, and Table. These have been around in Oracle since 8i but have never really gained any sort of popularity for any number or reasons. The most common reason I have heard from DBAs and modelers is that they break relational integrity. As the objects in Oracle are “Embedded,” I do not see how that is possible. The more practical reason is that the SQL to retrieve and query this sort of object tends to be rather involved, and is sometimes slower than a simple table join; also, this sort of object can be hidden or unavailable to many kinds of modeling software.
With the new functionality of DBD::Oracle, selects of these objects are simple to work with in Perl. Lets take the example below for a web site that has a number of different “user” types. Read the rest of this entry . . .
Posted by John Scoles on Apr 30, 2009
The “Sesame Street” Version of DBD::Oracle (1.23) has been released.
You can find it at CPAN DBD::Oracle.
DBD::Oracle is the Perl module that works with the DBI module to provide access to Oracle databases. It is maintained by me, John Scoles, under the auspices of The Pythian Group as open source/free software.
This release is largely a maintenance release that fixes a number of bugs.
New stuff includes the ability to fetch Oracle embedded types directly into an oracle object; a big thank you goes out to Tomas Pokorny for that patch.
Also, UTF8 support has been expanded and cleaned up for BLOBs and execute_array and thanks go out to Milo van der Leij, David Mansfield for most of the work on this.
Also a big thanks Alex Buttery, Jim McCullars, Charles Jardine, Eric Simon, and Chris Underhill, who helped out with some clean up of the code, READMEs, and the POD.
I have also now added two private statement functions ora_stmt_type_name and ora_stmt_type which will get the OCI type name and type for the currently prepared statement.
The complete change list
Read the rest of this entry . . .
Posted by John Scoles on Aug 8, 2008
The latest release of DBD::Oracle is now ready and can be found at: CPAN DBD::Oracle. It is a Perl module that works with the DBI module to provide access to Oracle databases. It is maintained by me, John Scoles, under the auspices of The Pythian Group as open source/free software.
This release is largely a maintenance release that fixes a number of bugs (new and old) and cleans up the POD. I have also spent a good deal of time cleaning up the tests, compile warnings, and the Makefile.PL. A thank-you goes out to Martin Evans and H. Merijn Brand for their help on that.
As for new items, the ORA_VERBOSE attribute was added so that you can debug/trace DBD::Oracle without seeing any DBI debug/trace output. OCILobGetLength was added to the LOB functions, thanks to Milo van der Leij, I have also dropped support for Oracle 8 and earlier clients; see the POD for details on this.
Finally, I have also cleaned up and expanded how persistent LOBs work. A thank-you to Eric Simon for his work on this.
The release has been fully tested with version (1.601) of DBI. Below is the list of the changes and/or fixes in this release.
Read the rest of this entry . . .
Posted by John Scoles on Jul 24, 2008
1, 2, 3, 4, 5, 6, 9, or 10. It ain’t no Feist song, but she got it right. Notice that she mentions no 7 or 8 in it. Well, that is also true for version support in release 1.21 of DBD::Oracle.
With some of the new functionality that was introduced in DBD::Oracle 1.21, you can no longer use the Oracle 7 and most early 8 clients to build DBD::Oracle.
I hope this little table will help you choose which version of DBD::Oracle is right for you.
|
Oracle Version |
| DBD::Oracle Version |
<8 |
8.0.3 – 8.0.6 |
8iR1 – R2 |
8iR3 |
9i – 11g |
| 0.1 – 16 |
Y |
Y |
Y |
Y |
Y |
| 1.17 |
Y |
Y |
Y |
Y |
Y |
| 1.18 |
N |
N |
N |
Y |
Y |
| 1.19 |
N |
N |
N |
Y |
Y |
| 1.20 |
N |
N |
N |
Y |
Y |
| 1.21 |
N |
N |
N |
Y |
Y |
| 1.22 |
N |
N |
N |
N |
Y |
As there are dozens and dozens of different versions of Oracle’s clients, I did not bother to list any of them, just the major release versions of Oracle that are out there.
Note that one can still connect to any Oracle version with the older DBD::Oracle versions. The only problem you will have is that some of the newer OCI and Oracle features available in later DBD::Oracle releases will not be available to you.
So to make a short story a little longer:
Read the rest of this entry . . .