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.
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
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
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
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 ]
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
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
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 =
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
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
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
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
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
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
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
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
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
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
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:
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:
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
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
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} =
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:
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:
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...
26 matches
Mail list logo