Re: [DBI] DBD::SQLite
On Fri, 20 Aug 2004, Scott T. Hildreth wrote: > Anybody else having problems compiling DBD-SQLite-1.03? Yes, I'm having this problem too. I'm using Perl 5.8.0 on FreeBSD 4.7, with DBI 1.43. My gcc is 2.95.4. My make failure is almost exactly the same, but not quite: cc -c -I/usr/local/lib/perl5/site_perl/5.8.0/i386-freebsd/auto/DBI -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -I/usr/local/include -O6 -DNDEBUG=1 -DSQLITE_PTR_SZ=4 -DVERSION=\"1.03\" -DXS_VERSION=\"1.03\" -DPIC -fpic "-I/usr/local/lib/perl5/5.8.0/i386-freebsd/CORE" dbdimp.c dbdimp.c:24: warning: #warning "No vararg macros - using trace without line numbers" dbdimp.c: In function `sqlite_st_execute': dbdimp.c:323: syntax error before `*' dbdimp.c:327: `sql_type' undeclared (first use in this function) dbdimp.c:327: (Each undeclared identifier is reported only once dbdimp.c:327: for each function it appears in.) dbdimp.c:327: `value' undeclared (first use in this function) *** Error code 1 Stop in /usr/local/src/perl/DBD-SQLite-1.03. > On Fri, 2004-08-20 at 11:22, Scott T. Hildreth wrote: > > Hello Matt, > > > >I've been trying to compile DBD-SQLite-1.03 and I get the error, > > > > dbdimp.c:24:4: warning: #warning "No vararg macros - using trace without > > line numbers" > > dbdimp.c: In function `sqlite_st_execute': > > dbdimp.c:323: parse error before `*' > > dbdimp.c:327: `sql_type' undeclared (first use in this function) > > dbdimp.c:327: (Each undeclared identifier is reported only once > > dbdimp.c:327: for each function it appears in.) > > > > lared (first use in this function) > > make: *** [dbdimp.o] Error 1 > > > > ..should this be declared in dbdimp.h ? Is this a gcc version > > issue? My gcc's are 2.95.4 & 2.96. > > > > ...okay just got another error with gcc 3.3.1 on a suse box, > > > > dbdimp.c:231: error: conflicting types for `sqlite_db_last_insert_id' > > /usr/local/lib/perl5/site_perl/5.8.3/i686-linux/auto/DBI/dbd_xsh.h:36: > > error: previous declaration of `sqlite_db_last_insert_id' > > make: *** [dbdimp.o] Error 1 Thanks, Dave /L\_/E\_/A\_/R\_/N\_/T\_/E\_/A\_/C\_/H\_/L\_/E\_/A\_/R\_/N\ Dave Cash Power to the People! Frolicking in Fields of Garlic Right On-Line! [EMAIL PROTECTED] Dig it all.
Re: [DBI] DBD::SQLite
Apply this patch.. --- dbdimp.c.orgMon Aug 23 06:56:11 2004 +++ dbdimp.cMon Aug 23 06:56:24 2004 @@ -319,11 +319,11 @@ } for (i = 0; i < num_params; i++) { -sqlite_trace(4, "params left in 0x%p: %d", imp_sth->params,\ 1+av_len(imp_sth->params)); SV *value = av_shift(imp_sth->params); SV *sql_type_sv = av_shift(imp_sth->params); int sql_type = SvIV(sql_type_sv); +sqlite_trace(4, "params left in 0x%p: %d", imp_sth->params,\ 1+av_len(imp_sth->params)); sqlite_trace(4, "bind %d type %d as %s", i, sql_type, SvPV_nolen(value)); if (!SvOK(value)) { sqlite_trace(5, "binding null"); On Mon, 2004-08-23 at 05:03, Dave Cash wrote: > On Fri, 20 Aug 2004, Scott T. Hildreth wrote: > > > Anybody else having problems compiling DBD-SQLite-1.03? > > Yes, I'm having this problem too. I'm using Perl 5.8.0 on FreeBSD > 4.7, with DBI 1.43. My gcc is 2.95.4. > > My make failure is almost exactly the same, but not quite: > > cc -c -I/usr/local/lib/perl5/site_perl/5.8.0/i386-freebsd/auto/DBI > -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing > -I/usr/local/include -O6 -DNDEBUG=1 -DSQLITE_PTR_SZ=4 > -DVERSION=\"1.03\" -DXS_VERSION=\"1.03\" -DPIC -fpic > "-I/usr/local/lib/perl5/5.8.0/i386-freebsd/CORE" dbdimp.c > > dbdimp.c:24: warning: #warning "No vararg macros - using trace > without line numbers" > dbdimp.c: In function `sqlite_st_execute': > dbdimp.c:323: syntax error before `*' > dbdimp.c:327: `sql_type' undeclared (first use in this function) > dbdimp.c:327: (Each undeclared identifier is reported only once > dbdimp.c:327: for each function it appears in.) > dbdimp.c:327: `value' undeclared (first use in this function) > *** Error code 1 > > Stop in /usr/local/src/perl/DBD-SQLite-1.03. > > > > On Fri, 2004-08-20 at 11:22, Scott T. Hildreth wrote: > > > Hello Matt, > > > > > >I've been trying to compile DBD-SQLite-1.03 and I get the error, > > > > > > dbdimp.c:24:4: warning: #warning "No vararg macros - using trace without > > > line numbers" > > > dbdimp.c: In function `sqlite_st_execute': > > > dbdimp.c:323: parse error before `*' > > > dbdimp.c:327: `sql_type' undeclared (first use in this function) > > > dbdimp.c:327: (Each undeclared identifier is reported only once > > > dbdimp.c:327: for each function it appears in.) > > > > > > lared (first use in this function) > > > make: *** [dbdimp.o] Error 1 > > > > > > ..should this be declared in dbdimp.h ? Is this a gcc version > > > issue? My gcc's are 2.95.4 & 2.96. > > > > > > ...okay just got another error with gcc 3.3.1 on a suse box, > > > > > > dbdimp.c:231: error: conflicting types for `sqlite_db_last_insert_id' > > > /usr/local/lib/perl5/site_perl/5.8.3/i686-linux/auto/DBI/dbd_xsh.h:36: > > > error: previous declaration of `sqlite_db_last_insert_id' > > > make: *** [dbdimp.o] Error 1 > > Thanks, > > Dave > > /L\_/E\_/A\_/R\_/N\_/T\_/E\_/A\_/C\_/H\_/L\_/E\_/A\_/R\_/N\ > Dave Cash Power to the People! > Frolicking in Fields of Garlic Right On-Line! > [EMAIL PROTECTED] Dig it all.
DBD:Oracle (1.15 and 1.16 rc1) and xmltype()
I am using the following: $sth = $dbh->prepare("insert into parsed_dtlogs (id,service_name,xml_doc) values ($item,'".$service_save."',xmltype(?))") or die "Can't prepare SQL statement: $DBI::errstr\n"; $sth->bind_param(1,$xml,ORA_CLOB); $sth->execute() or die "Can't execute SQL statement: $DBI::errstr\n"; to try and insert an XML document into an xmltype column in oracle. If $xml is small (say, "this indicator at char 70 in'insert into parsed_dtlogs (id,service_name,xml_doc) values (54,'test',<*>xmltype(:p1))') [for Statement "insert into parsed_dtlogs (id,service_name,xml_doc) values (54,'test',xmltype(?))" with ParamValues: :p1=' BF-webservershttp-webservers Wed Aug 18 18:46:27 2004 Wed Aug 18 18:48:08 2004 1 minute, 41 seconds 1011 minute, 0 seconds locate.corporate-eye.co.uk locate.locateyou.co.uk www.corporate-eye.co.uk
Re: DBD:Oracle (1.15 and 1.16 rc1) and xmltype()
Hello Thomas, LOBs are defined to be possibly very large. So you should use ora_lob_write. You should to something like this: my $sth = $db->prepare( <<" SQL" ) or die "insert $DBI::errstr"; INSERT INTO clob ( id, txt ) VALUES ( ?, empty_clob() ) SQL $sth->execute( $lob_id ) or die "execute insert $DBI::errstr"; $sth = $db->prepare( <<" SQL", { ora_auto_lob => 0 } ) or die "prepare select $DBI::errstr"; SELECT txt FROM clob WHERE id = ? FOR UPDATE SQL $sth->execute( $lob_id ) or die "execute select $DBI::errstr"; my ( $bin_locator ) = $sth->fetchrow_array() or die "fetch select $DBI::errstr"; $sth->finish(); open FH, $ARGV[1] or die "open"; my $chunk_size = 4096; # Arbitrary chunk size # BEGIN WRITING BIN_DATA COLUMN my $offset = 1; # Offsets start at 1, not 0 my $length = 0; my $buffer = ''; while( $length = read( FH, $buffer, $chunk_size ) ) { $db->ora_lob_write( $bin_locator, $offset, $buffer ); $offset += $length; } close FH; } Monday, August 23, 2004, 2:26:20 PM, you wrote: TC> I am using the following: $sth = $dbh->>prepare("insert into parsed_dtlogs $sth = $dbh->>(id,service_name,xml_doc) TC> values ($item,'".$service_save."',xmltype(?))") or die "Can't prepare SQL TC> statement: $DBI::errstr\n"; $sth->>bind_param(1,$xml,ORA_CLOB); $sth->>execute() or die "Can't execute SQL statement: $DBI::errstr\n"; cu Wielandmailto:[EMAIL PROTECTED]
Re: DBD:Oracle (1.15 and 1.16 rc1) and xmltype()
On Monday 23 Aug 2004 14:45 pm, Wieland Pusch wrote: > LOBs are defined to be possibly very large. So you should use > ora_lob_write. > You should to something like this: It would be nice to have DBD/DBI just work though :-) In the end, I create an extra CLOB column, inserted into that, and then just: update parsed_dtlogs set xml_doc=xmltype(xml_clob) -- Tom Chiverton Advanced ColdFusion Programmer Tel: +44(0)1749 834997 email: [EMAIL PROTECTED] BlueFinger Limited Underwood Business Park Wookey Hole Road, WELLS. BA5 1AF Tel: +44 (0)1749 834900 Fax: +44 (0)1749 834901 web: www.bluefinger.com Company Reg No: 4209395 Registered Office: 2 Temple Back East, Temple Quay, BRISTOL. BS1 6EG. *** This E-mail contains confidential information for the addressee only. If you are not the intended recipient, please notify us immediately. You should not use, disclose, distribute or copy this communication if received in error. No binding contract will result from this e-mail until such time as a written document is signed on behalf of the company. BlueFinger Limited cannot accept responsibility for the completeness or accuracy of this message as it has been transmitted over public networks.***
Error logs for DBI
How do I create log files with just errors?
RE: Error logs for DBI
perldoc open perldoc print perldoc DBI - Ron Reidy Senior DBA Array BioPharma, Inc. -Original Message- From: Joel West [mailto:[EMAIL PROTECTED] Sent: Monday, August 23, 2004 9:38 AM To: [EMAIL PROTECTED] Subject: Error logs for DBI How do I create log files with just errors? This electronic message transmission is a PRIVATE communication which contains information which may be confidential or privileged. The information is intended to be for the use of the individual or entity named above. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. Please notify the sender of the delivery error by replying to this message, or notify us by telephone (877-633-2436, ext. 0), and then delete it from your system.
unsuscribed
unsuscribed = WARNING The information in this e-mail and in any attachment is confidential and intended solely for the attention and use of the named addresse(s). It must therefore not be disclosed to any person without our previous authorization. If you are not the intended recipient or a person responsible for delivering it to the intended recipient you are not authorized to and must not disclose, copy, distribute or retain this message or any part of it and you are requested to notify the sender immediately. Electronic messages may be altered. Aguas Provinciales de Santa Fe S.A. shall therefore accept no liability whatsoever and howsoever resulting from this message if it has been changed, distorted or falsified. = ADVERTENCIA La información contenida en este mensaje y cualquier archivo anexo al mismo es confidencial y dirigida exclusivamente para su utilización y aplicación por los destinatarios consignados. En consecuencia, no debe ser divulgada a ninguna persona sin autorización previa. Si no es uno de los destinatarios consignados o la persona responsable de hacer llegar este mensaje a los destinatarios consignados, Usted no está autorizado a divulgar, copiar, distribuir o retener la información (o parte de ella) contenida en este mensaje, y se lo insta a notificar al remitente inmediatamente. Los mensajes electrónicos pueden ser alterados. En consecuencia, Aguas Provinciales de Santa Fe S.A. no aceptará ninguna obligación cualquiera sea el resultante de este mensaje en caso de haber sido modificado, distorsionado o falsificado. =
RE: Error logs for DBI
Thank you ... And having done so I am still having the problem I was earlier. How do I create an error log for a perl DBI script. On Mon, 23 Aug 2004, Reidy, Ron wrote: perldoc open perldoc print perldoc DBI - Ron Reidy Senior DBA Array BioPharma, Inc. -Original Message- From: Joel West [mailto:[EMAIL PROTECTED] Sent: Monday, August 23, 2004 9:38 AM To: [EMAIL PROTECTED] Subject: Error logs for DBI How do I create log files with just errors? This electronic message transmission is a PRIVATE communication which contains information which may be confidential or privileged. The information is intended to be for the use of the individual or entity named above. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. Please notify the sender of the delivery error by replying to this message, or notify us by telephone (877-633-2436, ext. 0), and then delete it from your system.
Re: DBD:Oracle (1.15 and 1.16 rc1) and xmltype()
On Mon, Aug 23, 2004 at 04:07:52PM +0100, Thomas Chiverton wrote: > On Monday 23 Aug 2004 14:45 pm, Wieland Pusch wrote: > > LOBs are defined to be possibly very large. So you should use > > ora_lob_write. > > You should to something like this: > > It would be nice to have DBD/DBI just work though :-) Send me a patch to t/31lob.t that tests the functionality you want and I'll try to sort it out for you. Tim.
RE: Error logs for DBI
So what exactly don't you understand? Disclaimer: NOT TESTED! $SIG{__DIE__} = sub { print LOG "@_\n"; }; open(LOG,">>$fname") || die $!; $dbi = DBI->connect(...) || die $DBI::ERRSTR; $sth = $dbh->prepare("select * from xxx") || die $DBI::errstr; $sth->execute; ... close(LOG) || warn "file I/O error writing to log: $!"; Or instead of opening a file, you could change the above and eliminate the signal handler ($SIG) and the open() and close() statements, and just capture output from STDOUT to a file: ./file.pl | tee -a err.log - Ron Reidy Senior DBA Array BioPharma, Inc. -Original Message- From: Joel West [mailto:[EMAIL PROTECTED] Sent: Monday, August 23, 2004 10:07 AM To: Reidy, Ron Cc: [EMAIL PROTECTED] Subject: RE: Error logs for DBI Thank you ... And having done so I am still having the problem I was earlier. How do I create an error log for a perl DBI script. On Mon, 23 Aug 2004, Reidy, Ron wrote: > perldoc open > perldoc print > perldoc DBI > > - > Ron Reidy > Senior DBA > Array BioPharma, Inc. > > > -Original Message- > From: Joel West [mailto:[EMAIL PROTECTED] > Sent: Monday, August 23, 2004 9:38 AM > To: [EMAIL PROTECTED] > Subject: Error logs for DBI > > > How do I create log files with just errors? > > > > This electronic message transmission is a PRIVATE communication which contains > information which may be confidential or privileged. The information is intended > to be for the use of the individual or entity named above. If you are not the > intended recipient, please be aware that any disclosure, copying, distribution > or use of the contents of this information is prohibited. Please notify the > sender of the delivery error by replying to this message, or notify us by > telephone (877-633-2436, ext. 0), and then delete it from your system. > > This electronic message transmission is a PRIVATE communication which contains information which may be confidential or privileged. The information is intended to be for the use of the individual or entity named above. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. Please notify the sender of the delivery error by replying to this message, or notify us by telephone (877-633-2436, ext. 0), and then delete it from your system.
Re: DBD:Oracle (1.15 and 1.16 rc1) and xmltype()
On Monday 23 Aug 2004 17:11 pm, you said: > Send me a patch to t/31lob.t that tests the functionality you want > and I'll try to sort it out for you. What would be the best way of including a large text string here ? Just inline would make it very messy... As far as I can see, there is no test for inserting into XMLtype() at all, and in any case I'm not sure weather the intended functionality would be support xmltype() cast in the select statement, or have DBD::Oracle notice it was an insert into an xmltype column and use CLOB rather than LONG. Thoughts ? FYI the extra steps would be: $dbh->do(qq{ CREATE TABLE $table_2 ( id INTEGER NOT NULL, data xmltype ) }); $stmt = "INSERT INTO $table (id,date) VALUES (1, xmltype(?))"; // or $stmt = "INSERT INTO $table (id,date) VALUES (1, ?)"; ??? $sth = $dbh->prepare($stmt); $sth->execute($6k_of_xml); //this will fail with an error about LONG insert, currently... $dbh->do("DROP TABLE $table_2"); -- Tom Chiverton Advanced ColdFusion Programmer Tel: +44(0)1749 834997 email: [EMAIL PROTECTED] BlueFinger Limited Underwood Business Park Wookey Hole Road, WELLS. BA5 1AF Tel: +44 (0)1749 834900 Fax: +44 (0)1749 834901 web: www.bluefinger.com Company Reg No: 4209395 Registered Office: 2 Temple Back East, Temple Quay, BRISTOL. BS1 6EG. *** This E-mail contains confidential information for the addressee only. If you are not the intended recipient, please notify us immediately. You should not use, disclose, distribute or copy this communication if received in error. No binding contract will result from this e-mail until such time as a written document is signed on behalf of the company. BlueFinger Limited cannot accept responsibility for the completeness or accuracy of this message as it has been transmitted over public networks.***
RE: Error logs for DBI
That helps!!! Merci bien On Mon, 23 Aug 2004, Reidy, Ron wrote: So what exactly don't you understand? Disclaimer: NOT TESTED! $SIG{__DIE__} = sub { print LOG "@_\n"; }; open(LOG,">>$fname") || die $!; $dbi = DBI->connect(...) || die $DBI::ERRSTR; $sth = $dbh->prepare("select * from xxx") || die $DBI::errstr; $sth->execute; ... close(LOG) || warn "file I/O error writing to log: $!"; Or instead of opening a file, you could change the above and eliminate the signal handler ($SIG) and the open() and close() statements, and just capture output from STDOUT to a file: ./file.pl | tee -a err.log - Ron Reidy Senior DBA Array BioPharma, Inc. -Original Message- From: Joel West [mailto:[EMAIL PROTECTED] Sent: Monday, August 23, 2004 10:07 AM To: Reidy, Ron Cc: [EMAIL PROTECTED] Subject: RE: Error logs for DBI Thank you ... And having done so I am still having the problem I was earlier. How do I create an error log for a perl DBI script. On Mon, 23 Aug 2004, Reidy, Ron wrote: perldoc open perldoc print perldoc DBI - Ron Reidy Senior DBA Array BioPharma, Inc. -Original Message- From: Joel West [mailto:[EMAIL PROTECTED] Sent: Monday, August 23, 2004 9:38 AM To: [EMAIL PROTECTED] Subject: Error logs for DBI How do I create log files with just errors? This electronic message transmission is a PRIVATE communication which contains information which may be confidential or privileged. The information is intended to be for the use of the individual or entity named above. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. Please notify the sender of the delivery error by replying to this message, or notify us by telephone (877-633-2436, ext. 0), and then delete it from your system. This electronic message transmission is a PRIVATE communication which contains information which may be confidential or privileged. The information is intended to be for the use of the individual or entity named above. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. Please notify the sender of the delivery error by replying to this message, or notify us by telephone (877-633-2436, ext. 0), and then delete it from your system.
RE: Error logs for DBI
I could be mistaken since I haven't used Apache on Linux in a while, but don't cgi prints to STDERR by default go to the Apache error log?? Hardy Merrill >>> "Reidy, Ron" <[EMAIL PROTECTED]> 08/23/04 12:13PM >>> So what exactly don't you understand? Disclaimer: NOT TESTED! $SIG{__DIE__} = sub { print LOG "@_\n"; }; open(LOG,">>$fname") || die $!; $dbi = DBI->connect(...) || die $DBI::ERRSTR; $sth = $dbh->prepare("select * from xxx") || die $DBI::errstr; $sth->execute; ... close(LOG) || warn "file I/O error writing to log: $!"; Or instead of opening a file, you could change the above and eliminate the signal handler ($SIG) and the open() and close() statements, and just capture output from STDOUT to a file: ./file.pl | tee -a err.log - Ron Reidy Senior DBA Array BioPharma, Inc. -Original Message- From: Joel West [mailto:[EMAIL PROTECTED] Sent: Monday, August 23, 2004 10:07 AM To: Reidy, Ron Cc: [EMAIL PROTECTED] Subject: RE: Error logs for DBI Thank you ... And having done so I am still having the problem I was earlier. How do I create an error log for a perl DBI script. On Mon, 23 Aug 2004, Reidy, Ron wrote: > perldoc open > perldoc print > perldoc DBI > > - > Ron Reidy > Senior DBA > Array BioPharma, Inc. > > > -Original Message- > From: Joel West [mailto:[EMAIL PROTECTED] > Sent: Monday, August 23, 2004 9:38 AM > To: [EMAIL PROTECTED] > Subject: Error logs for DBI > > > How do I create log files with just errors? > > > > This electronic message transmission is a PRIVATE communication which contains > information which may be confidential or privileged. The information is intended > to be for the use of the individual or entity named above. If you are not the > intended recipient, please be aware that any disclosure, copying, distribution > or use of the contents of this information is prohibited. Please notify the > sender of the delivery error by replying to this message, or notify us by > telephone (877-633-2436, ext. 0), and then delete it from your system. > > This electronic message transmission is a PRIVATE communication which contains information which may be confidential or privileged. The information is intended to be for the use of the individual or entity named above. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. Please notify the sender of the delivery error by replying to this message, or notify us by telephone (877-633-2436, ext. 0), and then delete it from your system.
Sighs
Okay I am running DBI and if the query doesnt work I want to write the data from the to one file and the error to another: E.g. my $sth; $sth = $dbh->prepare (qq(insert into $table (RecordNum, Src_File, Src_Line, MSW_ID, Status, Status_Desc, Last_Modified, Processed, Date_Time, Date_Time_Int, Duration, Orig_IP, Source_Q931_Port, Term_IP, User_ID, Call_E164, Call_DTMF, Call_Type, Disc_Code, Err_Type, Err_Desc, ANI, Seq_Num, Call_ID, Hold_Time, Orig_GW, Orig_Port, Term_GW, Term_Port, ISDN_Code, Last_Call_Number, Err2_Type, Err2_Desc, Last_Event, New_ANI, Region_Code, Created) values ('$data[0]','$data[1]','$data[2]','$data[3]','$data[4]','$data[5]','$data[6]','$data[7]','$data[8]','$data[9]','$data[10]','$data[11]','$data[12]','$data[13]','$data[14]','$data[15]','$data[16]','$data[17]','$data[18]','$data[19]','$data[20]','$data[21]','$data[22]','$data[23]','$data[24]','$data[25]','$data[26]','$data[27]','$data[28]','$data[29]','$data[30]','$data[31]','$data[32]','$data[33]','$data[34]','$data[35]','$data[36]'))); $sth->execute(); And if it doesnt work write all the $data[]s to one file and why it didnt work to another.
RE: New info on an old Thread: Selecting a record from a table wh ere a column might be null
I couldn't find any mention of NVL in my older Informix books (not surprising). But I couldn't find any mention of it in the current online docs either. However, you are right. I tried NVL on our Informix server, and it does accept the function, and it does appear to work as expected. -Original Message- From: Priest, Darryl - BALTO [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 18, 2004 5:52 AM To: CAMPBELL, BRIAN D (BRIAN) Subject: RE: New info on an old Thread: Selecting a record from a table wh ere a column might be null Not that it really changes your end solution, but nvl, and a few other "Oracle" functions have been available in Informix for quite a while now, certainly back to version 7.31. HTH, -Darryl Brian Campbell.vcf Description: Binary data
RE: New info on an old Thread: Selecting a record from a table wh ere a column might be null
I found NVL in the March 2003 version of "IBM Informix Guide to SQL:Syntax" page 4-92 Terry Maragakis Database Administrator The Inteq Group Inc. 5445 La Sierra Dr. Suite 400 Dallas, TX 75231 214-739-9494 214-739-7979 Fax [EMAIL PROTECTED] www.inteqrx.com IMPORTANT: This message is intended only for the use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under federal or state law. If you received this communication in error, please destroy and notify the sender by return message or call our Privacy Administrator at 800-324-7799. -Original Message- From: CAMPBELL, BRIAN D (BRIAN) [mailto:[EMAIL PROTECTED] Sent: Monday, August 23, 2004 12:08 PM To: 'Priest, Darryl - BALTO' Cc: [EMAIL PROTECTED] Subject: RE: New info on an old Thread: Selecting a record from a table wh ere a column might be null I couldn't find any mention of NVL in my older Informix books (not surprising). But I couldn't find any mention of it in the current online docs either. However, you are right. I tried NVL on our Informix server, and it does accept the function, and it does appear to work as expected. -Original Message- From: Priest, Darryl - BALTO [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 18, 2004 5:52 AM To: CAMPBELL, BRIAN D (BRIAN) Subject: RE: New info on an old Thread: Selecting a record from a table wh ere a column might be null Not that it really changes your end solution, but nvl, and a few other "Oracle" functions have been available in Informix for quite a while now, certainly back to version 7.31. HTH, -Darryl
RE: New info on an old Thread: Selecting a record from a table wh ere a column might be null
I see now that the documents on the IBM web page for which I had a bookmark were dated 3/97. I clicked around and found another page with newer versions of the documents (e.g. 3/2003 for the Syntax Guide). -Original Message- From: Terry Maragakis [mailto:[EMAIL PROTECTED] Sent: Monday, August 23, 2004 10:14 AM I found NVL in the March 2003 version of "IBM Informix Guide to SQL:Syntax" page 4-92 -Original Message- From: CAMPBELL, BRIAN D (BRIAN) [mailto:[EMAIL PROTECTED] Sent: Monday, August 23, 2004 12:08 PM I couldn't find any mention of NVL in my older Informix books (not surprising). But I couldn't find any mention of it in the current online docs either. However, you are right. I tried NVL on our Informix server, and it does accept the function, and it does appear to work as expected. Brian Campbell.vcf Description: Binary data
How hard would it be for DBI to export a hash of data def's?
For example "neat" (see below for perldoc) 'knows' if a string is numeric or char in the database. If I could get a hash keyed by $sth->{NAME} that had, say, DBD-specific metadata it'd help quite a bit on handling some error situaions. One use is returning a copy of the query with placeholders filled in for cut+paste troubleshooting; another is pretty-printing results where numeric sequences stored as strings need to be quoted for further use (i.e., /^\d+$/ is not a good enough test for quotishness when Perl gets all the data back as strings). If whatever neat uses were exported -- perhaps in DBD-specific fashion to accomodate varying levels of metadata available in the different databases -- it'd sure help... "neat" $str = DBI::neat($value); $str = DBI::neat($value, $maxlen); Return a string containing a neat (and tidy) represen- tation of the supplied value. Strings will be quoted, although internal quotes will not be escaped. Values known to be numeric will be unquoted. Undefined (NULL) values will be shown as "undef" (without quotes). If the string is flagged internally as utf8 then dou- ble quotes will be used, otherwise single quotes are used and unprintable characters will be replaced by dot (.). For result strings longer than $maxlen the result string will be truncated to "$maxlen-4" and ""...'"" will be appended. If $maxlen is 0 or "undef", it defaults to $DBI::neat_maxlen which, in turn, defaults to 400. This function is designed to format values for human consumption. It is used internally by the DBI for "trace" output. It should typically not be used for formatting values for database use. (See also "quote".) -- Steven Lembark 85-09 90th Street Workhorse ComputingWoodhaven, NY 11421 [EMAIL PROTECTED] 1 888 359 3508
Re: Error logs for DBI
On Mon, Aug 23, 2004 at 12:06:38PM -0400, Joel West wrote: > Thank you ... > > And having done so I am still having the problem I was earlier. Actually, if you had you would have found that ``perldoc open'' give you a pragma and ``perldoc print'' does not work. You should check out: $ perldoc -f open $ perldoc -f print $ perldoc DBI If you like OOP: $ perldoc IO::File > How do I create an error log for a perl DBI script. Basically what you want to do is check the return status of all your DBI calls and if they return an error (false), then print errstr ($DBI::errstr for class methods, $dbh->errstr for db handle object methods, and $sth->errstr for statement handle object methods) to the error log file you opened previously with open. Alternatively, you could set the RaiseError option to the connect method to true and then set the die handler ($SIG{__DIE__}) to print the error message to the log file. The above perldoc commands can fill in the details if any of this is not clear. dd -- David Dooling
Re: Sighs
Joel Why not do something simple like this? (this code, of couse, is not tested ;>) open (ERR, '>someerror.log'); #this is teh error log open (DATA, '>somedata.log'); #this is the data log file my $sth = $dbh->prepare("Your query here"); eval { $sth->execute() || die $DBI::errstr; }; if ($@) { # error print ERR $@; # Prints error to the ERR file handle print DATA join("\,", [EMAIL PROTECTED]); # prints a csv line of the data array to the DATA file handle } else { # success } HTH Chris Joel West wrote: Okay I am running DBI and if the query doesnt work I want to write the data from the to one file and the error to another: E.g. my $sth; $sth = $dbh->prepare (qq(insert into $table (RecordNum, Src_File, Src_Line, MSW_ID, Status, Status_Desc, Last_Modified, Processed, Date_Time, Date_Time_Int, Duration, Orig_IP, Source_Q931_Port, Term_IP, User_ID, Call_E164, Call_DTMF, Call_Type, Disc_Code, Err_Type, Err_Desc, ANI, Seq_Num, Call_ID, Hold_Time, Orig_GW, Orig_Port, Term_GW, Term_Port, ISDN_Code, Last_Call_Number, Err2_Type, Err2_Desc, Last_Event, New_ANI, Region_Code, Created) values ('$data[0]','$data[1]','$data[2]','$data[3]','$data[4]','$data[5]','$data[6]','$data[7]','$data[8]','$data[9]','$data[10]','$data[11]','$data[12]','$data[13]','$data[14]','$data[15]','$data[16]','$data[17]','$data[18]','$data[19]','$data[20]','$data[21]','$data[22]','$data[23]','$data[24]','$data[25]','$data[26]','$data[27]','$data[28]','$data[29]','$data[30]','$data[31]','$data[32]','$data[33]','$data[34]','$data[35]','$data[36]'))); $sth->execute(); And if it doesnt work write all the $data[]s to one file and why it didnt work to another.
How to Install FTP.pm for Perl
hi there, I am an Oracle DBA and new to Perl. My perl software is v5.6.1 built for sun4-solaris-64int. I downloaded DBI-1.39.tar.gz and got it installed successfully. But one of my perl program also uses "use Net::FTP.pm", which causes an error: "Can't locate Net/ftp.pm in @INC". It looks like I don't have an FTP.pm module on my system. I ran "find / -name ftp.pm -print" and found only this: /opt/SUNWstade/lib/Net/ftp.pm So, my question is: how do I install the FTP.pm module on my system? Thank much in advance. Wen Q. Sun Database Administrator DIT/Agency Support Services email: [EMAIL PROTECTED] phone: (517) 241-3013
Re: ANNOUNCE: DBD::Oracle 1.16 release candidate 6 - request for testing
On Tue, Aug 10, 2004 at 03:16:42PM -0500, David wrote: > On Sat, Aug 07, 2004 at 11:32:45PM +0100, Tim Bunce wrote: > > A mature, and hopefully final, release candidate of DBD::Oracle 1.16 > > is available for testing at: > > > > http://homepage.eircom.net/~timbunce/DBD-Oracle-1.16-rc6-20040807.tar.gz > > Built and tested against DBI-1.43 on the following platforms (see below > for make test output): > > * sparc-solaris-5.8_perl5.8.3_orac9.2.0.4 [1] > * ia64-linux-2.4.25_perl5.8.3_orac9.2.0.2 [2] > * ia32-linux-2.4.24_perl5.8.3_orac9.2.0.1 [3] > > The server for all tests was ``Oracle9i Enterprise Edition Release > 9.2.0.4.0 - Production''. > > Configured and built fine. All tests passed. I have been unable to get the tests to pass against the Oracle 8.1 libraries. I was able to get rc6 to build and test fine against 9.2 libraries under ia32-linux and sparc-solaris for both perl5.6.1 and perl5.8.3. The 8.1 libraries had the same sorts of problems against both versions of Perl. Note that DBD-Oracle-1.15 compiles and tests successfully against all combinations of Oracle client and Perl version listed above. Below is a brief summary of the problems. For more information, including build and test logs and output from the failed tests (including DBI_TRACE=9 output) see: http://genome.wustl.edu/~ddooling/dbd-oracle/ Test failure summary: ia32-linux 21nchar 22nchar_al32utf8 22nchar_utf8 24implicit_utf8 these tests just hung (no CPU usage, no DB activity) and had to be killed 23wide_db 23wide_db_al32utf8 failed to connect to the database (reported earlier by mAmsterdam http://www.nntp.perl.org/group/perl.dbi.users/23674) 30long this test started spun its wheels (99%+ CPU usage with no DB activity) until it was killed sparc-solaris 21nchar 22nchar_al32utf8 22nchar_utf8 24implicit_utf8 failed but did not hang like on ia32-linux, got ORA-03113: end-of-file on communication channel 23wide_db 23wide_db_al32utf8 same as on ia32-linux (see above) 30long same as on ia32-linux (see above) Hope this helps (and is not too late). dd -- David Dooling
Re: How to Install FTP.pm for Perl
You missed all the dependencies of DBI. CPAN is your friend. Download and install CPAN-1.76_01.tar.gz the same way you got and installed DBI (tar xvfz, perl Makefile.PL, make, make test, make install). Then, # perl -MCPAN -e shell; You probably want to cpan> install Bundle::CPAN next, and let it install all its dependencies. After that, the command 'cpan' will work from the system prompt. Its been awhile since I had to do it from scratch, so feel free to play and/or correct me. After CPAN is installed and configured, you want to cpan> install Bundle::DBI and let it install all the dependencies, too. Then, cpan> install DBD::Oracle That should get you started. There's lots of resources on the net for using CPAN. Be sure to actually READ the docs. This was alot gentler than the introduction I received on CPAN, but it really doesn't belong on the DBI list. HTH, Dave On Aug 23, Wen-Qiu Sun scribed: > hi there, > > I am an Oracle DBA and new to Perl. My perl software is v5.6.1 built > for sun4-solaris-64int. > > I downloaded DBI-1.39.tar.gz and got it installed successfully. But > one of my perl program also uses "use Net::FTP.pm", which causes an > error: "Can't locate Net/ftp.pm in @INC". > > It looks like I don't have an FTP.pm module on my system. > > I ran "find / -name ftp.pm -print" and found only this: > > /opt/SUNWstade/lib/Net/ftp.pm > > So, my question is: how do I install the FTP.pm module on my system? > > Thank much in advance. > > > > > Wen Q. Sun > Database Administrator > DIT/Agency Support Services > email: [EMAIL PROTECTED] > phone: (517) 241-3013 >
Getting a field list from a query with NO results?
Hi all. I'm working on an object to handle synchronizing fields on a Gtk2::GladeXML - generated form with a database ( 2nd release is just around the corner ). I need to get a field list when my object is created, however in some cases I'll be running a query which returns NO records on the first run. I have bene using: foreach my $field ( keys %{$self->{records}[$self->{position}]} ) { # do stuff } but this won't work if I don't have any records. I only see 2 options: 1) Run a separate query with NO where clause and a LIMIT clause ( MySQL ) and get the field names from there, and then run the real query. This will work but I don't like it. 2) Keep a flag to indicate if I've done all the stuff in my loop ( which must happen only once ) and run it at the first opportunity ( the first time I run a query that gets results ). This is also a little messy, but better than option 1. Is there any other way to get the field list without having any records? Dan
Re: Getting a field list from a query with NO results?
If you don't know the columns that will be returned, I presume you're doing something akin to 'select * from'. At any rate, if you know the table name, why not ask the database for the table info? #!/usr/bin/perl use DBI; my $dbh = DBI->connect("dbi:mysql:test",'',''); die "Unable to connect:\n" . $DBI::errstr . "\n" if (! defined($dbh)); # 3rd param is table name, 4th means all columns my $sth = $dbh->column_info(undef, undef, 'test', '%'); while (my @ar = $sth->fetchrow_array()) { print join(":", @ar), "\n"; } $sth->finish; $dbh->disconnect; which is akin to mysql> desc test; HTH, Dave On Aug 24, Dan scribed: > Hi all. > > I'm working on an object to handle synchronizing fields on a > Gtk2::GladeXML - generated form with a database ( 2nd release is just > around the corner ). > > I need to get a field list when my object is created, however in some > cases I'll be running a query which returns NO records on the first run. > > I have bene using: > > foreach my $field ( keys %{$self->{records}[$self->{position}]} ) { > # do stuff > } > > but this won't work if I don't have any records. > > I only see 2 options: > > 1) Run a separate query with NO where clause and a LIMIT clause ( MySQL > ) and get the field names from there, and then run the real query. This > will work but I don't like it. > > 2) Keep a flag to indicate if I've done all the stuff in my loop ( which > must happen only once ) and run it at the first opportunity ( the first > time I run a query that gets results ). This is also a little messy, but > better than option 1. > > Is there any other way to get the field list without having any records? > > Dan >
Re: Getting a field list from a query with NO results?
David N Murray wrote: If you don't know the columns that will be returned, I presume you're doing something akin to 'select * from'. At any rate, if you know the table name, why not ask the database for the table info? #!/usr/bin/perl use DBI; my $dbh = DBI->connect("dbi:mysql:test",'',''); die "Unable to connect:\n" . $DBI::errstr . "\n" if (! defined($dbh)); # 3rd param is table name, 4th means all columns my $sth = $dbh->column_info(undef, undef, 'test', '%'); while (my @ar = $sth->fetchrow_array()) { print join(":", @ar), "\n"; } $sth->finish; $dbh->disconnect; which is akin to mysql> desc test; HTH, Dave Yeah I've thought about that. The problem is that people can use field aliases, eg: select concat(FirstName, ' ', LastName) as FullName from MyTable or even select ID as MyID from MyTable so I need to be able to grab the field name as it will be returned from the database server. I was kinda hoping that even though a 'blank' recordset was being returned, that I could still *somehow* pull some field names out of it. And I'd also like to make it DB-neutral - which is one of the reasons I'm shying away from using a LIMIT clause. I suppose I can figure out why DB server is being used and create a DB-specific query on-the-fly, eg SQL Server would want a "select TOP 1 * from MyTable" instead of MySQL's "select * from MyTable LIMIT 1". -- Daniel Kasak IT Developer NUS Consulting Group Level 5, 77 Pacific Highway North Sydney, NSW, Australia 2060 T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989 email: [EMAIL PROTECTED] website: http://www.nusconsulting.com.au
RE: Getting a field list from a query with NO results?
Maybe I've misunderstood, but can't you just use the prepare method, and then use the various statement attributes such as NAME[_xx], TYPE, PRECISION, SCALE, etc. You don't actually need to fetch any rows to get at this info. Steve -Original Message- From: Daniel Kasak [mailto:[EMAIL PROTECTED] Sent: Tuesday, 24 August 2004 12:21 PM To: [EMAIL PROTECTED] Subject: Re: Getting a field list from a query with NO results? David N Murray wrote: >If you don't know the columns that will be returned, I presume you're >doing something akin to 'select * from'. At any rate, if you know the >table name, why not ask the database for the table info? > >#!/usr/bin/perl >use DBI; >my $dbh = DBI->connect("dbi:mysql:test",'',''); >die "Unable to connect:\n" . $DBI::errstr . "\n" if (! defined($dbh)); > ># 3rd param is table name, 4th means all columns >my $sth = $dbh->column_info(undef, undef, 'test', '%'); >while (my @ar = $sth->fetchrow_array()) { >print join(":", @ar), "\n"; >} >$sth->finish; >$dbh->disconnect; > >which is akin to >mysql> desc test; > >HTH, >Dave > > Yeah I've thought about that. The problem is that people can use field aliases, eg: select concat(FirstName, ' ', LastName) as FullName from MyTable or even select ID as MyID from MyTable so I need to be able to grab the field name as it will be returned from the database server. I was kinda hoping that even though a 'blank' recordset was being returned, that I could still *somehow* pull some field names out of it. And I'd also like to make it DB-neutral - which is one of the reasons I'm shying away from using a LIMIT clause. I suppose I can figure out why DB server is being used and create a DB-specific query on-the-fly, eg SQL Server would want a "select TOP 1 * from MyTable" instead of MySQL's "select * from MyTable LIMIT 1". -- Daniel Kasak IT Developer NUS Consulting Group Level 5, 77 Pacific Highway North Sydney, NSW, Australia 2060 T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989 email: [EMAIL PROTECTED] website: http://www.nusconsulting.com.au
Re: Getting a field list from a query with NO results?
David N Murray wrote: If you don't know the columns that will be returned, I presume you're doing something akin to 'select * from'. At any rate, if you know the table name, why not ask the database for the table info? #!/usr/bin/perl use DBI; my $dbh = DBI->connect("dbi:mysql:test",'',''); die "Unable to connect:\n" . $DBI::errstr . "\n" if (! defined($dbh)); # 3rd param is table name, 4th means all columns my $sth = $dbh->column_info(undef, undef, 'test', '%'); while (my @ar = $sth->fetchrow_array()) { print join(":", @ar), "\n"; } $sth->finish; $dbh->disconnect; which is akin to mysql> desc test; HTH, Dave On Aug 24, Dan scribed: Hi all. I'm working on an object to handle synchronizing fields on a Gtk2::GladeXML - generated form with a database ( 2nd release is just around the corner ). I need to get a field list when my object is created, however in some cases I'll be running a query which returns NO records on the first run. I have bene using: foreach my $field ( keys %{$self->{records}[$self->{position}]} ) { # do stuff } but this won't work if I don't have any records. I only see 2 options: 1) Run a separate query with NO where clause and a LIMIT clause ( MySQL ) and get the field names from there, and then run the real query. This will work but I don't like it. 2) Keep a flag to indicate if I've done all the stuff in my loop ( which must happen only once ) and run it at the first opportunity ( the first time I run a query that gets results ). This is also a little messy, but better than option 1. Is there any other way to get the field list without having any records? Dan Not certain I understand your issue, but, from the DBD::mySQL POD (as posted on CPAN): my $sth = $dbh->prepare("SELECT * FROM $table"); if (!$sth) { die "Error:" . $dbh->errstr . "\n"; } if (!$sth->execute) { die "Error:" . $sth->errstr . "\n"; } my $names = $sth->{'NAME'}; my $numFields = $sth->{'NUM_OF_FIELDS'}; for (my $i = 0; $i < $numFields; $i++) { printf("%s%s", $i ? "," : "", $$names[$i]); } print "\n"; Is there something you're trying to do that this doesn't ? NOTE: this is the std. way of fetching field info for a resultset, tho some drivers/dbms's don't populate that info until after execute(), but a properly conformant driver should populate it (and TYPE, PRECISION, SCALE, and NULLABLE) even if the resultset is empty. Dean Arnold Presicient Corp.
Re: Getting a field list from a query with NO results?
Dean Arnold wrote: Not certain I understand your issue, but, from the DBD::mySQL POD (as posted on CPAN): my $sth = $dbh->prepare("SELECT * FROM $table"); if (!$sth) { die "Error:" . $dbh->errstr . "\n"; } if (!$sth->execute) { die "Error:" . $sth->errstr . "\n"; } my $names = $sth->{'NAME'}; my $numFields = $sth->{'NUM_OF_FIELDS'}; for (my $i = 0; $i < $numFields; $i++) { printf("%s%s", $i ? "," : "", $$names[$i]); } print "\n"; Is there something you're trying to do that this doesn't ? NOTE: this is the std. way of fetching field info for a resultset, tho some drivers/dbms's don't populate that info until after execute(), but a properly conformant driver should populate it (and TYPE, PRECISION, SCALE, and NULLABLE) even if the resultset is empty. Dean Arnold Presicient Corp. That's *precisely* what I want. Thankyou. Still learning this stuff... -- Daniel Kasak IT Developer NUS Consulting Group Level 5, 77 Pacific Highway North Sydney, NSW, Australia 2060 T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989 email: [EMAIL PROTECTED] website: http://www.nusconsulting.com.au