insert column if not exist

2005-05-12 Thread Ing. Branislav Gerzo
Hi all, I'm making script, and I'd like add column, if column not exist. My DBS is MySQL, and I didn't find direct SQL command for this. Is there some workaround for this ? thanks.

Re: insert column if not exist

2005-05-12 Thread Rachel Llorenna
Use SHOW COLUMNS on the table first; check if the desired column name is in there, or ALTER TABLE as necessary. I think there is a MySQL-specific command you can probably use; IF NOT .. clause, but that's bad practise. It's probably better to use SHOW COLUMNS, since it will allow you to easily

Perl Performance Help.

2005-05-12 Thread Divya
Hi All, I am in a Perl based project, where we fire a query which returns 20K records. In the perl side, we use the following snippet to get the query result to an array. while ( @each_record = $stmt_handle-fetchrow) { push @records, [ @each_record ] ; } Upon analysis, we

Re: Perl Performance Help.

2005-05-12 Thread JupiterHost.Net
Divya wrote: Hi All, I am in a Perl based project, where we fire a query which returns 20K records. In the perl side, we use the following snippet to get the query result to an array. while ( @each_record = $stmt_handle-fetchrow) { push @records, [ @each_record ] ; } So you end up

Re: Perl Performance Help.

2005-05-12 Thread Jonathan Leffler
On 5/12/05, Divya [EMAIL PROTECTED] wrote: I am in a Perl based project, where we fire a query which returns 20K records. In the perl side, we use the following snippet to get the query result to an array. while ( @each_record = $stmt_handle-fetchrow) { push @records, [ @each_record ]

Re: insert column if not exist

2005-05-12 Thread Jonathan Leffler
On 5/11/05, Ing. Branislav Gerzo [EMAIL PROTECTED] wrote: I'm making script, and I'd like add column, if column not exist. My DBS is MySQL, and I didn't find direct SQL command for this. Is there some workaround for this ? (a) Are you sure it is a good idea for people running your script to

Re: insert column if not exist

2005-05-12 Thread Michael A Chase
On 05/12/2005 04:50 AM, Rachel Llorenna said: Use SHOW COLUMNS on the table first; check if the desired column name is in there, or ALTER TABLE as necessary. I think there is a MySQL-specific command you can probably use; IF NOT .. clause, but that's bad practise. It's probably better to use

Re: insert column if not exist

2005-05-12 Thread Ing. Branislav Gerzo
Michael A Chase [MAC], on Thursday, May 12, 2005 at 05:48 (-0700) has on mind: MAC I'd do something like this: MACmy $sth = $dbh - column_info( undef, $sSchema, $sTable, $sColumn ); MACmy @sColumnInfo = (); MACeval { # The eval isn't needed if RaiseError == 0. MAC @sColumnInfo =

RE: Perl Performance Help.

2005-05-12 Thread Ian Harisay
Again, what DBMS are you using. You should also try your sql outside of Perl. The problem may lie with the DBMS. For instance there are ways to optimize your queries in Oracle using hints. Also, unindexed columns used in your where clause will cause a full table scan and worse. The Perl DBI

RE: Perl Performance Help.

2005-05-12 Thread Divya
Hi Jonathan, Here are some of the statistics : a) We are using Oracle 8i DB. The query (or the DBMS) takes only 6 seconds to return data to Perl. b) Initially we thought that push @records, [ @each_record ] in the below loop is taking time. But even if we comment it, the time taken by the loop

RE: Perl Performance Help.

2005-05-12 Thread Rutherdale, Will
20k rows can be quite a lot of data, especially with many large columns. I've been dealing with performance issues with tens of thousands of rows in Informix, and it can be quite slow. However, LOAD / UNLOAD is just about as slow as DBI. Those are the Informix commands to read from / dump to a

Re: Perl Performance Help.

2005-05-12 Thread Ian Harisay
try: my $stime = time; while( @each_record = $stmt_handle-fetchrow){ last; } print time - $stime,$/; If this takes 2 minutes then your problem is with your database, not Perl. Which means you'll need to look at query optimization. Not code optimization. Your query optimization may also include

RE: Perl Performance Help.

2005-05-12 Thread David Goodman
Hello Divya: How does your perl program execution time compare to using sqlplus to return all the data to a file? regards, David --- Divya [EMAIL PROTECTED] wrote: Hi Jonathan, Here are some of the statistics : a) We are using Oracle 8i DB. The query (or the DBMS) takes only 6 seconds

Re: Perl Performance Help.

2005-05-12 Thread JupiterHost.Net
a) We are using Oracle 8i DB. The query (or the DBMS) takes only 6 seconds to return data to Perl. How did you determine this? I think you're just assuming that. c) So we conclude that it is mainly an issue with fetchrow especially when the number of records are high. We tried other possible

