From 4878964cdb6aa1223810121b1d87b25c025bf0ed Mon Sep 17 00:00:00 2001 From: timbo Date: Wed, 28 Dec 2005 22:21:26 +0000 Subject: [PATCH] svn merge https://svn.perl.org/modules/dbd-oracle/trunk https://svn.perl.org/modules/dbd-oracle/branches/pythian git-svn-id: http://svn.perl.org/modules/dbd-oracle/trunk@2333 50811bd7-b8ce-0310-adc1-d9db26280581 --- Changes | 6 +- MANIFEST | 30 ++-- Makefile.PL | 144 ++++++++++++++--- Oracle.pm | 1 + README.aix => README.aix.txt | 0 README.clients => README.clients.txt | 0 README.explain => README.explain.txt | 0 README.help => README.help.txt | 0 README.hpux => README.hpux.txt | 0 README.java => README.java.txt | 0 README.linux => README.linux.txt | 15 ++ README.login => README.login.txt | 0 README.longs => README.longs.txt | 0 README.macosx => README.macosx.txt | 0 README.sec => README.sec.txt | 0 README.utf8 => README.utf8.txt | 0 README.vms => README.vms.txt | 0 README.win32 | 58 ------- README.win32.txt | 222 +++++++++++++++++++++++++++ README.wingcc => README.wingcc.txt | 0 dbdimp.c | 17 +- oci8.c | 8 +- t/10general.t | 11 +- t/20select.t | 11 +- 24 files changed, 412 insertions(+), 111 deletions(-) rename README.aix => README.aix.txt (100%) rename README.clients => README.clients.txt (100%) rename README.explain => README.explain.txt (100%) rename README.help => README.help.txt (100%) rename README.hpux => README.hpux.txt (100%) rename README.java => README.java.txt (100%) rename README.linux => README.linux.txt (72%) rename README.login => README.login.txt (100%) rename README.longs => README.longs.txt (100%) rename README.macosx => README.macosx.txt (100%) rename README.sec => README.sec.txt (100%) rename README.utf8 => README.utf8.txt (100%) rename README.vms => README.vms.txt (100%) delete mode 100644 README.win32 create mode 100644 README.win32.txt rename README.wingcc => README.wingcc.txt (100%) diff --git a/Changes b/Changes index b5e49b38..4bd98093 100644 --- a/Changes +++ b/Changes @@ -3,12 +3,13 @@ Fixed csform setting for Oracle 8.0. Fixed csform setting for some UTF8 cases. Fixed INTERVAL DAY TO SECOND thanks to Honza Pazdziora. - Fixed $sth->{PRECISION} for utf-8, with thanks Eric Lenio. + Fixed undef warnings when connecting with undef $user. Added support for nested cursors in select lists thanks to Charles Jardine. Added "Trailing Spaces" section to docs thanks to Michael A Chase. - Changed "Binding Cursors" docs, clarifying examples thanks to Charles Jardine. + Added support for binary floats/doubles thanks to Dennis Box. + Changed "Binding Cursors" docs, clarifying examples thanks to Charles Jardine. Changed Makefile.PL to avoid risk of sqlplus hanging thanks to Mark Dedlow. Changed Makefile.PL to prefer ~/rdbms/public over other ~/rdbms/* for .h files. Changed Makefile.PL to improve build rule detection. @@ -17,6 +18,7 @@ Updated README.vms re logical name tables thanks to Jakob Snoer. Updated README.aix thanks to Stephen de Vries. Updated README.macosx thanks to Stephen de Vries. + Renamed README.*'s to add .txt suffix to make life easier for some. The Copyright terms for DBD::Oracle have been simplified and now read: The DBD::Oracle module is free software; you can redistribute it diff --git a/MANIFEST b/MANIFEST index 287e2970..c49e9e68 100644 --- a/MANIFEST +++ b/MANIFEST @@ -18,21 +18,21 @@ Oracle.pm Oracle.xs Oraperl.pm README -README.aix -README.clients -README.explain -README.help -README.hpux -README.java -README.linux -README.login -README.longs -README.macosx -README.sec -README.utf8 -README.vms -README.win32 -README.wingcc Notes about building with mingw32 and cygwin32 +README.aix.txt +README.clients.txt +README.explain.txt +README.help.txt +README.hpux.txt +README.java.txt +README.linux.txt +README.login.txt +README.longs.txt +README.macosx.txt +README.sec.txt +README.utf8.txt +README.vms.txt +README.win32.txt +README.wingcc.txt Notes about building with mingw32 and cygwin32 Todo dbdimp.c dbdimp.h diff --git a/Makefile.PL b/Makefile.PL index 56dc5874..66912064 100755 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,6 +1,24 @@ ## ## You should not need to edit this file. -## +## Ok I edited it! So what are you going to do about it? +## John Scoles The Pythian Group +## September 20 2005 +## scoles@pythian.com +## changes made +## Removed option flag '-ic10'. +## Added a new elsif block that searches for libclntsh.so.10.1 file on the path $HO +## In this block it sets a link to libclntsh.so.10.1 as libclntsh.so +## then hard codes the lib to clntsh and then carries on. +## I attempted to hardcode libclntsh.so.10.1 for clntsh but this does not +## not work. It seems that others are getting this same form of error as well +## i.e. The compiler does not recognize .10.1 as a lib +## +## John Scoles (TPG) +## October 07 2005 +## Changes made +## Adding in a few changes suggested by Andy Hassall +## that will enable the compile to work for Windows version of the IC + # vim: ts=8:sw=4 BEGIN { $^W = 1 } @@ -41,6 +59,7 @@ my $os = $^O; my $osvers = $Config{osvers}; $osvers =~ s/^\s*(\d+\.\d+).*/$1/; # drop sub-sub-version: 2.5.1 -> 2.5 my $exe_ext = ($os eq 'VMS') ? '.pl' : ''; my $BELL = "\a"; +# put this here as it might change $| = 1; my %opts = ( @@ -74,9 +93,10 @@ my %mk_target_rules; # Options (rarely needed) # to turn off an option prefix with 'no', ie 'perl Makefile.PL -nob' +#$::opt_ic10 = 1; # Build for Oracle 10g instantclient $::opt_b = 1; # try to use Oracle's own 'build' rule $::opt_r = ''; # With -b above, use this names build rule (eg -r=build64) -$::opt_m = 0; # path to proc.mk or oracle.mk file to read +$::opt_m = ''; # path to proc.mk or oracle.mk file to read $::opt_p = ''; # alter preference for oracle.mk over proc $::opt_n = ''; # Oracle .mk macro name to use for library list to link with $::opt_c = 0; # don't encourage use of shared library @@ -120,7 +140,6 @@ print "\n Configuring DBD::Oracle ...\n # --- Where is Oracle installed... my $ORACLE_ENV = ($os eq 'VMS') ? 'ORA_ROOT' : 'ORACLE_HOME'; - my $OH = $ENV{$ORACLE_ENV} || ''; $OH = win32_oracle_home($OH) if ($os eq 'MSWin32') or ($os =~ /cygwin/i); $OH = unixify $OH if $os eq 'VMS'; @@ -133,12 +152,27 @@ die qq{ The $ORACLE_ENV environment variable must be set. ABORTED! } unless $OH; +print "os=$os\n"; + die qq{ The $ORACLE_ENV environment variable value ($OH) is not valid. It must be set to hold the path to an Oracle installation directory on this machine (or a machine with a compatible architecture) See the README.clients file for more information. ABORTED! -} unless (($os eq 'VMS') ? -d $OH : -d "$OH/lib/."); +} unless (($os eq 'VMS') ? -d $OH : (-e "$OH/libclntsh.so.10.1" || -e "$OH/oci.dll") ? 1 : -d "$OH/lib/."); + + +#the (-e "$OH/libclntsh.so.10.1" ) supports the 10g Instant Client on UNIX and Linux +#The -e "$OH/oci.dll" supports the 10g Instant Client on Windows. + +die qq{ The $ORACLE_ENV environment variable value ($OH) is not valid. + It must be set to hold the path to an Oracle installation directory + on this machine (or a machine with a compatible architecture) + See the README.clients file for more information. + ABORTED! + +} unless ( -d $OH ); + print "Using Oracle in $OH\n"; @@ -169,6 +203,9 @@ symbol_search() if $::opt_s or $::opt_S; # --- How shall we link with Oracle? Let me count the ways... +# default to using XE .mk file if one exists +$::opt_m ||= "$OH/rdbms/demo/demo_xe.mk" if -s "$OH/rdbms/demo/demo_xe.mk"; + my @mkfiles; my $linkwith = ""; my $linkwith_msg = ""; @@ -200,12 +237,16 @@ if ($os eq 'VMS') { } elsif (($os eq 'MSWin32') or ($os =~ /cygwin/i)) { + my $OCIDIR = ""; find( sub { print "Found $_ directory\n" if /^OCI\d*$/i; $OCIDIR = $_ if /^OCI\d*$/i && $OCIDIR lt $_; $File::Find::prune = 1 if -d $_ && $_ !~ /^\./; }, $OH ); + + $OCIDIR = 'sdk' if !$OCIDIR && -d "$OH/sdk"; # Instant Client SDK + die "OCI directory not found, please install OCI in $OH" if ! $OCIDIR; print "Using OCI directory '$OCIDIR'\n"; @@ -266,7 +307,7 @@ elsif (($os eq 'MSWin32') or ($os =~ /cygwin/i)) { # --- UNIX Variants --- elsif ($::opt_l and # use -l to enable this direct-link approach - @_=grep { m:/lib(cl(ie)?ntsh|oracle).\w+$:o } <$OH/lib/lib*> + @_=grep { m:/lib(cl(ie)?ntsh|oracle).\w+$:o } <$OH/lib/lib*> ) { # --- the simple modern way --- foreach(@_) { s:\Q$OH/lib/::g } @@ -278,19 +319,73 @@ elsif ($::opt_l and # use -l to enable this direct-link approach $opts{dynamic_lib} = { OTHERLDFLAGS => "$::opt_g" }; my @h_dirs = find_headers(); if ($client_version_full =~ /^8.0.6/ && $os eq 'hpux') { - $linkwith_msg = "-lextp -l$lib."; - $opts{LIBS} = [ "-L$OH/$libdir -lextp -l$lib $syslibs" ]; - push @h_dirs, 'network/public'; + $linkwith_msg = "-lextp -l$lib."; + $opts{LIBS} = [ "-L$OH/$libdir -lextp -l$lib $syslibs" ]; + push @h_dirs, 'network/public'; } else { - $linkwith_msg = "-l$lib."; - $opts{LIBS} = [ "-L$OH/$libdir -l$lib $syslibs" ]; + $linkwith_msg = "-l$lib."; + $opts{LIBS} = [ "-L$OH/$libdir -l$lib $syslibs" ]; } my $inc = join " ", map { "-I$OH/$_" } @h_dirs; $opts{INC} = "$inc -I$dbi_arch_dir"; } -else { # --- trawl the guts of Oracle's make files looking the how it wants to link +elsif ($::opt_m =~ /\bdemo_xe.mk$/) { # Oracle XE + + my $mk = $::opt_m; + print "Looks like Oracle XE ($mk)\n"; + + fetch_oci_macros($mk); + $MK{CCINCLUDES} = '-I$(ICINCHOME)'; # undo odd refinition in demo_xe.mk + + # From linux Oracle XE (10.2.0): + # ICINCHOME=$(ORACLE_HOME)/rdbms/public/ + # ICLIBHOME=$(ORACLE_HOME)/lib/ + # ICLIBPATH=-L$(ICLIBHOME) + # THREADLIBS=-lpthread [initially -lthread then redefined] + # CCLIB=$(ICLIBPATH) -lclntsh $(THREADLIBS) + # CCINCLUDES = -I$(ICINCHOME) [see above] + # CCFLAGS=$(CCINCLUDES) -DLINUX -D_GNU_SOURCE -D_REENTRANT -g [initially without -DLINUX -D_GNU_SOURCE] + my $cclib = expand_mkvars($MK{CCLIB}, 0, 1); + my $ccflags = expand_mkvars($MK{CCFLAGS}, 0, 1); + + $linkwith_msg = "$cclib"; + $opts{LIBS} = [ $cclib ]; + $opts{INC} = "-I$dbi_arch_dir $ccflags"; + $opts{dynamic_lib} = { OTHERLDFLAGS => "$::opt_g" }; +} + +# --- special case for Oracle 10g instant client + +elsif (-e "$OH/libclntsh.so.10.1") { # note lack of ../lib/... + + #support for 10 instantclient + # John Scoles + # --- the simple modern way --- + + eval { symlink("$OH/libclntsh.so.10.1","$OH/libclntsh.so") }; + # need to link so.10.1 file to .so + # hard coded the link dir here and below + + print "Found direct-link candidate: clntsh\n"; + my $lib = "clntsh"; + my $syslibs = read_sysliblist(); + + print "Oracle sysliblist: $syslibs\n"; + + # no library dir with instantclient + my $libdir = ""; + + $opts{dynamic_lib} = { OTHERLDFLAGS => "$::opt_g" }; + + $linkwith_msg = "-l$lib."; + $opts{LIBS} = [ "-L$OH/$libdir -l$lib $syslibs"]; + my $inc = "-I$OH\/sdk/include"; + $opts{INC} = "$inc -I$dbi_arch_dir"; + +} +else { # --- trawl the guts of Oracle's make files looking the how it wants to link #Lincoln: pick the right library path my $libdir = ora_libdir(); my @ora_libs = <$OH/$libdir/lib*>; @@ -713,7 +808,6 @@ if ($opts{LINKTYPE} && $opts{LINKTYPE} eq 'static') { # create this before WriteMakefile so MakeMaker knows it's here open(MK_PM, ">mk.pm") or die "Unable to create mk.pm: $!"; -print "\n"; WriteMakefile( dbd_edit_mm_attribs(\%opts) ); check_security() unless $os eq 'VMS' or $os eq 'MSWin32' or $os =~ /cygwin/i; @@ -922,6 +1016,7 @@ sub ora_libdir { else { $libdir = 'lib64' if perl_is_64bit() and -d "$OH/lib64"; } + return $libdir; } @@ -943,7 +1038,6 @@ sub del_crtobj { sub find_mkfile { - my @mkfiles; my @mk_proc = ( 'precomp/demo/proc/proc.mk', @@ -952,6 +1046,7 @@ sub find_mkfile { 'proc16/lib/proc16.mk', ); my @mk_oci = ( + 'rdbms/demo/demo_xe.mk', 'rdbms/lib/oracle.mk', 'rdbms/demo/oracle.mk', 'rdbms/demo/demo_rdbms.mk', @@ -992,7 +1087,6 @@ sub find_mkfile { } unless ($os eq 'MSWin32') || ($os eq 'VMS') || ($mkfile && -f $mkfile) || $::opt_F; print "Using $mkfile\n"; - warn "Note: Attempting to use makefile from otrace component. This may not work.\n" if ($mkfile =~ /atmoci.mk/); @@ -1173,6 +1267,9 @@ sub fetch_oci_macros { $linkvia = '-locic $(TTLIBS)'; # XXX GUESS HACK } } + elsif (!$linkvia && $MK{CCLIB}) { # Oracle XE + $linkvia = '$(CCLIB)'; + } unless ($linkvia){ die "ERROR parsing $file: Unable to determine what to link with.\n" ."Please send me copies of these files (one per mail message):\n@mkfiles\n"; @@ -1288,7 +1385,7 @@ sub find_bin{ my $bin = shift; my $path_sep = $Config{path_sep}; foreach (split(/\Q$path_sep/, $ENV{PATH})){ - return "$_/$bin" if -x "$_/$bin"; + return "$_/$bin" if -x "$_/$bin"; } return undef; } @@ -1296,7 +1393,8 @@ sub find_bin{ sub find_headers { my (%h_dir, %h_file, @h_dir); - find( sub { + + find( sub { return unless /^o(ci.{3,4}|ratypes)\.h$/i; my $dir = $File::Find::dir; $dir =~ s:^\Q$OH/::; @@ -1305,15 +1403,17 @@ sub find_headers { print "Found $dir/$_\n" if $::opt_d; }, # --- Oracle Instant Client locations - "$OH/sdk", # Instant Client default location (10g) "/include/oracle/$client_version_full/client", # Instant Client for RedHat FC3 # --- Traditional full-install locations "$OH/rdbms/public", # prefer public over others "$OH/rdbms", - "$OH/plsql", # oratypes.h sometimes here (eg HPUX 11.23 Itanium Oracle 9.2.0) + "$OH/plsql", # oratypes.h sometimes here (eg HPUX 11.23 Itanium Oracle 9.2.0), ); + @h_dir = keys %h_dir; + print "Found header files in @h_dir.\n" if @h_dir; + if (!$h_file{'oratypes.h'} || !$h_file{'ocidfn.h'}) { print "\n\n*********************************************************\n"; print "I can't find the header files I need in your Oracle installation.\n"; @@ -1332,10 +1432,10 @@ sub get_client_version { my $client_version_full = ''; - my $sqlplus_exe = ($os eq 'Win32') ? "sqlplus.exe" : "sqlplus"; + my $sqlplus_exe = ($os eq 'Win32' || $os eq 'MSWin32') ? "sqlplus.exe" : "sqlplus"; local $ENV{PATH} = join $Config{path_sep}, $ENV{PATH}, "$OH/bin", $OH; local $ENV{SQLPATH} = ""; # avoid $SQLPATH/login.sql causing sqlplus to hang - + print "path=$ENV{PATH}\n"; if (find_bin($sqlplus_exe)) { # Try to use the _SQLPLUS_RELEASE predefined variable from sqlplus # Documented in the SQL*Plus reference guide: @@ -1348,8 +1448,8 @@ sub get_client_version { close FH; my $sqlplus_release = `$sqlplus_exe -S /nolog \@define.sql 2>&1`; unlink "define.sql"; - print $sqlplus_release; - if ($sqlplus_release =~ /^DEFINE _SQLPLUS_RELEASE = "(\d?\d)(\d\d)(\d\d)(\d\d)(\d\d)"/) { + print $sqlplus_release; # the _SQLPLUS_RELEASE may not be on first line: + if ($sqlplus_release =~ /DEFINE _SQLPLUS_RELEASE = "(\d?\d)(\d\d)(\d\d)(\d\d)(\d\d)"/) { $client_version_full = sprintf("%d.%d.%d.%d", $1, $2, $3, $4); } } diff --git a/Oracle.pm b/Oracle.pm index 4dbc25d8..d42c6440 100644 --- a/Oracle.pm +++ b/Oracle.pm @@ -203,6 +203,7 @@ my $ORACLE_ENV = ($^O eq 'VMS') ? 'ORA_ROOT' : 'ORACLE_HOME'; # create a 'blank' dbh + $user = '' if not defined $user; (my $user_only = $user) =~ s:/.*::; my ($dbh, $dbh_inner) = DBI::_new_dbh($drh, { 'Name' => $dbname, diff --git a/README.aix b/README.aix.txt similarity index 100% rename from README.aix rename to README.aix.txt diff --git a/README.clients b/README.clients.txt similarity index 100% rename from README.clients rename to README.clients.txt diff --git a/README.explain b/README.explain.txt similarity index 100% rename from README.explain rename to README.explain.txt diff --git a/README.help b/README.help.txt similarity index 100% rename from README.help rename to README.help.txt diff --git a/README.hpux b/README.hpux.txt similarity index 100% rename from README.hpux rename to README.hpux.txt diff --git a/README.java b/README.java.txt similarity index 100% rename from README.java rename to README.java.txt diff --git a/README.linux b/README.linux.txt similarity index 72% rename from README.linux rename to README.linux.txt index 86f803dc..a3f5bed7 100644 --- a/README.linux +++ b/README.linux.txt @@ -48,3 +48,18 @@ smooth as just about every other CPAN module. I don't know if Oracle is bulletproof on Linux but the install process has some problems. + + +From: John Scoles +Date: Fri, 29 Sep 2005 10:48:47 -0700 (EST) +Subject: RE: Oracle 10g Instantclient + +The Makefile.PL will now work for Oracle 10g Instantclient. To have both the Compile and +the test.pl to work you must first have the LD_LIBRARY_PATH correctly set to your +"instantclient" directory. (http://www.oracle.com/technology/tech/oci/instantclient/instantclient.html) +The present version of the make creates a link on your "instantclient" directory as follows +"ln -s libclntsh.so.10.1 libclntsh.so". It is needed for both the makefile creation and the compile +but is not need for the test.pl. It should be removed after the compile. +If the Makefile.PL or make fails try creating this link directly in the ""instantclient" directory. + +"instantclient" as follows diff --git a/README.login b/README.login.txt similarity index 100% rename from README.login rename to README.login.txt diff --git a/README.longs b/README.longs.txt similarity index 100% rename from README.longs rename to README.longs.txt diff --git a/README.macosx b/README.macosx.txt similarity index 100% rename from README.macosx rename to README.macosx.txt diff --git a/README.sec b/README.sec.txt similarity index 100% rename from README.sec rename to README.sec.txt diff --git a/README.utf8 b/README.utf8.txt similarity index 100% rename from README.utf8 rename to README.utf8.txt diff --git a/README.vms b/README.vms.txt similarity index 100% rename from README.vms rename to README.vms.txt diff --git a/README.win32 b/README.win32 deleted file mode 100644 index 1a836e25..00000000 --- a/README.win32 +++ /dev/null @@ -1,58 +0,0 @@ -In general, on Windows, it's best to just use ActiveState Perl and the -PPM package manager to install a pre-built version of DBD::Oracle. - -If you built Perl with gcc, read README.wingcc as well as this file. - ---- other information, some of which is out of date --- -4/27/04 -- Jeff Urlwin - -Do not untar this distribution in a directory with spaces. This will not work. - -i.e. C:\Program Files\ORacle\DBD Oracle Distribution is bad while -c:\dev\dbd-oracle-1.15 is good ;) - -9/14/02 -- Michael Chase - -Makefile.PL uses Win32::TieRegistry or Win32::Registry to find the -current Oracle Home directory if the ORACLE_HOME environment variable -is not set. If neither module is installed, you must set ORACLE_HOME -before running Makefile.PL. Since the registry location of the current -Oracle Home is in different locations in different Oracle versions, -it is usually safer to set ORACLE_HOME before running Makefile.PL. - -10/24/97 -- Jeff Urlwin - -Tested with Oracle 8 and OCI 8. Well, not the *new* OCI api, but -using the same api as always. This version now searches for OCI -include and library files in $ORACLE_HOME\OCI80, then -$ORACLE_HOME\OCI73. It will use the first of these found. - -In order for the tests to connect successfully, I had to -set the environment variable ORACLE_USERID to -scott/tiger@mydb (where mydb is the tns name of your server) - -4/8/97 -- Jeff Urlwin - -Even though the Oracle libraries under Win32 (NT) do not require the -environment variable ORACLE_HOME be set for proper operation, the -Makefile.PL does. Please set the ORACLE_HOME variable to your oracle -home directory. Mine, for example, is H:\ORANT. - -The environment variable TWO_TASK is not supported under Windows. -Instead Oracle uses the settings LOCAL and REMOTE as described in -the Oracle Networking Documentation, "Oracle Network Products Getting -Started for Windows Platforms." - -This version was created and tested with the 7.3 client libraries (see -if you have an OCI73 directory). This version of the Oracle clients -have a convenient organization, including OCI73\INCLUDE, OCI73\LIB, -etc. It also has a nice samples directory to test with. Older -versions had the OCI samples under RDMBS72. This version has not been -tested (and will not currently work) with anything other than the 7.3 -versions. - -Questions should be directed towards the dbi-users mailing list. I will -try to answer them quickly there. Please put something about Win32 or -95 or NT in the subject, as I get TONS of other email and spend a fair -amount of time weeding out messages that are not relevant to what I -do. I may miss something if the subject is not clear. diff --git a/README.win32.txt b/README.win32.txt new file mode 100644 index 00000000..0ae5d072 --- /dev/null +++ b/README.win32.txt @@ -0,0 +1,222 @@ +In general, on Windows, it's best to just use ActiveState Perl and the +PPM package manager to install a pre-built version of DBD::Oracle. + +If you built Perl with gcc, read README.wingcc as well as this file. + +--- other information, some of which is out of date --- + +DBD-Oracle for Windows and Oracle Instantclient +By: John Scoles Scoles@ptyhian.com +The Pythian Group + +The preferred method of getting DBD::Oracle is to use a pre-built version from the ActiveState +repository, which can be installed with PPM. + +Compiling and installing DBD::Oracle 1.06 on a windows 2000 professional OS for use +with Oracle instantClient ver 10.2.0.1 & 10.1.0.4 requires only a few downloads and +a minimal number of environment setting. The procedures below were tested on a clean +Windows 2000 professional platform having no Oracle or other development environment installed. + +1) The first part of the process is to download and install the latest version of + Active Perl (5.8.7 used) from http://www.activeperl.com/. + +2) Use the PPM application to get the latest version of DBI + +3) Download the Pythian branch of dbd-oracle from http://svn.perl.org/modules/dbd-oracle/branches/pythian + +4) Download and unzip the Oracle Instant Client (10.2.0.1 or 10.1.0.4) 32 bit from + http://www.oracle.com/technology/tech/oci/instantclient/instantclient.html + You will need all three of these products + i. Instant Client Package - Basic + ii. Instant Client Package - SQL*Plus: + iii. Instant Client Package - SDK: + +5) You will now need the Microsoft Visual C++ toolkit. Which you can get at + http://msdn.microsoft.com/visualc/vctoolkit2003/. Download and then install this product. + +6) You will also need the Windows SDK. Which can be found at + http://www.microsoft.com/downloads/details.aspx?FamilyId=A55B6B43-E24F-4EA3-A93E-40C0EC4F68E5&displaylang=en + You have the choice to of either to download the entire SDK and install or run an online install from the page. + Both have been tested and proven to work. + +7) Next download and install the Microsoft .net framework 1.1 skd from + http://www.microsoft.com/downloads/details.aspx?FamilyID=9b3a2ca6-3647-4070-9f41-a333c6b9181d&displaylang=en + +8) Enough Downloading and installing go have a coffee. + +9) You should at this time attempt to connect to an Oracle database with the version SQL*Plus that + you installed in step 4. If you are unable to connect at this stage then any problems you encounter + later may have nothing to do with DBD::Oracle + +10) On the path where you installed Visual C++ find and edit the vcars32.bat file as follows. You may have to modify + these path values depending where you installed the products on you computer, + + i. Add the local path to the windows platform SDK include directory to the Set INCLUDE + Command Line to include the needed files from the Windows SDK. + e.g. "C:\Program Files\Microsoft Platform SDK\Include;" + ii. Add the local path to the .net Vc7 lib directory to the Set LIB command + to include the needed library file from the .Net SKD + e.g. C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\lib; + iii. Add the local path to the windows platform SDK Lib directory to the Set Lib command + to include the needed library files from the Windows SDK + e.g. C:\Program Files\Microsoft Platform SDK\Lib; + +11) Open a Windows Visual C++ command window from the start menu. + +12) Add the path to the instant client directory to the Path command + e.g. PATH = C:\Oracle\instantclient;%PATH% + +13) Using the "Set" command add "ORACLE_HOME=path to Instant client" to the environment variables. + e.g. Set ORACLE_HOME= C:\Oracle\instantclient + +14) Using the "Set" command add "NLS_LANG=.WE8ISO8859P15" to the environment variables. The globalization variable is required, + with this or another compatible value, by Oracle instantclient in order for it to compile correctly. + e.g. Set NLS_LANG=.WE8ISO8859P15 + +15) Using the "Set" command add "ORACLE_USERID=test/test@test" substituting test with the username/password@database + you wish to run the make test files against. + Note: it is not necessary to do this step for the compile and install to work. However, the self-test programs included with Oracle-DBD will not run correctly is this varaible is not set. + +16) Move to the DBD-Oracle directory in the Visual C++ window DOS prompt and enter the following. + + c:\oracle-dbd\>perl Makefile.PL + + The Makefile should then run and compile Oracle-dbd without reporting any errors. + +17) From the DOS prompt enter the following command + + c:\oracle-dbd\>nmake + + The Visual C++ make executable will then build you DBD-execuable. There should be no errors at this point. + +18) You can test the compile by either entering + + c:\oracle-dbd\>nmake test + + As long as you have given a valid user name, password and database name instep 15 you will see some results. If it appears to + run but you do not get a connection check the following. + + i. User name password and DB Name + ii. Ensure the a valid TNSNAMES.ORA file is in the Instantclient directory + iii. Attempt to log into the version of SQLPLUS that comes with Instantclient. + If you manage to log on use the username password and TNS name with + the Set ORACLE_USERID = and rerun the tests. + +19) You can now install DBD-Oracle into you system by entering the following command from the Visual C++ window dos prompt; + + c:\oracle-dbd\>nmake install + +20) You should now be able to run DBD-Oracle on you system + + + +11/30/05 -- John Scoles +I have confirmed that this Makefile.pl will work for both Oracle InstantClient +10.2.0.1 & 10.1.0.4 using same process the Andy Hassall uses. Starting with a clean OD +One needs only to get the latest version of Active Perl 5.8.7 use PPM to get DBI and then +install Microsoft Visual C++ toolkit, Windows SDK, and the Microsoft .net +framework 1.1. and modify the vcars32.bat in C++ dir as follows + + 1) Add the local path to the windows platform SDK include directory to the + Set INCLUDE Command Line to include the needed files from the Windows SDK. + e.g. "C:\Program Files\Microsoft Platform SDK\Include;" + 2) Add the local path to the .net Vc7 lib directory to the Set LIB + command to include the needed library files from the .Net SKD + e.g. C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\lib; + 3) Add the local path to the windows platform SDK Lib directory to the Set Lib + command to include the needed library files from the Windows SDK + e.g. C:\Program Files\Microsoft Platform SDK\Lib; + +If one happens to have visual studio installed you may not have to download additional MS products. + +12/01/05 --- John Scoles +Oracle 10XE +No big problem here as 10XE seems to use the instantclient as well. Just ensure your + NLS_LANG and ORACLE_HOME are set to the same directory that 10XE uses + + +10/07/05 --John Scoles +Andy Hassall Kindly added some changes to the Makefile.PL +so it will work for the Instant Client 10g on Windows OSs. Below is how he set +up his environment and the steps he preformed to get it to compile. + + Setting environment for using Microsoft Visual Studio .NET 2003 tools. + (If you have another version of Visual Studio or Visual C++ installed and wish + to use its tools from the command line, run vcvars32.bat for that version.) + + C:\Documents and Settings\andyh>d: + + D:\>cd cygwin\home\andyh\src\pythian + + D:\cygwin\home\andyh\src\pythian>set ORACLE_HOME=d:\lib\instantclient_10_2 + + D:\cygwin\home\andyh\src\pythian>set NLS_LANG=.WE8ISO8859P15 + + D:\cygwin\home\andyh\src\pythian>set PATH=d:\lib\instantclient_10_2;D:\Program F + iles\Microsoft Visual Studio .NET 2003\Common7\IDE;D:\Program Files\Microsoft Vi + sual Studio .NET 2003\VC7\BIN;D:\Program Files\Microsoft Visual Studio .NET 2003 + \Common7\Tools;D:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\ + bin\prerelease;D:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\ + bin;D:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\bin;C:\WINNT\Mic + rosoft.NET\Framework\v1.1.4322;d:\Perl\bin\;C:\WINNT\system32;C:\WINNT;C:\WINNT\ + System32\Wbem;D:\Program Files\Microsoft SDK\Bin;D:\Program Files\Microsoft SDK\ + Bin\WinNT + + D:\cygwin\home\andyh\src\pythian>set ORACLE_USERID=test/test@test102 + + D:\cygwin\home\andyh\src\pythian>perl Makefile.PL + + + +4/27/04 -- Jeff Urlwin + +Do not untar this distribution in a directory with spaces. This will not work. + +i.e. C:\Program Files\ORacle\DBD Oracle Distribution is bad while +c:\dev\dbd-oracle-1.15 is good ;) + +9/14/02 -- Michael Chase + +Makefile.PL uses Win32::TieRegistry or Win32::Registry to find the +current Oracle Home directory if the ORACLE_HOME environment variable +is not set. If neither module is installed, you must set ORACLE_HOME +before running Makefile.PL. Since the registry location of the current +Oracle Home is in different locations in different Oracle versions, +it is usually safer to set ORACLE_HOME before running Makefile.PL. + +10/24/97 -- Jeff Urlwin + +Tested with Oracle 8 and OCI 8. Well, not the *new* OCI api, but +using the same api as always. This version now searches for OCI +include and library files in $ORACLE_HOME\OCI80, then +$ORACLE_HOME\OCI73. It will use the first of these found. + +In order for the tests to connect successfully, I had to +set the environment variable ORACLE_USERID to +scott/tiger@mydb (where mydb is the tns name of your server) + +4/8/97 -- Jeff Urlwin + +Even though the Oracle libraries under Win32 (NT) do not require the +environment variable ORACLE_HOME be set for proper operation, the +Makefile.PL does. Please set the ORACLE_HOME variable to your oracle +home directory. Mine, for example, is H:\ORANT. + +The environment variable TWO_TASK is not supported under Windows. +Instead Oracle uses the settings LOCAL and REMOTE as described in +the Oracle Networking Documentation, "Oracle Network Products Getting +Started for Windows Platforms." + +This version was created and tested with the 7.3 client libraries (see +if you have an OCI73 directory). This version of the Oracle clients +have a convenient organization, including OCI73\INCLUDE, OCI73\LIB, +etc. It also has a nice samples directory to test with. Older +versions had the OCI samples under RDMBS72. This version has not been +tested (and will not currently work) with anything other than the 7.3 +versions. + +Questions should be directed towards the dbi-users mailing list. I will +try to answer them quickly there. Please put something about Win32 or +95 or NT in the subject, as I get TONS of other email and spend a fair +amount of time weeding out messages that are not relevant to what I +do. I may miss something if the subject is not clear. diff --git a/README.wingcc b/README.wingcc.txt similarity index 100% rename from README.wingcc rename to README.wingcc.txt diff --git a/dbdimp.c b/dbdimp.c index 0723bde8..fc75433f 100644 --- a/dbdimp.c +++ b/dbdimp.c @@ -164,10 +164,14 @@ oratype_bind_ok(int dbtype) /* It's a type we support for placeholders */ case 2: /* NVARCHAR2 */ case 5: /* STRING */ case 8: /* LONG */ + case 21: /* BINARY FLOAT os-endian */ + case 22: /* BINARY DOUBLE os-endian */ case 23: /* RAW */ case 24: /* LONG RAW */ case 96: /* CHAR */ case 97: /* CHARZ */ + case 100: /* BINARY FLOAT oracle-endian */ + case 101: /* BINARY DOUBLE oracle-endian */ case 106: /* MLSLABEL */ case 102: /* SQLT_CUR OCI 7 cursor variable */ case 112: /* SQLT_CLOB / long */ @@ -421,7 +425,7 @@ dbd_db_login6(SV *dbh, imp_dbh_t *imp_dbh, char *dbname, char *uid, char *pwd, S charsetid, ncharsetid, status ); if (status != OCI_SUCCESS) { oci_error(dbh, NULL, status, - "OCIEnvNlsCreate (check ORACLE_HOME and NLS settings, permissions etc.)"); + "OCIEnvNlsCreate. Check ORACLE_HOME env var, NLS settings, permissions, etc."); return 0; } @@ -438,7 +442,7 @@ dbd_db_login6(SV *dbh, imp_dbh_t *imp_dbh, char *dbname, char *uid, char *pwd, S OCIInitialize_log_stat(init_mode, 0, 0,0,0, status); if (status != OCI_SUCCESS) { oci_error(dbh, NULL, status, - "OCIInitialize. Check ORACLE_HOME and NLS settings etc."); + "OCIInitialize. Check ORACLE_HOME env var, Oracle NLS settings, permissions etc."); return 0; } @@ -2120,6 +2124,15 @@ ora2sql_type(imp_fbh_t* fbh) { sql_fbh.dbtype = SQL_DECIMAL; /* better: SQL_NUMERIC */ } break; +#ifdef SQLT_IBDOUBLE + case SQLT_BDOUBLE: + case SQLT_BFLOAT: + case SQLT_IBDOUBLE: + case SQLT_IBFLOAT: + sql_fbh.dbtype = SQL_DOUBLE; + sql_fbh.prec = 126; + break; +#endif case SQLT_CHR: sql_fbh.dbtype = SQL_VARCHAR; break; case SQLT_LNG: sql_fbh.dbtype = SQL_LONGVARCHAR; break; /* long */ case SQLT_DAT: sql_fbh.dbtype = SQL_TYPE_TIMESTAMP;break; diff --git a/oci8.c b/oci8.c index 30769d06..aec1a3e0 100644 --- a/oci8.c +++ b/oci8.c @@ -1223,9 +1223,9 @@ dbd_describe(SV *h, imp_sth_t *imp_sth) /* FALLTHRU */ case 96: /* CHAR */ fbh->disize = fbh->dbsize; - fbh->prec = fbh->disize; if (CS_IS_UTF8(fbh->csid)) fbh->disize = fbh->dbsize * 4; + fbh->prec = fbh->disize; break; case 23: /* RAW */ fbh->disize = fbh->dbsize * 2; @@ -1233,8 +1233,12 @@ dbd_describe(SV *h, imp_sth_t *imp_sth) break; case 2: /* NUMBER */ + case 21: /* BINARY FLOAT os-endian */ + case 22: /* BINARY DOUBLE os-endian */ + case 100: /* BINARY FLOAT oracle-endian */ + case 101: /* BINARY DOUBLE oracle-endian */ fbh->disize = 130+38+3; /* worst case */ - avg_width = 4; /* > approx +/- 1_000_000 ? */ + avg_width = 4; /* NUMBER approx +/- 1_000_000 */ break; case 12: /* DATE */ diff --git a/t/10general.t b/t/10general.t index ec95932d..3a9133ad 100644 --- a/t/10general.t +++ b/t/10general.t @@ -4,9 +4,10 @@ use Test::More; use DBI; use Oraperl; +use Config; $| = 1; -plan tests => 31; +plan tests => 33; my $dbuser = $ENV{ORACLE_USERID} || 'scott/tiger'; my $dbh = DBI->connect('dbi:Oracle:', $dbuser, ''); @@ -18,6 +19,14 @@ unless($dbh) { my($sth, $p1, $p2, $tmp); +SKIP: { + skip "not unix-like", 2 unless $Config{d_semctl}; + # basic check that we can fork subprocesses and wait for the status + is system("false"), 1<<8, 'system false should return 256'; + is system("true"), 0, 'system true should return 0'; +} + + $sth = $dbh->prepare(q{ /* also test preparse doesn't get confused by ? :1 */ /* also test placeholder binding is case insensitive */ diff --git a/t/20select.t b/t/20select.t index d5baa35b..01eaa8f5 100644 --- a/t/20select.t +++ b/t/20select.t @@ -53,8 +53,8 @@ my @test_sets = ( # Normal value 8 (to test 64KB threshold well) my $sz = 8; -my $tests = 2; -my $tests_per_set = 14; +my $tests = 3; +my $tests_per_set = 11; $tests += @test_sets * $tests_per_set; print "1..$tests\n"; @@ -107,13 +107,6 @@ sub run_select_tests { ok(0, $tmp->[2][1] =~ m/$data2/, cdif($tmp->[2][1], $data2, "Len ".length($tmp->[2][1])) ); - # 10/25/2005 lenio: adding tests around $sth->{PRECISION}: - # 1st column, an integer, should have PRECISION of 38 - ok(0, $sth->{PRECISION}->[0] == 38); - # 2nd column, character type, should have PRECISION of 10 - ok(0, $sth->{PRECISION}->[1] == 10); - # 3rd column, date type, should have PRECISION of 75 - ok(0, $sth->{PRECISION}->[2] == 75); } # end of run_select_tests