compiling error
Hi everybody, Can I get your help? gunziped the DBI module on my Sparc-Solaris 8 system. I've read the README file and followed the steps. perl Makefile.PL ...OK. But when I do make, tries to compile with gcc. Encountrered the following error messages. === % make gcc -c -xO3 -xdepend -DVERSION=\1.18\ -DXS_VERSION=\1.18\ -KPIC - I/uc gcc: unrecognized option `-KPIC' gcc: language depend not recognized gcc: Perl.c: linker input file unused since linking not done /bin/perl -I/usr/perl5/5.00503/sun4-solaris -I/usr/perl5/5.00503 /usr/perl5/5.0c gcc -c -xO3 -xdepend -DVERSION=\1.18\ -DXS_VERSION=\1.18\ -KPIC - I/uc gcc: unrecognized option `-KPIC' gcc: language depend not recognized gcc: DBI.c: linker input file unused since linking not done LD_RUN_PATH= gcc -o blib/arch/auto/DBI/DBI.so -G DBI.o gcc: DBI.o: No such file or directory gcc: No input files *** Error code 1 make: Fatal error: Command failed for target `blib/arch/auto/DBI/DBI.so' == Note: (perl and gcc version infomation) 1) This is perl, version 5.005_03 built for sun4-solaris Copyright 1987-1999, Larry Wall 2) gcc version 2.95.2 19991024 (release) Thanks Ruijie
RE: compiling error
Old Perl in your path! /bin/perl -I/usr/perl5/5.00503/sun4-solaris -I/usr/perl5/5.00503 ^^^ -Original Message- From: Deng Ruijie [mailto:[EMAIL PROTECTED]] Sent: Monday, July 02, 2001 4:23 PM To: [EMAIL PROTECTED] Subject: compiling error Hi everybody, Can I get your help? gunziped the DBI module on my Sparc-Solaris 8 system. I've read the README file and followed the steps. perl Makefile.PL ...OK. But when I do make, tries to compile with gcc. Encountrered the following error messages. === % make gcc -c -xO3 -xdepend -DVERSION=\1.18\ -DXS_VERSION=\1.18\ -KPIC - I/uc gcc: unrecognized option `-KPIC' gcc: language depend not recognized gcc: Perl.c: linker input file unused since linking not done /bin/perl -I/usr/perl5/5.00503/sun4-solaris -I/usr/perl5/5.00503 /usr/perl5/5.0c gcc -c -xO3 -xdepend -DVERSION=\1.18\ -DXS_VERSION=\1.18\ -KPIC - I/uc gcc: unrecognized option `-KPIC' gcc: language depend not recognized gcc: DBI.c: linker input file unused since linking not done LD_RUN_PATH= gcc -o blib/arch/auto/DBI/DBI.so -G DBI.o gcc: DBI.o: No such file or directory gcc: No input files *** Error code 1 make: Fatal error: Command failed for target `blib/arch/auto/DBI/DBI.so' == Note: (perl and gcc version infomation) 1) This is perl, version 5.005_03 built for sun4-solaris Copyright 1987-1999, Larry Wall 2) gcc version 2.95.2 19991024 (release) Thanks Ruijie __ Please Note : Only the intended recipient is authorised to access or use this e-mail. If you are not the intended recipient, please delete this e-mail and notify the sender immediately. The contents of this e-mail are the writer's opinion and are not necessarily endorsed by the Gunz Companies unless expressly stated. We use virus scanning software but exclude all liability for viruses or similar in any attachment.
RE: compiling error
Hi Neil Lunn, Following is the output for 'perl -V': # perl -V Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration: Platform: osname=solaris, osvers=2.8, archname=sun4-solaris uname='sunos localhost 5.8 sun4u sparc sunw,ultra-1 ' hint=previous, useposix=true, d_sigaction=define usethreads=undef useperlio=undef d_sfio=undef Compiler: cc='cc', optimize='-xO3 -xdepend', gccversion= cppflags='' ccflags ='' stdchar='char', d_stdstdio=define, usevfork=false intsize=4, longsize=4, ptrsize=4, doublesize=8 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 alignbytes=8, usemymalloc=n, prototype=define Linker and Libraries: ld='cc', ldflags ='' libpth=/lib /usr/lib /usr/ccs/lib libs=-lsocket -lnsl -ldl -lm -lc -lcrypt libc=/lib/libc.so, so=so, useshrplib=true, libperl=libperl.so Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-R /usr/perl5/5.0' cccdlflags='-KPIC', lddlflags='-G' Characteristics of this binary (from libperl): Built under solaris Compiled at Dec 22 1999 00:00:57 @INC: /usr/perl5/5.00503/sun4-solaris /usr/perl5/5.00503 /usr/perl5/site_perl/5.005/sun4-solaris /usr/perl5/site_perl/5.005 . # -Original Message- From: Neil Lunn [mailto:[EMAIL PROTECTED]] Sent: Monday, July 02, 2001 4:14 PM To: 'Deng Ruijie' Cc: '[EMAIL PROTECTED]' Subject: RE: compiling error My mistake actually, I confused your email with another I just read. Something looks funny here though considering -KPIC as a gcc option that doesn't exist. Make is probably old and broken so I would upgrdade this. A straight guess would say that you perl was not compiled on this machine. This will cause you problems. If unsure about this send the full output of perl -V along with your post to the list. Upgrading perl is usually recommended anyway. P.S. Please don't reply to me directly and use the list instead. --Neil -Original Message- From: Deng Ruijie [mailto:[EMAIL PROTECTED]] Sent: Monday, July 02, 2001 5:49 PM To: 'Neil Lunn' Subject: RE: compiling error Hi Neil Lunn, Thank a lot for your promtp reply. You mean the error will disappear if I install a newer version of perl? Best regards, Ruijie -Original Message- From: Neil Lunn [mailto:[EMAIL PROTECTED]] Sent: Monday, July 02, 2001 3:46 PM To: [EMAIL PROTECTED] Subject: RE: compiling error Old Perl in your path! /bin/perl -I/usr/perl5/5.00503/sun4-solaris -I/usr/perl5/5.00503 ^^^ -Original Message- From: Deng Ruijie [mailto:[EMAIL PROTECTED]] Sent: Monday, July 02, 2001 4:23 PM To: [EMAIL PROTECTED] Subject: compiling error Hi everybody, Can I get your help? gunziped the DBI module on my Sparc-Solaris 8 system. I've read the README file and followed the steps. perl Makefile.PL ...OK. But when I do make, tries to compile with gcc. Encountrered the following error messages. === % make gcc -c -xO3 -xdepend -DVERSION=\1.18\ -DXS_VERSION=\1.18\ -KPIC - I/uc gcc: unrecognized option `-KPIC' gcc: language depend not recognized gcc: Perl.c: linker input file unused since linking not done /bin/perl -I/usr/perl5/5.00503/sun4-solaris -I/usr/perl5/5.00503 /usr/perl5/5.0c gcc -c -xO3 -xdepend -DVERSION=\1.18\ -DXS_VERSION=\1.18\ -KPIC - I/uc gcc: unrecognized option `-KPIC' gcc: language depend not recognized gcc: DBI.c: linker input file unused since linking not done LD_RUN_PATH= gcc -o blib/arch/auto/DBI/DBI.so -G DBI.o gcc: DBI.o: No such file or directory gcc: No input files *** Error code 1 make: Fatal error: Command failed for target `blib/arch/auto/DBI/DBI.so' == Note: (perl and gcc version infomation) 1) This is perl, version 5.005_03 built for sun4-solaris Copyright 1987-1999, Larry Wall 2) gcc version 2.95.2 19991024 (release) Thanks Ruijie ___ ___ Please Note : Only the intended recipient is authorised to access or use this e-mail. If you are not the intended recipient, please delete this e-mail and notify the sender immediately. The contents of this e-mail are the writer's opinion and are not necessarily endorsed by the Gunz Companies unless expressly stated. We use virus scanning software but exclude all liability for viruses or similar in any attachment. __ Please Note : Only the intended recipient is authorised to access or use this e-mail. If you are not the intended recipient, please delete this e-mail and notify the sender immediately. The contents of this e-mail are the writer's opinion and are not necessarily endorsed by the Gunz Companies unless expressly stated. We use virus scanning software but exclude all liability for viruses or similar in any attachment.
RE: compiling error
-Original Message- From: Deng Ruijie [mailto:[EMAIL PROTECTED]] Sent: Monday, July 02, 2001 6:26 PM To: [EMAIL PROTECTED] Subject: RE: compiling error Hi Neil Lunn, Following is the output for 'perl -V': # perl -V Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration: Platform: osname=solaris, osvers=2.8, archname=sun4-solaris uname='sunos localhost 5.8 sun4u sparc sunw,ultra-1 ' hint=previous, useposix=true, d_sigaction=define usethreads=undef useperlio=undef d_sfio=undef Compiler: cc='cc', optimize='-xO3 -xdepend', gccversion= ^^ Not built with gcc. Someone has hacked this up in the past. If you have gcc (2.95.2 which you have) you could do well to build and install your own perl. You will need to be careful with what options you choose (prefix, previous perl, 5.005 compatibilty) but this isn't too dificult to work out. Otherwise there should be gcc builds available or you can use a solaris native compiler. Good Luck! --Neil cppflags='' ccflags ='' stdchar='char', d_stdstdio=define, usevfork=false intsize=4, longsize=4, ptrsize=4, doublesize=8 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 alignbytes=8, usemymalloc=n, prototype=define Linker and Libraries: ld='cc', ldflags ='' libpth=/lib /usr/lib /usr/ccs/lib libs=-lsocket -lnsl -ldl -lm -lc -lcrypt libc=/lib/libc.so, so=so, useshrplib=true, libperl=libperl.so Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-R /usr/perl5/5.0' cccdlflags='-KPIC', lddlflags='-G' Characteristics of this binary (from libperl): Built under solaris Compiled at Dec 22 1999 00:00:57 @INC: /usr/perl5/5.00503/sun4-solaris /usr/perl5/5.00503 /usr/perl5/site_perl/5.005/sun4-solaris /usr/perl5/site_perl/5.005 . # -Original Message- From: Neil Lunn [mailto:[EMAIL PROTECTED]] Sent: Monday, July 02, 2001 4:14 PM To: 'Deng Ruijie' Cc: '[EMAIL PROTECTED]' Subject: RE: compiling error My mistake actually, I confused your email with another I just read. Something looks funny here though considering -KPIC as a gcc option that doesn't exist. Make is probably old and broken so I would upgrdade this. A straight guess would say that you perl was not compiled on this machine. This will cause you problems. If unsure about this send the full output of perl -V along with your post to the list. Upgrading perl is usually recommended anyway. P.S. Please don't reply to me directly and use the list instead. --Neil -Original Message- From: Deng Ruijie [mailto:[EMAIL PROTECTED]] Sent: Monday, July 02, 2001 5:49 PM To: 'Neil Lunn' Subject: RE: compiling error Hi Neil Lunn, Thank a lot for your promtp reply. You mean the error will disappear if I install a newer version of perl? Best regards, Ruijie -Original Message- From: Neil Lunn [mailto:[EMAIL PROTECTED]] Sent: Monday, July 02, 2001 3:46 PM To: [EMAIL PROTECTED] Subject: RE: compiling error Old Perl in your path! /bin/perl -I/usr/perl5/5.00503/sun4-solaris -I/usr/perl5/5.00503 ^^^ -Original Message- From: Deng Ruijie [mailto:[EMAIL PROTECTED]] Sent: Monday, July 02, 2001 4:23 PM To: [EMAIL PROTECTED] Subject: compiling error Hi everybody, Can I get your help? gunziped the DBI module on my Sparc-Solaris 8 system. I've read the README file and followed the steps. perl Makefile.PL ...OK. But when I do make, tries to compile with gcc. Encountrered the following error messages. === % make gcc -c -xO3 -xdepend -DVERSION=\1.18\ -DXS_VERSION=\1.18\ -KPIC - I/uc gcc: unrecognized option `-KPIC' gcc: language depend not recognized gcc: Perl.c: linker input file unused since linking not done /bin/perl -I/usr/perl5/5.00503/sun4-solaris -I/usr/perl5/5.00503 /usr/perl5/5.0c gcc -c -xO3 -xdepend -DVERSION=\1.18\ -DXS_VERSION=\1.18\ -KPIC - I/uc gcc: unrecognized option `-KPIC' gcc: language depend not recognized gcc: DBI.c: linker input file unused since linking not done LD_RUN_PATH= gcc -o blib/arch/auto/DBI/DBI.so -G DBI.o gcc: DBI.o: No such file or directory gcc: No input files *** Error code 1 make: Fatal error: Command failed for target `blib/arch/auto/DBI/DBI.so' == Note: (perl and gcc version infomation) 1) This is perl, version 5.005_03 built for sun4-solaris Copyright 1987-1999, Larry Wall 2) gcc version 2.95.2 19991024 (release) Thanks Ruijie ___ ___ Please Note : Only the intended recipient is authorised to access or use this e-mail. If you are not the intended recipient, please delete this e-mail and notify the sender immediately. The contents of this e-mail are the writer's opinion and are not necessarily endorsed by the Gunz Companies unless expressly
db2 recursive query with placeholder
Hello, I have come upon a problem with traversing a tree in a DB2 project called config database. The problem can be reduced to the following script. The script works with $sql1, where I do not use a placeholder, and SEGVs with $sql2 with a placeholder for sup_ord_id. Can anybody provide me with a hint? #! usr/db/bin/perl5 -w use strict 'vars'; use DBI; my $dbh; my $sql1=q{ WITH PROD ( product_id, sup_ord_id, product_class, product_type) AS ( SELECT * FROM CO_PRODUCT WHERE sup_ord_id='TMRAEF' UNION ALL SELECT child.* FROM PROD parent, CO_PRODUCT child WHERE parent.product_id = child.sup_ord_id ) SELECT * FROM PROD WHERE product_class = 'TMR' }; my $sql2=q{ WITH PROD ( product_id, sup_ord_id, product_class, product_type) AS ( SELECT * FROM CO_PRODUCT WHERE sup_ord_id=? UNION ALL SELECT child.* FROM PROD parent, CO_PRODUCT child WHERE parent.product_id = child.sup_ord_id ) SELECT * FROM PROD WHERE product_class = 'TMR' }; sub dumprows { my $dbh=shift; my $sql=shift; my @parms=@_; my $sth; print SQL: $sql\n; $sth=$dbh-prepare($sql); if ( scalar @parms0 ) { print STDERR parms: ,join(' ',@parms),\n; $sth-execute(@parms); } else { print STDERR call with no parms\n; $sth-execute; } while ( my $row = $sth-fetchrow_hashref ) { foreach my $i (keys %{$row}) { print $i = $row-{$i}\n; } } } $dbh=DBI-connect(dbi:DB2:CONFIG,user,pwd); dumprows($dbh,$sql1); dumprows($dbh,$sql2,$ARGV[0]||TMRAEF); $dbh-disconnect; exit 0; The table CO_PRODUCT is populated with this sample data: COLUMNS: product_class, product_id, sup_ord_id, product_type # MN-function, IND-name, dependency, whatsit TMR, AEF, TMRAEF,PRODUCT TMR, SENT36, TMRSENT, PRODUCT TMR, NTMON36, SENT36,PRODUCT TMR, TMEM36, SENT36,PRODUCT TMR, OS2MON, SENT36,PRODUCT I have to develop the DB2 version on NT4SP5 with: This is perl, v5.6.0 built for MSWin32-x86-multi-thread (with 1 registered patch, see perl -V for more detail) Binary build 623 provided by ActiveState Tool Corp. http://www.ActiveState.com Built 16:27:07 Dec 15 2000 # perl5 -MDBI -e 'print $DBI::VERSION,\n' 1.14 # perl5 -MDBD::DB2 -e 'print $DBD::DB2::VERSION,\n' 0.74 -- Tschau...Thomas Do you wanna be a legend or a passing footprint on the sands of time? Senior Consultant, Tivoli Certified Enterprise Consultant + Instructor santix AG,Max-Planck-Str. 7,D-85716 Unterschleissheim, Germany +49-89-321506-0, Fax -99, [EMAIL PROTECTED], www.santix.de/~ths Office Frankfurt/Main: Roentgenstr. 7, D-60388 Bergen-Enkheim, Germany +49-6109-7329-30, Fax +49-6109-369375, Mobile +49-171-4416678
DBI is not catching the error
Hi all, I am trying to access an Informix database, that I have only connect permissions, and I am trying to 'eval' the code below, but for some reason that I can't identify, no error occurred in the first 2 select statements, the error occurred at third SQL statement, which is drop table. When running any of the first 2 select statments manually, I got an error that I don't have permissions. What I am expecting is to exit the eval block from the first SQL statement since I don't have permissions. I can't identify the problem, is it from the DBI or DBD::Informix, that not catching the error. Regards, Mahdi. # my ($run_tab_count); my ($sql_stmt_drop_run_cnt); my ($tab_type) = 'T'; my ($tab_name_like) = 'run%'; my (@tab_names_array) = (); my ($run_tab_name); ### Starting the eval Block eval { ### Quote String Variables my($quoted_tab_type)= $db_handle-quote($tab_type); my($quoted_tab_name_like) = $db_handle-quote($tab_name_like); $run_tab_count = $db_handle-selectrow_array( select count(*) from systables where tabname like $quoted_tab_name_like AND tabtype = $quoted_tab_type ); if ($run_tab_count == 0) { print(\nNo RUN Tables Found In The Database.\n\n); return; } $sql_stmt_drop_run_cnt = $db_handle-prepare( select tabname from systables where tabname like $quoted_tab_name_like AND tabtype = $quoted_tab_type ); $sql_stmt_drop_run_cnt-execute(); while ( $run_tab_name = $sql_stmt_drop_run_cnt-fetchrow_array ) { # dropping RUN... tables one at a time print(\nDropping table $run_tab_name...\t); $db_handle-do( drop table $run_tab_name ); print(dropped.); } print(\n\nRUN tables dropped successfully\n); }; # End eval Block... if ($@) { ++$no_of_errors; print LOGFILE E:\t; error_log(); ### Disconnect and Exit connection_function(2); } ## -Original Message- From: pkp team [mailto:[EMAIL PROTECTED]] Sent: Monday, July 02, 2001 12:02 PM To: [EMAIL PROTECTED] Subject: DBI error Hello all: I have a problem. I have a small script: #!/usr/bin/perl -w use DBI; use strict; my $db = 'test'; my $host = 'localhost'; my $id = 'root'; my $pwd= 'passwd'; my $dbh = DBI-connect(DBI:mysql:$db:$host,$id,$pwd); if(!defined $dbh) { die Can't connect: $DBI::errstr \n; } print Connected!!\n; exit; However, i am getting the following error on running the script: /usr/bin/perl: error while loading shared libraries: /usr/lib/perl5/site_perl/5.6.0/i386-linux/auto/DBD/mysql/mysql.so: undefined symbol: mysql_init I think i should mention here that i had some problems installing DBD::mysql (it gave me errors everytime i ran make test). I mentioned it here on the mailing list, and some people suggested that i can ignore it. But now i cant even run a simple script. Any help would be greatly appreciated. I have been stuck on getting DBI/DBD/Mysql running for more than a week now! Thanking inadvance, Trev _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
perl dbi generator slightly OT
I was reading a post from SQL general about how to code up Perl/DBI for a simple form. I know that I spend a lot of time doing this, writing the CGI params and all the placeholders and column binding... keeping track of the number of question marks... So I wrote this page and sent it to the poster: http://thelimit.com/cgi-bin/test.cgi You would change the action of your form to point to that. For example: http://thelimit.com/play/member_test.htm (fill in the text fields with field lengths) So (aside from no use strict and -w) have I helped out this newbie or led him astray? Would raise error have been better? The code to do this is trivial, would it be of any benefit to fix my code and post it? Or is there a much better tool to do this? Jeff
Help with InactiveDestroy attribute
I'm using the DBD::Pg driver for a system which will fork() and run in the background. The perldoc for DBI indicates that fork() messes up database handles, so one should set the InactiveDestroy attribute for database handles before forking. My problem is that even doing this, my system hangs or coredumps after the fork() call, on the first attempt to query the database. There's some confusion on my part as to whether one should set the attribute to 1 or 0; I've tried both without noticible difference. The only thing that's worked so far is to reconnect each handle after the fork, in the child process (the main process exits after forking, which is closing the handles). Part of the difficulty here is that the handles are buried deep inside database layer abstraction objects, so it irks me that I have to call something in my database-connection package to fiddle with each handle. -- Jeff Boes vox 616.226.9550 Database Engineer fax 616.349.9076 Nexcerpt, Inc. [EMAIL PROTECTED]
RE: Problems Running from crontab.
You can do this nice little Perl trick: BEGIN { if ($ENV{LD_LIBRARY_PATH} !~ /oracle.*lib/) { $ENV{LD_LIBRARY_PATH} = '/oracle/8.0.5/lib'; exec($^X, $0, @ARGV); } } or something similar (e.g., we use a package that appends to LD_LIBRARY_PATH if the value isn't already in it). The exec piece executes your Perl script exactly as you did, using the same Perl interpreter. Steve Sapovits Global Sports Interactive Work Email: [EMAIL PROTECTED] Home Email: [EMAIL PROTECTED] Work Phone: 610-491-7087 Cell: 610-574-7706 Pager: 877-239-4003 -Original Message- From: Scott T. Hildreth [SMTP:[EMAIL PROTECTED]] Sent: Monday, July 02, 2001 2:44 PM To: Scott T. Hildreth Cc: [EMAIL PROTECTED] Subject: RE: Problems Running from crontab. I fixed it by setting the 'SHELL=/usr/local/bin/zsh' so the LD_LIBRARY_PATH is getting set before Perl is executed. I'm not sure why the behavior changed, but it works :-) On 02-Jul-01 Scott T. Hildreth wrote: I wonder if anyone has run into this problem. I upgrade on of our production servers to perl5.6.1, DBI-1.18, and using DBD::Oracle 1.06. I was using DBD::Oracle 1.07, but I went back to 1.06 to see if that is the problem. Anyway I have jobs that run in cron, in the past if I set the %ENV Vars, everything ran okay. since I update the Perl and DBI the following error occurs, install_driver(Oracle) failed: Can't load '/usr/local/lib/perl5/site_perl/5.6.1/i686-linux/auto/DBD/Oracle/Oracle.so ' for module DBD::Oracle: libclntsh.so.1.0: cannot open shared object file: No such file or directory at /usr/local/lib/perl5/5.6.1/i686-linux/DynaLoader.pm line 206. ..It will run from command line, because it is getting the env from the shell, but not cron. The %ENV vars are set as, $ENV{ORACLE_SID} = $ARGV[0]; $ENV{ORACLE_HOME} = '/oracle/8.0.5'; $ENV{LD_LIBRARY_PATH} = '/oracle/8.0.5/lib'; which worked until the updates. Does anyone know if this a problem with Perl5.6.1 or DBI-1.18? Thanks, STH -- E-Mail: Scott T. Hildreth [EMAIL PROTECTED] Date: 02-Jul-01 Time: 12:14:12 -- -- E-Mail: Scott T. Hildreth [EMAIL PROTECTED] Date: 02-Jul-01 Time: 13:40:59 --
Mysql DBI Select Syntax ?
Dear All, my $dbh = DBI-connect(DBI:mysql:x,,, {RaiseError = 1 }); my $sth = $dbh-prepare( qq{ CREATE TABLE $table_name ( diploma ENUM(junior_high,senior_high,junior_college,university,master,doc tor) }); When I do the following procedure my $dbh = DBI-connect(DBI:mysql:x,,, { RaiseError = 1 }); my $sth = $dbh-prepare( qq{SELECT *FROM $table_nameWHERE diploma = 2}); $sth-execute; my $diploma = $sth - fetchrow_array ; $dbh-disconnect; I can get $diploma = senior_high Now here is my problem , How could I get the value of the $diploma = 2 ? I'll really appreciated if someone can help me.
DBD::_::db::type_info() slow
Hi! While testing an application that generates SQL based on data extracted from a database, I noticed that almost 80% of the runtime was being consumed by DBI::db::quote(). A significant portion of that was in DBD::_::db::type_info(). By caching the results of type_info_all(), which type_info() calls repeatedly, and by memoizing type_info() itself, I was able to speed it up 5x or so. I have appended the diffs to this message. (I don't know if defining new db handle attributes willy-nilly is the best way to cache these values, but it's the best thing I could think of.) -Dean Kopesky / Bridge Information Systems / [EMAIL PROTECTED] *** DBI.pm Mon Jun 4 14:01:39 2001 --- DBI.pm.2Mon Jul 2 13:07:53 2001 *** *** 1070,1079 sub type_info { my ($dbh, $data_type) = @_; - my $tia = $dbh-type_info_all; - return unless @$tia; - my $idx_hash = shift @$tia; my $dt_idx = $idx_hash-{DATA_TYPE} || $idx_hash-{data_type}; Carp::croak(type_info_all returned non-standard DATA_TYPE index value ($dt_idx != 1)) if $dt_idx $dt_idx != 1; --- 1070,1087 sub type_info { my ($dbh, $data_type) = @_; + my $ti_cache = $dbh-{'TypeInfoCache'}; + my $tia = $dbh-{'TypeInfoAllCache'}; + my $idx_hash = $dbh-{'IdxHashCache'}; + + if ( ! $idx_hash ) { + $dbh-{'TypeInfoCache'}= $ti_cache = {}; + $dbh-{'TypeInfoAllCache'} = $tia = $dbh-type_info_all; + $dbh-{'IdxHashCache'} = $idx_hash = shift @$tia; + } + return unless $idx_hash; + my $dt_idx = $idx_hash-{DATA_TYPE} || $idx_hash-{data_type}; Carp::croak(type_info_all returned non-standard DATA_TYPE index value ($dt_idx != 1)) if $dt_idx $dt_idx != 1; *** *** 1082,1087 --- 1090,1099 my @ti; my @data_type_list = (ref $data_type) ? @$data_type : ($data_type); foreach $data_type (@data_type_list) { + if ( exists $ti_cache-{$data_type} ) { + return $ti_cache-{$data_type}-[0] unless wantarray; + return @{$ti_cache-{$data_type}}; + } if (defined($data_type) $data_type != DBI::SQL_ALL_TYPES()) { push @ti, grep { $_-[$dt_idx] == $data_type } @$tia; } *** *** 1100,1105 --- 1112,1120 my @out = map { my %h; @h{@idx_names} = @{$_}[ @idx_values ]; \%h; } @ti; + + $ti_cache-{$data_type} = \@out; + return $out[0] unless wantarray; return @out; }
Re: Oracle, perl DBI under debian
Thanks Ilya but to put it simpler: Where can I find those Oracle client libs? Ciao Vittorio Sterin, Ilya [02/07/01 09:34 -0600]: -Original Message- From: Vittorio To: [EMAIL PROTECTED] Sent: 07/02/2001 11:28 AM Subject: Re: Oracle, perl DBI under debian Victor [02/07/01 17:01 +]: Willing to use my laptop as a client of an oracle DB on an NT server and network, to start with I've just begun to read the book by Alligator Descartes and Tim Bunce Programming the Perl DBI. Being at my very first steps on this field there's something somewhat obscure to me and I wonder if someone could answer this easy question of mine: To use perl and DBI:oracle do I need to install perl and the DBI stuff for oracle from the DBI site only If you read the book, it actually explains this pretty good IMO. You need perl (of course :-) as well as DBI and DBD::Oracle from www.cpan.org OR perl, the DBI stuff for oracle and A SERVER (PROPRIETARY) CLIENT FOR ORACLE? You must have the Oracle client libs installed before you can compile DBD::Oracle. Ilya Thanks Vittorio
RE: MSSQL 'text' problem with DBI
Set LongReadLen and possibly LongTruncOk. It's all in the docs. Ilya -Original Message- From: Venkataramana Mokkapati [mailto:[EMAIL PROTECTED]] Sent: Monday, July 02, 2001 7:51 PM To: [EMAIL PROTECTED] Subject: MSSQL 'text' problem with DBI DBI does NOT seem to work with MSSQL type 'text'. name varchar(50) desc text/16 if I do select * from tab I get a string truncation error. If I change desc text/16 to varchar 5000 the problem goes away. Is this a known issue? Any workaround? Thanks, MVRamana _ Get your FREE download of MSN Explorer at http://explorer.msn.com
RE: Mysql DBI Select Syntax ?
I'm not completely sure I know what you're asking. If you're wanting to put a numerical equivalent to the possible string values, in MySQL you can use a CASE statement, like this: SELECT case WHEN diploma = 'junior_high' THEN 1 WHEN diploma = 'senior_high' THEN 2 WHEN diploma = 'junior_college' THEN 3 WHEN diploma = 'university' THEN 4 WHEN diploma = 'master' THEN 5 ELSE 6 END AS DIPLOMA FROM Tablename You can embed some version of that to get a numerical return from a table enumerated as you have said, however, it still shouldn't return as you have put in your WHERE clause. You would still have to use: WHERE diploma = 'senior_high' If you only wanted Senior high grads. Is this what you are asking? Steve Howard -Original Message- From: About-tw.com ?? [mailto:[EMAIL PROTECTED]] Sent: Monday, July 02, 2001 3:16 PM To: [EMAIL PROTECTED] Subject: Mysql DBI Select Syntax ? Dear All, my $dbh = DBI-connect(DBI:mysql:x,,, {RaiseError = 1 }); my $sth = $dbh-prepare( qq{ CREATE TABLE $table_name ( diploma ENUM(junior_high,senior_high,junior_college,university,master,doc tor) }); When I do the following procedure my $dbh = DBI-connect(DBI:mysql:x,,, { RaiseError = 1 }); my $sth = $dbh-prepare( qq{SELECT *FROM $table_nameWHERE diploma = 2}); $sth-execute; my $diploma = $sth - fetchrow_array ; $dbh-disconnect; I can get $diploma = senior_high Now here is my problem , How could I get the value of the $diploma = 2 ? I'll really appreciated if someone can help me.