Re: date format search insdie the files

2008-11-29 Thread Dr.Ruud
Sureshkumar M (HCL Financial Services) schreef: Can someone help me on this Impossible. -- Affijn, Ruud Gewoon is een tijger.

Re: How to write a (My)SQL statement with REGEX / RLIKE containing a scalar variable?

2008-11-13 Thread Dr.Ruud
Hendrik Schumacher schreef: To avoid painful quoting the mysql reference manual suggest binding the value like this: $sth = $dbh-prepare (select name from toolbox where name LIKE CONCAT('%', ? ,'%')); That has issues similar to REGEXP, because the value can contain LIKE-wildcards such as %

Re: mixing placehoders and functions with MySQL

2008-11-12 Thread Dr.Ruud
Bruce Johnson schreef: I'm trying something along the lines of: insert into foo(fname, lname, phone, dateadded, status, datemodified) values (?,?,?,curdate(),1,curdate()) and it's failing saying I have an sql error at ...curdate(). DBD::mysql::db do failed: You have an error in your SQL

Re: mixing placehoders and functions with MySQL

2008-11-12 Thread Dr.Ruud
Jeffrey Seger schreef: Are you using do() instead of prepare()? Placeholders go into with prepared statements, not immediate executions. See the DBI documentation: do $rows = $dbh-do($statement) or die $dbh-errstr; $rows = $dbh-do($statement, \%attr) or die

Re: Dealing with floats and rounding

2008-10-10 Thread Dr.Ruud
Derek Jones schreef: All of the common languages suffer from rounding problems inherent in IEEE rounding (round-to-even and other issues). Math::Round resolves these issues. If you don't round to even (and your numbers are of the same sign), then the totals of the original values and the

Re: DBI 1.605 $dbh-ping crashes Perl (seg fault) when autoreconnect=1 and connection goes away (at least with DBD::mysql)

2008-07-08 Thread Dr.Ruud
Archon810 schreef: So I've been tracing this extremely weird segfault in my code for about half a year now mostly due to the evasive nature of the crash and finally traced it down to these specific steps: - perl 5.10 (happened in 5.8 too) - DBI 1.605 - DBD::mysql 4.007 - $dbh =

Re: Using q() to define a query

2008-01-12 Thread Dr.Ruud
Colin Wetherbee schreef: my $sql = q(SELECT departure_date, eq.name AS equipment, dp.full_city AS departure_city, ap.full_city AS arrival_city, ca.name AS carrier_name, number FROM jsjourneys FULL OUTER JOIN jscarriers AS ca ON jsjourneys.carrier = ca.id FULL

Re: Using q() to define a query

2008-01-12 Thread Dr.Ruud
Carville, Stephen schreef: and c.certcrtdate = to_date('%s','MM-DD-') Aaargh, you should always use '-MM-DD'. -- Affijn, Ruud Gewoon is een tijger.

Re: can you have a collumn roll over with auto_increment

2007-11-12 Thread Dr.Ruud
Paul DuBois schreef: mmccaws2 wrote: can I set an option so that when auto_increment reaches it's maximum integer value, it will start all over at zero. I'm deleting every 15 minute the earlier entries, so I'm not too worried about the table growing too large. Can mysql be set to roll

Re: Fun with UTF-8 and Oracle

2007-08-24 Thread Dr.Ruud
I have no idea about why the query with the utf8-upgraded name-value takes so much longer. In your code there is: my @cred = split(/[\s\n]+/, $line); which I think is better written as my @cred = split ' ', $line; -- Affijn, Ruud Gewoon is een tijger. Peter J. Holzer [EMAIL

Re: Using an existing JDBC Connection

2007-08-09 Thread Dr.Ruud
Mathew Delong schreef: I am calling into a Perl script from a Java class to retrieve information from a database, and am interested in using DBI for the connection. However, the Java class calling into the perl script will already have an established JDBC connection to the database, and I

Re: Duplicate table structure

2007-06-07 Thread Dr.Ruud
Peter Scott schreef: Is there a simple way to create a new table with the same structure as a given one in a *different* database? That means the CREATE TABLE foo AS SELECT * FROM bar WHERE 1=2 method won't work. That instruction doesn't guarantee that the new table has the same structure.

Re: [ANNOUNCE] Text-CSV_XS 0.27

2007-05-31 Thread Dr.Ruud
H.Merijn Brand schreef: 2007-05-31 0.27 - H.Merijn Brand [EMAIL PROTECTED] * checked with perlcritic (still works under 5.00504) so 3-arg open cannot be used (except in the docs) * 3-arg open in docs too * Added a lot to the TODO list * Some more

mysql LIMIT ?

2007-02-19 Thread Dr.Ruud
I created a quick-fix to get rid of the error about the quoted LIMIT-value, but I assume this must have been solved in better ways. The fix below is easy to enhance to also cover the LIMIT ?,? variant, but I would rather see a cleaner approach. Does it exist already? #!/usr/bin/perl use strict;

Re: Rows returned are out of sync with the request.

2006-08-23 Thread Dr.Ruud
Stephen Carville schreef: When I make a call to an Oracle 10g database using DBI and SQLRelay (for connection pooling) I seem to get results from the previous SELECT. For example, If I send the following: select a.statid, b.webstatdesc, a.pendid, c.penddesc, a.certno,

Re: Rows returned are out of sync with the request.

2006-08-23 Thread Dr.Ruud
Stephen Carville schreef: Dr.Ruud: The tranid and certno in your where don't have table identifiers. If you assume that the result is one record, check for more. I didn't know that dropping the table ids could make a difference. I'll try adding them. Thanks. They shouldn't make

Re: Is it correct that execute_array does not raise/print an error

2006-07-04 Thread Dr.Ruud
John Scoles schreef: As execute_array is normally use to inserts/update of millions of records and with this volume you would not want your process to choke on just one bad record Huh? It is fine if you can deliberately turn it off, but by default such a feature should abort and roll back.

Re: Touble With Dates

2006-05-25 Thread Dr.Ruud
Joseph Lamb schreef: s.shipdate snip TO_CHAR(SHIPDATE, 'MMDDYY') = TO_CHAR(SYSDATE-21, 'MMDDYY') and Maybe you need to replace SHIPDATE by s.shipdate? -- Affijn, Ruud Gewoon is een tijger.

slides of Making DBI/DBD scripts portable

2006-05-24 Thread Dr.Ruud
Making DBI/DBD scripts portable http://www.xs4all.nl/~hmbrand/dpws2006/ as presented at the Dutch Perl Workshop 2006 http://workshop.perlpromo.nl/ -- Affijn, Ruud Gewoon is een tijger.

Re: :XBase, STDOUT, and IO issue

2006-05-10 Thread Dr.Ruud
Garrett, Philip: Mark Galbreath: I searched all night and cannot find an example of how to do this correctly. Capture the table dump's STDOUT with IO::Pipe somehow? The documentation of IO::Pipe is pretty sparse. Any suggestion is greatly appreciated. This should do it: use IO::Handle;

Re: last insert id

2006-04-22 Thread Dr.Ruud
Ron Savage schreef: Dr.Ruud: So we're back at: /\A(?:mysql|pg)\z/i /\A(?i:mysql|pg)\z/ [db_vendor()] In the case of 'DBI DSN' = 'dbi:Pg:dbname=staff', I store 'Pg'. In the case of 'DBI DSN' = 'dbi:ODBC:pg-staff', I store 'Pg'. [...] if ($self - db_vendor() =~ /(?:mysql|Pg

DBI Development Fund (was: Re: last insert id)

2006-04-22 Thread Dr.Ruud
Ron Savage schreef: o Fell free to donate large quantities of money to the Perl DBI Development Fund, at (watch wrap): https://donate.perlfoundation.org/index.pl?node=Fund%20Drive%20Statusselfund=10 2 That is really a nasty wrap: the 10 in stead of 102 hides the DBI Development Fund. This

Re: last insert id

2006-04-21 Thread Dr.Ruud
Ron Savage schreef: [attribution repaired] Ruud: [attribution repaired] Ron: [attribution repaired] Ron: Nope. Method db_vendor() extracts the vendor's name from the connect string passed to DBI, so I don't see how it could return that :-))). And anyway, I control the config file this

