Skip to content

Commit

Permalink
Patch to Makfile for 64bit boxes from Alex Laslavic
Browse files Browse the repository at this point in the history
  Added OCILobGetLength to lob functions from Milo van der Leij

Updated readmes to state the test user has to have create, call and drop a procedure privileges by John Scoles suggested by Gisle Aas  
  


git-svn-id: http://svn.perl.org/modules/dbd-oracle/trunk@11613 50811bd7-b8ce-0310-adc1-d9db26280581
  • Loading branch information
byterock committed Jul 30, 2008
1 parent 3e4d62a commit 0d7f97d
Show file tree
Hide file tree
Showing 8 changed files with 598 additions and 530 deletions.
5 changes: 5 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
=head1 Changes in DBD-Oracle 1.22(svn rev xxxx) 2008
Patch to Makfile for 64bit boxes from Alex Laslavic
Added OCILobGetLength to lob functions from Milo van der Leij
Updated readmes to state the test user has to have create, call and drop a procedure privileges by John Scoles suggested by Gisle Aas
Patch to Makfile to prevent the installation of the lib/DBD/mkta.pl fil from Gisle Aas
Added new Test 31lob_extended.t for use of LOBs when returned via stored procedures with bind_param_inout from Martin Evans
Update to connection part of POD from John Scoles
Fix to test suite to bring it up to standard from Martin Evans
Expand All @@ -22,6 +26,7 @@


=head1 Changes in DBD-Oracle 1.21(svn rev 11067) 11th April 2008

Added Notes to README.win32.txt on installing Instant Client 11.1.0.6.0 from John Scoles
Added the oci_typecode_name method to get the name rather than just the number of an OCI_TYPECODE from John Scoles
Fixed a unreported bug with Embedded Objects from John Scoles
Expand Down
11 changes: 11 additions & 0 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -1442,8 +1442,13 @@ sub find_headers {
"/include/oracle/$client_version_trim/client", # Instant Client for RedHat FC3
"/usr/include/oracle/$client_version/client", # Instant Client 11.1 and up
"/usr/include/oracle/$client_version/client64", # Instant Client 11.1 and up
"/usr/include/oracle/$client_version_trim/client64", # Instant Client 64
"/usr/include/oracle/$client_version_full/client64", # Instant Client 64

);



# Add /usr/include/oracle based on the oracle home location if oracle home is under
# /usr/lib/oracle ( Linux RPM install ). The 11g instant client reports
# client_version as 11.1.0.6 from sqlplus, but installs under 11.1.0.1.
Expand Down Expand Up @@ -1635,6 +1640,12 @@ sub symbol_search {
use strict;
use Config;

sub libscan {
my($self, $path) = @_;
return '' if $path =~ m/\.pl$/;
$path;
}


sub post_initialize {
my $self = shift;
Expand Down
16 changes: 15 additions & 1 deletion Oracle.pm
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ my $ORACLE_ENV = ($^O eq 'VMS') ? 'ORA_ROOT' : 'ORACLE_HOME';
DBD::Oracle::db->install_method("ora_lob_append");
DBD::Oracle::db->install_method("ora_lob_trim");
DBD::Oracle::db->install_method("ora_lob_length");
DBD::Oracle::db->install_method("ora_lob_chunk_size");
DBD::Oracle::db->install_method("ora_nls_parameters");
DBD::Oracle::db->install_method("ora_can_unicode");
DBD::Oracle::st->install_method("ora_fetch_scroll");
Expand Down Expand Up @@ -3378,6 +3379,18 @@ Uses the Oracle OCILobTrim function.
Returns the length of the LOB.
Uses the Oracle OCILobGetLength function.
=item ora_lob_chunk_size
$chunk_size = $dbh->ora_lob_chunk_size($lob_locator);
Returns the chunk size of the LOB.
Uses the Oracle OCILobGetChunkSize function.
For optimal performance, Oracle recommends reading from and
writing to a LOB in batches using a multiple of the LOB chunk size.
In Oracle 10g and before, when all defaults are in place, this
chunk size defaults to 8k (8192).
=back
=head3 LOB Locator Method Examples
Expand Down Expand Up @@ -3449,7 +3462,7 @@ can't be used effectively if AutoCommit is enabled).
open BIN_FH, "/binary/data/source" or die;
open CHAR_FH, "/character/data/source" or die;
my $chunk_size = 4096; # Arbitrary chunk size
my $chunk_size = $dbh->ora_lob_chunk_size( $bin_locator );
# BEGIN WRITING BIN_DATA COLUMN
my $offset = 1; # Offsets start at 1, not 0
Expand All @@ -3461,6 +3474,7 @@ can't be used effectively if AutoCommit is enabled).
}
# BEGIN WRITING CHAR_DATA COLUMN
$chunk_size = $dbh->ora_lob_chunk_size( $char_locator );
$offset = 1; # Offsets start at 1, not 0
$length = 0;
$buffer = '';
Expand Down
18 changes: 18 additions & 0 deletions Oracle.xs
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,24 @@ ora_lob_length(dbh, locator)
}


