One thing you can do to speed up your current program is to simply pass a
reference instead of a value. Try this instead.
my $tablename = $sth-bind_col(1, my \$tablename);
While($sth-fetch){
$dbh-do(drop table $db.$tablename) || die $sth-errstr;
}
-Original Message-
From:
Threading your table drops could be problematic if you are dealing with foreign
key constraints. If constraints won't get in the way, just create a threaded
program to execute multiple statements at a time. Are you just cleaning out a
database? Is speed really a factor here? Please better
I think you would be better off to write it like this.
$dbh-{RaiseError} = 0;
$dbh-{PrintError} = 0;
$dbh-{AutoCommit} = 0;
my @record = ($row_id, $file_id, $offset, $country, $date_day, $campaign,
$leaf_id, $status_id);
my $rv;
SWITCH: {
last unless($rv = $sql_live-execute(@record));
last
I like using Text::CSV_XS for this sort of thing. If your columns in your
select are ordered properly you could try the following.
use Text::CSV_XS;
use IO::File;
my $csv = Text::CSV_XS-new({binary=1, eol=$/, always_quote=1});
my $fh = IO::File-new(somefile.csv);
if(defined $fh){
my $sth
Have you considered using database links? Instead of 2 connections, you could
just do everything thru oracle 10.
-Original Message-
From: jeff [mailto:j...@roqc.no]
Sent: Monday, December 14, 2009 5:19 AM
To: dbi-users@perl.org
Subject: Looking for clever solution: Different versions
I wouldn't even use the eval block. Set PrintError and RaiseError to 0. Try
something along these lines.
my $rv = $dbh-do( EOS);
UPDATE ? set $attribute = $value
WHERE decimal_latidude = $dLat
ANDdecimal_longitude = $dLon
AND image_date = to_date('2008-03-05',
Is your dataset too large to hold in memory? Another approach would be load
each result set into memory.
From: don.walt...@falconjet.com [don.walt...@falconjet.com]
Sent: Tuesday, January 20, 2009 10:39 AM
To: dbi-users@perl.org
Subject: Recurse gives
An example of your code would be very helpful.
-Original Message-
From: Deviloper [mailto:devilo...@slived.net]
Sent: Thursday, January 15, 2009 6:56 AM
To: dbi-users@perl.org
Subject: Configure DBI logging to be more specific.
Hello,
I am using DBI and relativly new to it.
I get a
The fact that you're using placeholders will prevent an SQL injection attack
from happening. You're good to go.
-Original Message-
From: James H. McCullars [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 12, 2008 1:27 PM
To: dbi-users@perl.org
Subject: security advice needed
Hi, we
Yes. This isn’t really the right place to ask a design question. So, I hope I
don't get blasted for answering here.
First, I don't think you quite know what you're trying to solve yet. But to
help with what you have here, I think you're going to need a stored procedure
that returns your
perl -e 'use DBD::Oracle 42'
This will tell you what version is currently installed. Generally, I always
refer to the man page first. But, I didn't see versioning info available in
the DBD::Oracle man page. Probably an oversite on my part.
-Original Message-
From: John Scoles
Have you tried handling this thru a stored procedure? I think that would make
the database link transparent to you.
-Original Message-
From: Eric Simon [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 05, 2008 1:13 PM
To: dbi-users@perl.org
Subject: Accessing Remote LOBs in Oracle
Hi,
Sorry, I haven't tried anything to test what I am about to recommend. It
doesn't look like you got your answer though. I think you want your insert
statement to look like this:
$db-do(EOS,{},1,'0 03:00:00')
insert into batch_application_sla (job_id, job_duration)
I don't see how you are getting your results. Are you doing something along
these lines?
Note: You should always use a placeholder with your variables. It is safer.
Use Data::Dumper;
$query = qq{
SELECT item.*
FROM tmp_loadplan_items item,tmp_loadplans loadplan
$dbh_pg = DBI-connect
(
DBI:Pg:host=$pg_server_name;
port=$pg_server_port,
database=$pg_default_db,
$pg_user, $pg_passwd,
{RaiseError = 0, PrintError = 0}
);
$dbh_pg-do(EOS,{},$to_datetime, $table_name) || die $dbh_pg-errstr;
update sync_log set
Why not use DBD::Oracle if you are moving to a Oracle server.
-Original Message-
From: Craig Metzer [mailto:[EMAIL PROTECTED]
Sent: Friday, July 13, 2007 1:12 PM
To: Alexander Foken
Cc: dbi-users@perl.org
Subject: RE: Trouble Installing DBD::ODBC with postgresql
Yes Alexander,
I'm
I don't know if that would be speedy. Updates are far more expensive
than an insert. It does sound portable and safe though.
-Original Message-
From: Tim Bunce [mailto:[EMAIL PROTECTED]
Sent: Friday, March 30, 2007 9:47 AM
To: Ronald Kimball
Cc: George Bills; dbi-users@perl.org
From what I see you may want more than one table. One that stores your
log information. This table might contain log date,logged by,log
statement, etc.. Then create another table that summarizes/counts
how many times you find whatever it is you wish to count. For instance,
if it is a
You should first make sure your query runs outside of Perl.
-Original Message-
From: Brian Johnson [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 22, 2007 10:22 AM
To: dbi-users@perl.org
Subject: DBI Number of fields
Hey Folks -
We are having a problem with a script that uses DBI
I would only add that I believe the to_char method is more expensive
because you are taking temporal data, converting it to a string
representation and then doing a string comparison. Really not a big
deal but this can be quite expensive with large data sets. Then again
with a large data set
Try SELECT * FROM a1 WHERE custnum = ?
-Original Message-
From: John [mailto:[EMAIL PROTECTED]
Sent: Saturday, December 10, 2005 10:40 PM
To: dbi-users@perl.org
Subject: select placeholder
Hi
Can anyone see the error in the following code. It has to do with the
placeholder in the
Hi,
I am upgrading my Oracle client. This probably means I need to recompile
DBD::Oracle. Correct?
Thanks,
Ian
I would look to using Log::Log4perl for all your logging needs. But for
what you are doing try setting $| = 1 (autoflush).
From: Vergara, Michael (TEM) [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 09, 2005 1:25 PM
To: dbi-users@perl.org
Subject: Logging
You'll want to look for metadata in the man pages of the DBI. You'll
also want to make sure your particular DBD supports the DBI calls.
-Original Message-
From: Umesh Barik [mailto:[EMAIL PROTECTED]
Sent: Friday, September 30, 2005 5:36 AM
To: dbi-users@perl.org
Subject: need help to
I subclassed the DBI to:
-implement logging (log4perl)
-password retrieval
I experienced no problems subclassing the DBI. The DBI is very well
constructed. I still remember using oraperl and sybperl (shudder).
Thanks for all you do Tim, et al.
-Ian
If you are using a connection pool you could. Haven't done it with Perl
but I did do it with Java.
Sam Tregar wrote:
Hello all. Is there a simple way to cycle through all open database
handles, without needing to know anything about them before-hand?
Something like:
foreach my $dbh
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
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
what database?
Denesa K Shaw wrote:
Hi, How do get the date to be in the format like this? mm/dd/
hh24:mi:ss
When I run this code It prints: START TIME: 01-JAN-05, END TIME:
02-JAN-05
Thanks in advance!
Here is what I have:
my $sql = qq{SELECT MIN(RELOAD_FILE_TS),MIN(RELOAD_FILE_TS)+ 1
In that case using Data::Dumper is quite nice for figuring those types
of things out.
Robert wrote:
On 5/9/05 9:39 PM, in article
[EMAIL PROTECTED], Ian
Harisay [EMAIL PROTECTED] wrote:
This is really off topic.
Not so. I was more interested in how the fetchrow_arrayref works (or wasn't
Try something like this instead. You should always use native perl
calls to get the job done. Also, this isn't something to discuss in the
dbi-user list.
opendir(DIR, $dirname) or die can't opendir $dirname: $!;
while (defined($file = readdir(DIR))) {
if( -f $dirname/$file $dirname/$file
This is really off topic.
-Original Message-
From: Robert [mailto:[EMAIL PROTECTED]
Sent: Mon 5/9/2005 1:45 PM
To: dbi-users@perl.org
Subject: Spreadsheet::WriteExcel question
My ignorance is showing. : )
I am pulling data out of Oracle and putting it into an Excel spreadsheet.
Hi All,
I am having problem with spaces. I am loading data from a normalized
schema into a denormalized table. Many of the fields I am copying
originally come from free form fields and we don't attempt to clean them
up at all. What we grab in the form is what we enter into the database.
The
Also, I would recommend you consider using placeholders for all values
passed to your prepare statement.
eg. my $sth = $dbh-prepare('SELECT email_address FROM users WHERE
email_address = ?') || die $dbh-errstr();
$sth-execute($email) || die $dbh-errstr();
but looking at your query I
Also, I would recommend you consider using placeholders for all values
passed to your prepare statement.
eg. my $sth = $dbh-prepare('SELECT email_address FROM users WHERE
email_address = ?') || die $dbh-errstr();
$sth-execute($email) || die $dbh-errstr();
but looking at your query I
This is the wrong forum for this kind of question. But try this instead
it will give you a much clearer picture.
use Getopt::Long;
use Data::Dumper;
my %optctl;
Getopt::Long::GetOptions(\%optctl, 'x!', 'z!') or die \nOption
Error\n\n;
print Dumper(\%optctl),$/;
Vergara, Michael (TEM)
after you populate @data you can do: (code is untested, but I think I
have it right)
foreach(@data){
$_ = undef if $_ =~ /^$/;
}
NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED] 03/16/2005 9:57:03 AM
That sounds good, but I am a little confused on exactly how to
achieve that. I'll start
Which database are you using?
Moreno, Javier [EMAIL PROTECTED] 01/26/2005 9:43:45 AM
All,
I have the following code:
$::sql = INSERT into MASTER_Issue;
$::sql.= (idIssue, Description, OpenDate, DueDate, idStatus,
idPriority, idSeverity, SortDate);
$::sql.= VALUES
.
=back
=head1 AUTHOR
Ian Harisay, [EMAIL PROTECTED]
Copyright (c) 2003 NuSkin Intl. All rights reserved.
=cut
package
Let me apologize. I did not mean to send an attachment to the list.
Originally I attached my pm and then decided that I shouldn't do that.
I then pasted it into the body of the email but forgot to unattach the
file before sending.
Sorry
Ian Harisay [EMAIL PROTECTED] 11/18 9:55 am
I
Hi All,
Can anyone direct me to a Perl/MySQL shopping cart solution? I would
like to use Authorize.net or Verisign as my gateway. Since this is off
topic, please reply directly to me. I don't want to clutter the list
with this subject.
Thanks,
Ian
Hi All,
I have a query that when executed in sqlplus I get the oracle error
ORA-02395: exceeded call limit IO usage. But when I execute the same
query thru the DBI I am not capturing the error. $sth just doesn't have
a result set and does not tell me oracle errored out.
Thanks for any
Actually, I have had a similar problem. I can read utf8 characters from the database
but can't put them in the database using Perl. My system data is: Fedora Core 1,
Perl 5.8.1, DBI 1.43, DBD::Oracle 1.15, Oracle client 9.2.x.
Peter J. Holzer [EMAIL PROTECTED] 10/15 4:29 am
On
Text::CSV_XS will handle what you want to do just fine. You could do:
while(my $rec = $sth-fetchrow_arrayref()){
print OUTFILE $csv-combine(@{$rec}),$/;
}
If you are pulling large amounts of data across your network, look at
doing some optimization by setting RowCacheSize in the DBI to
Which line is 388? Also, you would be much better off using
placeholders.
xaver biton [EMAIL PROTECTED] 09/10 5:56 am
Hi,
I'want to write a script which update a DB in Internet.
from thr local DB I do a select query and while the select query run
foreach row I do a UPDATE query:
})) || die $dbh-errstr();
}
I added the die statement just as an example that you should test for
errors. You can also capture the result if it is needed. Oh, and
sorry, I didn't see that you did note where line 388. Just doing this
may solve your problem.
Ian Harisay [EMAIL PROTECTED] 09/10 11:11
Sorry about this. My groupwise client has a nasty habit of
taking all my formatting out. If you like I can send an attachment
to you. Just let me know.-Ian
Ian Harisay [EMAIL PROTECTED] 09/07 8:33 am
A good approach is to to define your dataset. You are just
using a CSV so I
Are you sure you don't have any spaces after EOF? Also, if it
is just bugging out on you, you could rewrite as:my $sql = INSERT
INTO .. (...,...,...) VALUES(?,?,?,...);foreach my $values (@array){
$dbh-do($sql,undef,@$values);}Also, don't know if this is your actual
code, but it is a
try $data = 'bar';$sth-prepare (insert into foo (my_id, data)
values(my_id_seq.nextval,?));$sth-execute($data);What you are doing
below is passing the string value my_id_seq.nextval to the field
my_id.
Jean-Pierre Utter Lfgren [EMAIL PROTECTED] 08/30 10:19 pm
Does anybody
I'm working on a PERL project at work, but my boss wants me to do just
enough in Pro*C that it won't integrate with my PERL designs.
Is anyone aware of any PERL/C extentions that allow Pro*C functions to
be called by PERL?
Thanks,
Ian
I would disagree with this last statement. you are gauranteed
to get the correct value from $seq.currval in a non-threaded
environment and your session is not shared by anything else. And if
you are threading (say in Java. I still don't with perl) I would
hope that each of
Hi All,
I am using
Fedora Linux Core 1 and redHat 8.0
oraclie client 9.2.0.1.0
DBI 1.37
DBD::Oracle 1.15
I seem to have a memory leak problem when using bind variables and the
same prepared statement for hundreds of thousands of rows. Below is my
function call. For my test I have only one
.
-Original Message-
From: Ian Harisay [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 19, 2004 4:27 PM
To: [EMAIL PROTECTED]
Subject: need to pull multi-byte out of a varchar2 field
Hi,
Can anyone tell me how to pull multi-byte characters out of a
varchar2
field. The database
BioPharma, Inc.
-Original Message-
From: Ian Harisay [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 19, 2004 4:27 PM
To: [EMAIL PROTECTED]
Subject: need to pull multi-byte out of a varchar2 field
Hi,
Can anyone tell me how to pull multi-byte characters out of a
varchar2
Hi,
What I have had to do to take care fo this problem is copy the rdbms
directory over from another linux box that I has a full install of
Oracle. Not just the client. I copied it over to the box I just wanted
my Oracle client and it worked beautifully after that. System info is:
OS: RedHat
Hi,
I know this isn't the right place to post the message, so I apologize
in advance. I need to refresh one oracle database from another. The
schemas are the same. The only thing I need to refresh is the data in
the tables. Can anyone point me to a website or book that would cover
this.
How about if you put a proper constraint on the table. Then it really
doesn't matter how elegant you are in cleaning up your data, since the
it should only happen once.
-Ian
Christian Merz wrote:
Hello,
i am definitely sure that the statement below would mess up your data. The
rowid is an
Hi,
Does anyone know if a SQL tokenizer/parser has been written. We have a
need for extracting sql from our logs and then doing some reporting on
it. We need to gleen table info and such from statement.
Thanks,
Ian
I work with both MySQL and Oracle. As a standard practice I will write
fetchrow_hashref('NAME_lc'). This forces all column names to be lower
case.
Thomas A. Lowery wrote:
On Mon, Sep 01, 2003 at 09:38:04PM +0300, [EMAIL PROTECTED] wrote:
The case of the column is correct.
This does work
You have to cycle individually thru your account list. The following
should work fine.
my $sth = $conn-prepare_cached(q{SELECT DISTINCT ID, NAME from
CUSTOMERS where ID in (?)});
my $recs = [];
foreach my $acct_id (701,705,751,754,749,755,756,757,758,780){
$sth-execute($acct_id);
while( my
Hi All,
Forgive me for asking this question here. I went thru the mail lists on
perl.org and don't see the appropriate list for my topic of discussion.
Can anyone point me to the correct mail list for advanced OOP discussion?
Thanks,
Ian
Hi,
What is a convenient way to assert that the database connection you have
been working with is still valid?
Thanks,
Ian
Hi,
This is a follow up with my problem on trying to use linked tables in my
query. I have a problem with this on my Linux box (rh8). I do not have
a problem with this on my Sun box. My perl modules are at the same
version level on both boxes. The only difference I can see is with the
would think so. Is the two_task environmental variable set? You may also
want to try using
DBI-trace and see what that gives you.
Thanks,
Sam Gold
-Original Message-
From: Ian Harisay [mailto:[EMAIL PROTECTED]
Sent: Friday, July 18, 2003 2:58 PM
To: Gold, Samuel (Contractor)
Subject: Re
Hi All,
I am using the dbish for some adhoc querying and am running into an
error and I am not sure why. This will work fine with sqlplus. The
query is:
SELECT DISTINCT
aig.grp_seq_id,
aig.rowid,
aig.transaction_cd,
gta.list_nam AS list,
aig.email_addr AS emailaddr,
Well, this is an oversite on my part. Thank you for pointing this out. I
am going to have to go thru some of my code and turn this off.
Hardy Merrill wrote:
Michael A Chase [EMAIL PROTECTED] wrote:
On Tue, 01 Jul 2003 16:12:09 -0600 Ian Harisay [EMAIL PROTECTED]
wrote:
Doing
Does anyone know how to force the install of DBD::Oracle? What needs to
be added to this command?
perl -MCPAN -e 'install DBD::Oracle'
Thanks
that something is wrong. All the other stuff
in the script gets logged.
Michael A Chase wrote:
On Tue, 01 Jul 2003 16:12:09 -0600 Ian Harisay [EMAIL PROTECTED]
wrote:
Doing the redirect can be a bit clunky. If you want to be more
precise with how you handle these errors, add this $attr to your
connect
Doing the redirect can be a bit clunky. If you want to be more precise
with how you handle these errors, add this $attr to your connect statement.
my $attr = { PrintError = 0, RaiseError = 1, AutoCommit = 0 };
my $dbh = DBI-connect( @{$login}, $attr )
or die Can't connect to Oracle database:
I did this example with a Oracle connection. I am using the quote method
from my database handle. The quoting will be specific to your database.
I just tried it with MySQL. No problem there either. What db are you
using? What errors is it throwing?
Steven Lembark wrote:
replacing ? for '500'
Hi,
Here is a code snippet that will accomplish your desired task. This is
not meant to be generic. It does have some limitations. It will
satisfy the problem presented. How you integrate it with you code will
be up to you.
Regards,
Ian
#!/usr/bin/perl
use strict;
use DBI;
my @login =
How large did the file get when you were dumping 4.7 million rows? Did
you exceed the max file size for your OS?
Igor Korolev wrote:
Your Terminated did not come from DBI. Your process got SIGTERM signal
from some monitoring process or an administrator.
-Original Message-
From: Jamin
I read the other responses. It is hard to determine what is happening
without seeing some code. but to simply determine if something is a
numeric value on could just use a regular expression:
($rv) = $sth-fetchrow_array();
if( $rv =~ /^[^0-9\.]*$/ ){ #-- the regex will work with unformatted
Hi all,
Can the output of my query be saved to a file when using dbish. If so,
how do I do this?
Thanks,
Ian
Have you evaluated exactly what your split is handing you and also
exactly what is in the database? You say maybe a 10th of the time you
don't see the result you expect. Could this be due to rogue characters
introduced in your db or file data. Since what you are printing when you
don't find a
One way to handle this is to validate what you just inserted into the
database. Once you are sure of the success of your insert then delete it
from the pop server. I don't know how light weight you trying to keep
your program. This would certainly add some overhead not only to your
database
Are you not listening to these people giving you helpful advice? Use
the placeholders. I gaurantee you will be glad you did. C'mon man!!!
Embrace the change.
Rob Benton wrote:
There won't be any ['] (read that as reg. expression) inside the fields
so that's not a problem. All I need to do
.
foreach ( $cgi-param() ){
$sql .= $_,;
$val .= ?,;
push(@{$array_ref}, $cgi-param($_));
}
$sql =~ s/,$/) /; ## strip the last comma and add a closing paren.
$val =~ s/,$/)/;
my $sth = $dbh-prepare($sql.$val);
my $result = $sth-execute($array_ref);
$dbh-commit(); ## if autocommit is not on.
Ian Harisay
Sounds to me like you need to install the oracle client and then
recompile DBD::Oracle.
[EMAIL PROTECTED] wrote:
Hello all,
I am trying to run a perl script that from one host has to access a database
running on another host. I am encountering some troubels here, that I have a
workaround for
Well, the camel book has an example that works well for passwords and
such. As far as encryption packages, just search for crypt on the cpan.
Nilanjan Das wrote:
Hi,
Can anyone tell me some of the Perl packages used for Encrypting or
Decrypting some data mostly strings using some Public and
Are you explicitly closing your statement handles and explicitly
committing? If you are running endlessly and not committing it will
lock your tables until that commit happens. There is more to it than
just this. The other things to cover are on the DBA side.
[EMAIL PROTECTED] wrote:
Hi,
just install DBI and DBD::mysql You should be good to go from there.
Dan Muey [EMAIL PROTECTED] 02/07/03 10:12AM
Those are three different modules. You'll only need one and if any of
the others are needed for it to work it will tel you on install.
I use DBI, it's pretty cool.
-Original
I had a similar problem with Oracle 9i on Linux. I installed the 9i
client only on my box. This did not give me all the oracle files I
needed. I ended up copying the rdbms directory from a full Oracle
install to my box. This gave me everything I needed to install the
DBD::Oracle module.
if the OS upgrade your version of Perl then you will find you have two
distributions of perl on your system. your @INC most likely only
reflects the new dist. If this has occurred, you probably have to go
thru the pain of reinstalling your modules.
Do a perl -v to see your current version of
Is it possible to spool your output from the dbish to a file?
Thanks.
depends on the shell you are using. If you are using bash, for
instance, put this line in your .bash_profile.
export ORACLE_HOME=/opt/oracle (or where ever your oracle home actually is)
then at the command line type:
source .bash_profile
that will update your environment for that shell. to
Hi,
I migrated to a new box. I am running redhat 8.0 and Oracle client
9.2.0. the DBD::Oracle install is failing. I seem to remember seeing
some discussion in the past about a problem with the Oracle 9.x client
and DBD::Oracle.pm. If anyone out there can assist me, please please
do. What
Hi All,
I am migrating hardware. My old system has redhat 7.3 on it. The new
one is rh8. I am getting compile errors when I try to make DBD::Oracle.
I did copy my oracle client from my old box. I'm wondering if that
might be the problem. Any help is very welcome.
Thanks,
Ian
Using DBI
Hi All,
I apologize for using this group to get this message out. I'm looking
for a discussion group that would cover build management tools for perl.
I am not referring to a makefile. I work for a company that is
predominantly java. We are using ant to build and deploy applications
to the
Hi all,
This is really a mysql question rather than a dbi question. So, I
apologize to everyone in advance.
In mysql is it possible to retrieve records 50-75 from your result set?
Say my result set is 20,000 records. I would like to do this and
provide an index for the client to walk thru. I
The number of elements allowed for an IN statement is governed by
Oracle. I run into this problem here. I hit different DBs and they are
managed differently. So, I run into this problem from time to time. 1
DBA allows me a 1024 entries and another decides to only allow for 256.
You can get
Look at (or buy) Paul Dubois's Mysql and Perl for the web. I am working
on a mgr based on Pauls examples. It isn't ready for primetime yet
though.
-ian
vikas mehta [EMAIL PROTECTED] 10/08/02 07:09AM
Can anyone help me how to maintain user session using perl
scripts
Are there any online
Hi,
Is anyone out there using a RDBMS data modeling tool on Linux. I've looked around but
haven't found anything.
Thanks in advance for the help.
-Ian
Are you using this for just a timestamp for record insertion? If so, SYSDATE is your
best bet. You can use SYSDATE like so:
prepare(insert into table1 (field1, field2, timestamp) values(?, ?, SYSDATE));
execute(Harry, Potter);
Your execute statement can then be looped through with different
(1) should not be valid either. first_name is not part of your select
statement. So, how would you be able to order your result set with it?
I think what Hytham wants to do here is dynamically build an SQL
statement. Your SQL string should be built before you try to prepare it.
-Ian
Paul
yes.
It stays intact just fine, until you do something like
$d-finish; or
$d-disconnect;
-Original Message-
From: Rory Campbell-Lange [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 24, 2002 5:29 AM
To: [EMAIL PROTECTED]
Subject: can I reuse database connections?
I'm new to the list.
I'm
Hi,
Does anyone know how to generate column headers for output based on the SQL.
my $sth = $dbh-prepare(SELECT field1, field2 FROM table1);
$sth-execute;
print $headers ## how would I do this based on the fields returned??
while ( my $rec = $sth-fetchrow_arrayref ){
print join(, , { $rec } ),
++) {
print $sth-{NAME}-[$i-1]\t;
}
print \n; # to return at the end
There's probably a more elegant way to do that with attributes but
that's how I outputted the column names.
Hope this helps,
Gordon
-Original Message-
From: Ian Harisay [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 21, 2002 11
You can't use 'class' in your where clause.
Brian Avis wrote:
So is there any reason why I can't run this through DBI?
SELECT ecls_code || '-' || ecls_long_desc AS class,
id_number,
last_name || ', ' || first_name AS name
FROM
drop the index on that column and then add a non-unique index.
NIPP, SCOTT V (SBCSI) wrote:
Sorry for posting a slightly off topic question, but I am having
trouble figuring out how to do something basic. I have a MySQL database
that has a UNIQUE column in a table. My problem is that I
1 - 100 of 118 matches
Mail list logo