RE: Perl Performance Help.

2005-05-12 Thread Michael Nhan
Divya, Here are some of the statistics : a) We are using Oracle 8i DB. The query (or the DBMS) takes only 6 seconds to return data to Perl. So the query execution takes 6 seconds... How long does it take to get all the rows back in sqlplus (I mean how long does it take for sqlplus to get all

RE: Perl Performance Help.

2005-05-12 Thread Helck, Timothy
Don't forget that Oracle caches query results. If you run the perl test first, then the SQL*PLUS test right after it, the dramatic difference may only be due to caching. I don't know if there's an easy way to disable the caching, if there is I'd love to find out about it. -Original

Re: Perl Performance Help.

2005-05-12 Thread David
On Thu, May 12, 2005 at 07:43:41PM +0530, Divya wrote: a) We are using Oracle 8i DB. The query (or the DBMS) takes only 6 seconds to return data to Perl. c) So we conclude that it is mainly an issue with fetchrow especially when the number of records are high. We tried other possible options

Re: Perl Performance Help.

2005-05-12 Thread Job Miller
the benefit to having oracle in this case is that I don't have to do this manual timing stuff or even sql*plus timing. trace the session at the database level and it will tell you everything you need to know about where the problem lies with no speculation required. it will tell you what

Can't load Oarcle.so

2005-05-12 Thread Daniel Teklu
We installed DBI , DBD::Oarcle and 9.2 Oracle client. And this is run , we get this error. ./oracletest.pl install_driver(Oracle) failed: Can't load '/usr/local/lib/perl5/site_perl/5.8.6/sun4-solaris/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: ld.so.1: /usr/local/bin/perl: fatal:

RE: Can't load Oarcle.so

2005-05-12 Thread Reidy, Ron
Daniel, 1. Is your Oracle environment set (ORACLE_HOME, ORACLE_SID, etc.)? 2. Are the permissions correct for the .so files? 3. Are these files physically located in the directories referenced in the message? -- Ron Reidy Lead DBA Array BioPharma, Inc. -Original Message- From:

Re: Can't load Oarcle.so

2005-05-12 Thread Tim
On Thu, May 12, 2005 at 11:02:42AM -0400, Daniel Teklu wrote: We installed DBI , DBD::Oarcle and 9.2 Oracle client. And this is run , we get this error. install_driver(Oracle) failed: Can't load '/usr/local/lib/perl5/site_perl/5.8.6/sun4-solaris/auto/DBD/Oracle/Oracle.so' for module

Re: Can't load Oarcle.so

2005-05-12 Thread David
On Thu, May 12, 2005 at 11:02:42AM -0400, Daniel Teklu wrote: We installed DBI , DBD::Oarcle and 9.2 Oracle client. And this is run , we get this error. ./oracletest.pl install_driver(Oracle) failed: Can't load

RE: Can't load Oarcle.so

2005-05-12 Thread Matthew Ramadanovic
My guess is that you probably need to set some environmental variables. I was running into this problem with a stored proc and got around it by having my perl script call another after setting the variables : $ENV{ORACLE_HOME} = '/export/home/oracle/9.x'; #or whatever $ENV{ORACLE_SID} =

RE: SEGV error

2005-05-12 Thread Mark Vaughan
Jeff, I have tried using DBD::Sybase with negative results: cpan install DBD::Sybase CPAN: Storable loaded ok Going to read /.cpan/Metadata Database was generated on Thu, 12 May 2005 07:58:25 GMT Running install for module DBD::Sybase Running make for M/ME/MEWP/DBD-Sybase-1.05.tar.gz CPAN:

DBD::Sybase error (was RE: SEGV error)

2005-05-12 Thread Jeff Urlwin
No, but posting with a better subject and the exact error message you still get would help. I don't see a 'DynaLoader' error in there... Jeff -Original Message- From: Mark Vaughan [mailto:[EMAIL PROTECTED] Sent: Thursday, May 12, 2005 7:02 PM To: Jeff Urlwin; DBI users Subject:

Re: OT - but help here anyway -- was Re: /usr/bin/ls: 0403-027 The parameter list is too long

2005-05-12 Thread Jacqui Caren (IG)
Jonathan Leffler wrote: On 5/9/05, Vamsi_Doddapaneni [EMAIL PROTECTED] wrote: I am facing a new problem. Here is the code part: foreach $name(`ls $opt_i/*.xml`){ chomp; push @f, $name; print pushing elements=$name\n; } [EMAIL PROTECTED]; perldoc opendir something like...