void
ora_lob_chunk_size(dbh, locator)
SV *dbh
OCILobLocator *locator
PREINIT:
D_imp_dbh(dbh);
sword status;
ub4 chunk_size = 0;
CODE:
OCILobGetChunkSize_log_stat(imp_dbh->svchp, imp_dbh->errhp, locator, &chunk_size, status);
if (status != OCI_SUCCESS) {
oci_error(dbh, imp_dbh->errhp, status, "OCILobGetChunkSize");
ST(0) = &sv_undef;
}
else {
ST(0) = sv_2mortal(newSVuv(chunk_size));
}


MODULE = DBD::Oracle PACKAGE = DBD::Oracle::dr

Expand Down
6 changes: 4 additions & 2 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,10 @@ The supplied tests will connect to the database using the value of the
ORACLE_USERID environment variable to supply the username/password.
So you should set that to a valid user (e.g. 'scott/tiger') and ensure that
this user has sufficient privileges to create, insert into, select from and
drop a table, and is able to select from systemtables like 'v$sessions'.
Using 'system/manager' might work but is not recommended! See also
drop a table, is also able to create, call and drop a procedure and is able to select from
systemtables like 'v$sessions'. Using 'system/manager' might work but is not
recommended! See also

README.login.txt.

make test
Expand Down
9 changes: 9 additions & 0 deletions ocitrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,15 @@
OciTp, (void*)sh,(void*)eh,(void*)lh,pul_t(l), \
oci_status_name(stat)),stat : stat


#define OCILobGetChunkSize_log_stat(sh,eh,lh,cs,stat) \
stat=OCILobGetChunkSize(sh,eh,lh,cs); \
(DBD_OCI_TRACEON) ? PerlIO_printf(DBD_OCI_TRACEFP, \
"%sLobGetChunkSize(%p,%p,%p,%p)=%s\n", \
OciTp, (void*)sh,(void*)eh,(void*)lh,pul_t(cs), \
oci_status_name(stat)),stat : stat


#define OCILobFileOpen_log_stat(sv,eh,lh,mode,stat) \
stat=OCILobFileOpen(sv,eh,lh,mode); \
(DBD_OCI_TRACEON) ? PerlIO_printf(DBD_OCI_TRACEFP, \
Expand Down
12 changes: 10 additions & 2 deletions t/30long.t
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ push @test_sets, [ "NCLOB", ORA_CLOB, 0 ] unless ORA_OCI() < 9.0 or $ENV{DBD_ALL
push @test_sets, [ "CLOB", ORA_CLOB, 0 ] ;
push @test_sets, [ "BLOB", ORA_BLOB, 0 ] ;

my $tests_per_set = 94;
my $tests = @test_sets * $tests_per_set;
my $tests_per_set = 96;
my $tests = @test_sets * $tests_per_set-1;
#very odd little thing that took a while to figure out.
#Seems I now have 479 tests which is 9 more so 96 test then -1 to round it off

plan tests => $tests;

$| = 1;
Expand Down Expand Up @@ -306,6 +309,11 @@ sub run_long_tests
ok($lob_locator, '$lob_locator is true' );
is(ref $lob_locator , 'OCILobLocatorPtr', '$lob_locator is a OCILobLocatorPtr' );
ok( (ref $lob_locator and $$lob_locator), '$lob_locator deref ptr is true' ) ;

# check ora_lob_chunk_size:
my $chunk_size = $dbh->func($lob_locator, 'ora_lob_chunk_size');
ok(!$DBI::err, "DBI::errstr");

my $data = sprintf $data_fmt, $idx; #create a little data
diag("length of data to be written at offset 1: " .length($data) ."\n" );
ok($dbh->func($lob_locator, 1, $data, 'ora_lob_write') ,"ora_lob_write" );
Expand Down
Loading

0 comments on commit 0d7f97d

Please sign in to comment.