Re: last insert id

2006-04-18 Thread Dr.Ruud
Ron Savage schreef: Dr.Ruud: [ /mysql|Pg/ ] Notice that 'CertainlyNotPgAtAll' matches, so maybe you were looking for /\A(?:mysql|pg)\z/i Nope. Method db_vendor() extracts the vendor's name from the connect string passed to DBI, so I don't see how it could return that :-))). Is it legal

Re: last insert id

2006-04-17 Thread Dr.Ruud
Ron Savage schreef: sub last_insert_id [...] if ($self - db_vendor() =~ /(?:mysql|Pg)/) That regex can be written as /mysql|Pg/. Notice that 'CertainlyNotPgAtAll' matches, so maybe you were looking for /\A(?:mysql|pg)\z/i MySQL's native LAST_INSERT_ID() will return the *first* id from a

Re: Running DBI, ODBC in the crontab

2006-04-14 Thread Dr.Ruud
Jeffrey Seger schreef: Dr.Ruud: JupiterHost.Net: Dr.Ruud: Jeffrey Seger: perl -MData::Dumper -e' print Dumper @INC' Alternative: perl -MData::Dumper -e' print Data::Dumper-Dump([EMAIL PROTECTED], [qw(*INC)])' Oi, why not much cleaner (code and output): perl -MData::Dumper -e

Re: Running DBI, ODBC in the crontab

2006-04-14 Thread Dr.Ruud
Jeffrey Seger schreef: Ok, you're right. Let's stop now as we are not adding to anyone's knowledge of DBI or DBD::*. You keep messing up, so I'll see no more of you. here were 30+ lines that you should have cut -- Affijn, Ruud Gewoon is een tijger.

Re: Running DBI, ODBC in the crontab

2006-04-13 Thread Dr.Ruud
JupiterHost.Net schreef: Dr.Ruud: Jeffrey Seger: perl -MData::Dumper -e' print Dumper @INC' Alternative: perl -MData::Dumper -e' print Data::Dumper-Dump([EMAIL PROTECTED], [qw(*INC)])' Oi, why not much cleaner (code and output): perl -MData::Dumper -e' print Dumper [EMAIL PROTECTED

Re: Running DBI, ODBC in the crontab

2006-04-12 Thread Dr.Ruud
Jeffrey Seger schreef: perl -MData::Dumper -e' print Dumper @INC' Alternative: perl -MData::Dumper -e' print Data::Dumper-Dump([EMAIL PROTECTED], [qw(*INC)])' -- Affijn, Ruud Gewoon is een tijger.

Re: MSAccess from SQL

2006-04-05 Thread Dr.Ruud
Louis Gonzales schreef: As far as I know, MSAccess is an application and doesn't have the robustness of a Database Server There is MsAccess and there is the Jet-Engine/Desktop-Engine. See also the content and links on: http://en.wikipedia.org/wiki/Microsoft_Jet_Database_Engine -- Affijn,

Re: Not exactly a dbi question

2006-04-05 Thread Dr.Ruud
Paul DuBois schreef: UPDATE tbl_name SET col_name = 0 WHERE col_name = 0; If you've selected the rows-changed count, $sth-rows() will always return 0, because the statement doesn't actually change any col_name value from its current value. That would be an odd optimization. The update