The $sth is a mutable string… Which means you can change it at runtime!
Here's an example of a modified $sth at runtime:
my $up_sql = defined($updated_at) ? 'updated_at ? AND ' : undef;
my $sql = SELECT * FROM mytable WHERE $up_sql type_id = ? AND serial_number
IN (
SELECT
There's another option:
Use DBD::Gofer on your web server, which forwards the request to your db server
that has DBD::Oracle.
You could also use DBD::Proxy
--
Henri Asseily
henri.tel
On Oct 1, 2012, at 9:14 PM, Jack Craig jack.craig.ap...@gmail.com wrote:
Ok, A further install question
to go.
---
Henri Asseily
henri.tel
Try using DBIx::HA.
It takes care of the timeout mechanics for you.
---
Henri Asseily
henri.tel
On Aug 12, 2009, at 4:11 AM, 田口 浩 wrote:
Hello,
I found the DB2 way is;
$sth-{db2_query_timeout} = $timeout;
%attr in prepare($stmt, \%attr) seems to be
discarded in dbdimp.c in DBD-DB2 package
From DBIx::HA (fudged a bit):
sub _connect_with_timeout {
my ($dsn, $username, $auth, $attrs) = @_;
my $res;
my $dbh;
my $timeout = 0;
eval {
no strict;
my $h = set_sig_handler(
'ALRM',
You also might want to look at the way DBIx::HA implements its timeout
checks and overall analysis of the DB's responsiveness.
The source code is very small so shouldn't be difficult to follow.
H.
On Dec 2, 2008, at 9:19 PM, Hendrik Schumacher wrote:
alarm() definitely works in mod_perl.
I guess he doesn't want to pollute his system by trial and error.
Answer: http://www.quicomm.com/apm_dbddbi.htm
---
Henri Asseily
henri.tel
Fools ignore complexity; pragmatists suffer it; experts avoid it;
geniuses remove it.
- Alan Perlis
On Dec 6
Defining connections in one place is one thing.
Using the same connection from different places is another.
The first point, defining connections in one place, is something
quite trivial that is unnecessary to discuss. Basically it means
specifying the dsn string, and that can be done in a
On Jan 20, 2007, at 12:29 AM, Mark Stosberg wrote:
Some other folks may be interested in the patches I've published for
DBD::Multi recently:
http://rt.cpan.org/Public/Dist/Display.html?Name=DBD-Multi
Perhaps most interesting might be a benchmarking script I made, and
related optimization
On Jan 11, 2007, at 3:18 PM, Mark Stosberg wrote:
Ofer Nave wrote:
Couldn't an option be added as an alternative to db_stack that
indicates
a desire for random ordering, thereby eliminating the need to
precreate
all possible permutations? I'm imaging something like this (modified
On Jan 11, 2007, at 4:16 PM, Mark Stosberg wrote:
Henri Asseily wrote:
$DATABASE::conf{'test'} = {
load_balance = 1,
db_stack = [
[ 'dbi:Sybase:server=prod1;database=test','user1','pass1',
$attrib ],
[ 'dbi:Sybase:server=prod2;database=test','user2','pass2',
$attrib
On Jan 8, 2007, at 10:10 PM, Mark Stosberg wrote:
Henri Asseily wrote:
I don't know if I uploaded the latest version of DBIx::HA to CPAN,
I'll
do it asap.
The docs for DBIx::HA say
It is very simple to load-balance across read-only database servers.
Simply randomize or reorder
On Oct 5, 2006, at 4:39 PM, Tim Bunce wrote:
Let's try this and see how it works out:
Original state:
dbh1o - dbh1i
sthAo - sthAi(dbh1i)
dbh2o - dbh2i
swap_inner_handle dbh1o with dbh2o:
dbh2o - dbh1i
sthAo - sthAi(dbh1i)
dbh1o - dbh2i
create
On Oct 5, 2006, at 6:19 AM, Tim Bunce wrote:
On Wed, Oct 04, 2006 at 11:53:48AM -0700, Henri Asseily wrote:
I have an issue with proper usage of swap_inner_handle:
Say I have a dbh with an active sth.
I create a new dbh (new_dbh) and swap its inner handle with dbh.
Now is sth a child of dbh
I have an issue with proper usage of swap_inner_handle:
Say I have a dbh with an active sth.
I create a new dbh (new_dbh) and swap its inner handle with dbh.
Now is sth a child of dbh or new_dbh? i.e., is sth linked to the
inner dbh, or not at all?
Then I create a new sth (new_sth) and swap
On Sep 18, 2006, at 6:18 PM, Tyler MacDonald wrote:
Dean Arnold [EMAIL PROTECTED] wrote:
Which brings me back to the notion of non-blocking requests.
Assuming
many/most client libs do support an async capability, and a OOB
cancel, then it should be possible to standardize the behavior
Also, rather than fork each time you need a timeout it would be
nice to
be able to have a single 'watchdog' process and use some form of fast
IPC to tell it when to be active (passing the timeout to use and
relevant session id) and when to be inactive. A pipe would be fine.
But perhaps that
Use the great Sys::SigAction by Lincoln Baxter.
It has never failed me.
Take a look at DBIx::HA for sample usage.
On Sep 16, 2006, at 2:27 AM, CAMPBELL, BRIAN D (BRIAN) wrote:
I've done something similar to what you did...
It went something like this...
- Run query in a separate thread.
-
On Sep 16, 2006, at 8:58 PM, Sam Tregar wrote:
On Sat, 16 Sep 2006, Henri Asseily wrote:
Use the great Sys::SigAction by Lincoln Baxter.
That's just a wrapper around POSIX sigaction(), right? As I
understand it that's equivalent to the old unsafe signals in Perl
before 5.8. I'd rather
On Sep 17, 2006, at 12:05 AM, Henri Asseily wrote:
On Sep 16, 2006, at 8:58 PM, Sam Tregar wrote:
On Sat, 16 Sep 2006, Henri Asseily wrote:
Use the great Sys::SigAction by Lincoln Baxter.
That's just a wrapper around POSIX sigaction(), right? As I
understand it that's equivalent
On Aug 29, 2006, at 4:29 PM, [EMAIL PROTECTED] wrote:
Ah! I think I know what happens...
You probably have the syb_flush_finish attribute turned on - which
means
that DBD::Sybase will try to fetch all the results that are pending
for the
active sth.
That's most certainly it! I also
On Aug 29, 2006, at 2:08 PM, [EMAIL PROTECTED] wrote:
As you see this calls the DESTROY for the sth (which cancels the
query),
and then calls the DESTROY for the dbh (which closes the
connection). There
is no special code in DBD::Sybase to handle this case AFAIK.
Thanks, I didn't
Is the below the correct usage for finishing still active child
handles of a dbh?
foreach my $childh (@{$dbh-{ChildHandles}}) {
$childh-finish() if ($childh-{Type} eq 'st');
}
I'm getting an error when running the above code:
dbih_setup_fbav: invalid number of fields: -1, NUM_OF_FIELDS
There's a bug in binding parameters in DBD::mysql 3.0003_1, when
binding a string that has slashes in it.
Below is how to reproduce it.
Create a simple table:
=== TABLE ===
CREATE TABLE tbl_tst_xx (
cv1 varchar(255) NULL,
ci2 int(11) NULL,
ci3 smallint(6) NULL
)
Apache::DBI overrides disconnect() to be a no-op, and
connect_cached()
doesn't. (But Apache::DBI doesn't do this during startup.)
It would be reasonable for Apache::DBI to provide a way for
applications
to call disconnect() and have it actually disconnect.
If you want another hack :-),
Tim Bunce wrote:
On Wed, Jan 25, 2006 at 02:51:14PM -0500, Steven Lembark wrote:
-- Tim Bunce [EMAIL PROTECTED]
$dbh-connect_cached( @{ $meta{ $dbh } } );
If the connection has failed then connect_cached() will return a new,
different, $dbh which would be lost with the code
You may want to check the source of DBIx::HA.
I did a lot of that type of work, see below for a sample. Be warned though that I
think some of that code could be cleaned up now that we have
$h-{ChildHandles}. It's a lifesaver.
Also having the upgraded error handler will allow for cleaner code as
Are you talking about $dbh-{Statement} ?
If you want full transactional integrity and you've been sending
multiple statements within the transaction, you could overload execute()
and track every time there's an open tran or commit in the
statement. Anything in between, you store in an array of
On Sep 23, 2005, at 3:19 PM, Tim Bunce wrote:
I'm interested to hear stories of people who have subclassed the DBI,
or used modules that subclass the DBI.
Was subclassing the DBI a good approach?
Where there any problems?
Could it have been done well/better some other way?
Thanks!
Tim.
On Apr 13, 2005, at 4:25 AM, Gav wrote:
From: Bart Lateur
| BTW I tend to agree with you, without actually being convinced of its
| technological superiority. BTW one can use mod_rewrite to nicen up
the
| URL for images.
|
| But files inside databases tend to blow up the actual database
On Feb 16, 2005, at 2:58 AM, Charles Plessy wrote:
On Thu, Feb 03, 2005 at 11:33:10AM -0800, Henri Asseily wrote :
Also note that DBD::CSV is significantly impacted by I/O speed. If
your
IMac G5 has a 4200 rpm drive and your linux box has a 10k rpm one,
that
makes quite a large difference
On Feb 3, 2005, at 2:18 AM, Tim Bunce wrote:
On Thu, Feb 03, 2005 at 06:27:05PM +0900, [EMAIL PROTECTED]
wrote:
Dear list,
I wrote a simple CGI script using DBD::CSV on a linux
computer, and then installed it on a iMac G5. Its execution time is
now alomst 10 times slower. Using print
On Dec 1, 2004, at 10:39 AM, Tim Bunce wrote:
On Wed, Dec 01, 2004 at 09:56:01AM -0500, John Siracusa wrote:
On Wed, 1 Dec 2004 09:46:24 +, Tim Bunce [EMAIL PROTECTED]
wrote:
Do you generally pass URLs around as a string or broken up into a
hash?
If they had different formats for different
On Dec 1, 2004, at 10:39 AM, Tim Bunce wrote:
On Wed, Dec 01, 2004 at 09:56:01AM -0500, John Siracusa wrote:
On Wed, 1 Dec 2004 09:46:24 +, Tim Bunce [EMAIL PROTECTED]
wrote:
Do you generally pass URLs around as a string or broken up into a
hash?
If they had different formats for different
. That will help me determine what to
patch in DBI.
5) If you are running on linux, can you do this with strace, and show
us
the output? If on Sun... same question but use truss. (Don't recall
know what does the equiv on AIX or HPUX).
Will do as well.
On Wed, 2004-11-24 at 16:52 -0800, Henri Asseily wrote
That *might* be a problem with DBD::Sybase and/or with the way Sybase
client libs use signals.
As Lincoln suggested, a couple of traces might be useful.
I'm running under mod_perl, DBI 1.45 and DBD::Sybase 1.04. I'm
attaching a number of traces.
The first listing below is what happens under
I have slammed into a wall in my quest for reliable failover and high
availability in DBI. I don't know if this discussion should be in
dbi-users or dbi-dev, but here goes:
High availability necessitates a good timeout handling system. If
execution of an sql statement or stored procedure takes
On Nov 22, 2004, at 5:30 AM, Bob Showalter wrote:
Kevin Bass wrote:
I have a slight problem that I am attemping to solve. I am using
CGI/Perl (DBD Oracle) on Linux AS 2.1 to access to the database. When
users encounter problems on the web, they cancel (or press stop) in
their browsers. This will
On Nov 22, 2004, at 5:30 AM, Bob Showalter wrote:
Kevin Bass wrote:
I have a slight problem that I am attemping to solve. I am using
CGI/Perl (DBD Oracle) on Linux AS 2.1 to access to the database. When
users encounter problems on the web, they cancel (or press stop) in
their browsers. This will
is required.
---
Henri Asseily
-
From: Henri Asseily [mailto:[EMAIL PROTECTED]
Sent: Monday, October 18, 2004 5:12 PM
To: '[EMAIL PROTECTED]'; Jesse, Rich
Subject: Re: Slow connection to Oracle 9i
I have a DBIx::HA (High Availability) module on CPAN, but I'm readying
a next version real soon now that will take care
I have a DBIx::HA (High Availability) module on CPAN, but I'm readying
a next version real soon now that will take care of this for you.
If you combine Apache+mod_perl+Apache::DBI+DBIx::HA, you'll get what
you need.
I'm debugging one last instance of a dbh having an ActiveKid handle
when it
Please read the documentation for Apache::DBI.
In Apache 1.3 and mod_perl 1.xx, when using Apache::DBI in conjunction
with DBI you get the following:
Each Apache process runs one perl instance. Each perl instance loads up
one instance of Apache::DBI. Each instance of Apache::DBI automatically
By default the first thing we do here on a redhat 9 install is as root:
mv /etc/sysconfig/i18n /etc/sysconfig/i18n.orig
upon reboot, you should be good.
If you don't want to reboot, just do unset LANG before running the
Makefile (or installing through CPAN).
Not doing that is guaranteed to break
On Sep 13, 2004, at 8:30 AM, Martin Moss wrote:
All,
I'm trying to understand the Apache::DBI mechanism
which caches and returns $dbh handles. My concern is
that Apache DBI uses the connection options, like
AutoCommit=1 as part of it's caching 'key' mechanism.
Yes it does, it uses the sorted list
I need to know when I execute() a statement if the error is a
connectivity error or something else.
From the DBI docs:
Perform whatever processing is necessary to execute the prepared
statement. An undef is returned if an error occurs. A successful
execute always returns true regardless of
On Sep 8, 2004, at 3:04 AM, Bart Lateur wrote:
Is there anything foreseen to disconnect a DBI connection, in a
mod_perl
(2) setup with Apache::DBI, in case nothing has been requested in
several minutes time? Do the connections stay open forever, or does the
database timeout all by itself? (I
For me DBD-Sybase compiles straight out of the box as long as I export
the following environment variables:
SYBASE_OCS=OCS-12_5
SYBASE=/Applications/Sybase/System
Then it's a simple perl Makefile.pl make make install
There should be no need to tinker with the makefile.
On Aug 10, 2004, at 6:54
I've been running DBD::Sybase with the following patch since version
1.01, which could remotely have an impact for you. This is the 1.02
patch, but should work fine in 1.04. FYI in DBD::Sybase version 1.04,
the modified line is dbdimp.c:2987.
Here's the issue in syb_st_finish() ( when
Wait a minute. Stupid question, but it's been bothering me since the
beginning of the thread:
Chris, you write:
$var = I'm really wishing that I used MySQL as then I can use
placeholders;
Does that even compile in Perl?
Shouldn't you be writing instead:
$var = q(I'm really wishing that I used
Sorry I can't answer your question, and doubly sorry to raise another
problem that you'll have, which I did encounter:
If you do not restrict the # of rows returned, you could easily crash
older machines.
I did build a general CGI interface to databases, with
database/table/column displays,
I use them all over the place, too.
What made me think they were standard is p. 95 of the Feb. 2000
edition of
the Cheetah book, which describes them in quite a bit of detail:
...DBI defines several error diagnostic methods that can be invoked
against
any valid handle, driver, database, or
On Feb 12, 2004, at 3:42 AM, Bart Lateur wrote:
On Thu, 12 Feb 2004 10:55:56 +, Tim Bunce wrote:
All I'm proposing to change is to add a way for drivers to indicate
if they are in a transaction or not, and then to use that to disable
the warning.
That reminds me... I haven't used it in
I generally only add something to the DBI when the DBI can 'fake it'
for drivers that can't do it themselves. In this case the DBI will
count execute()/do() calls and reset the counter on
commit()/rollback().
Then the counter can be used to control the warning for drivers that
can't tell if
. Functionality
that would compromise speed was not considered. This module has been
tested
extensively at very high loads in the Apache/mod_perl/Sybase
environment.
---
Henri Asseily
A few ideas:
- Make it a stored procedure.
- Make a compound index on INST_MNEM and TRADE_STATUS
- If the selected items are a large part of the table, it may be much
much faster to just bcp out the table and parse it in
Perl/sed/awk/cut/...
- And as Michael says, take a look at the query plan.
On Thursday, October 23, 2003, at 10:09 AM, Tim Bunce wrote:
On Thu, Oct 23, 2003 at 06:50:21PM +1000, Ron Savage wrote:
Hi Folks
Anyone have experience with this:
http://sqlrelay.sourceforge.net/
Funny you should mention that. I've just had an email conversation
with the author (Dave Muse) to
column
names - and
i dont know how to do it. I didnt find it in DBI manual page, and
anywhere else.
Thanks anyway, and sorry for my english.
---
Henri Asseily
[EMAIL PROTECTED]
CTO Founder, BizRate.com
http://www.bizrate.com
Que les inopérants laissent passer ceux qui font
( 02.10.22 11:02 -0700 ) John Gedeon:
Is there a way to hide the passwords in a file so that perl can still
connect to the db but now allow anyone but me and maybe my supervisor
to see the password?
Not really cleanly.
If you're on a UN*X system, you can use file permissions to minimize
On Monday, October 14, 2002, at 01:10 PM, Michael Peppler wrote:
On Fri, 2002-10-11 at 14:27, Henri Asseily wrote:
Regarding what I've dubbed DBIx::HA, here's the idea:
There hasn't been up to now (or at least I haven't found any) a widely
available Perl/DBI-based system for system
On Friday, October 11, 2002, at 02:39 PM, Tim Bunce wrote:
There hasn't been up to now (or at least I haven't found any) a widely
available Perl/DBI-based system for system architects who handle
high-availability groups of servers, either in read-only load-balanced
mode or read-write
This is somewhat OT, but I need an answer from within the DBI community:
I want to release a new DBIx module, DBIx::HA (for High Availability).
In this module I need to do some work on shared memory segments. What
Perl module is most in use to do that? i.e. which module should I
support?
I was
to communicate to each other
the state of the system and the currently active dbh, and thus my
question regarding SHM. That is trivial, though.
Henri.
On Friday, October 11, 2002, at 01:49 PM, Tim Bunce wrote:
On Fri, Oct 11, 2002 at 12:50:15PM -0700, Henri Asseily wrote:
This is somewhat OT
another way that I can't think about.
H
Henri Asseily wrote:
I'm working on a high-availability database switching module to work
with DBI and Apache::DBI, and I'll release it as soon as it's ready.
But I have one last problem:
it seems that even if I do the following:
eval { $dbh-DESTROY
by the Firm in accordance with the
Firm's procedure for the review of correspondence
--
Henri AsseilyBizRate.com
[EMAIL PROTECTED]The best shopping experience!
Chief Technologist http://www.bizrate.com
don't know enough about how
each of these servers and drivers compares.
Sincerely,
Brad Smith
--
Henri AsseilyBizRate.com
[EMAIL PROTECTED]The best shopping experience!
Chief Technologist http://www.bizrate.com
::Simple-connect('DBI:mysql:$db', $user, $passwd)
or die Cannot connect to database: $!;
my @hostname = $db-query(
qq{SELECT hostname FROM tblHost WHERE status = ?},
'started'
)-flat;
foreach (@hostname) {
# ...
}
Greetings,
Janek
---
Henri Asseily
[EMAIL PROTECTED
,
Will
__
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos More
http://faith.yahoo.com
---
Henri Asseily
[EMAIL PROTECTED]
Chief Technology Officer
BizRate.com
Que les inopérants laissent passer ceux qui font
Achille Talon
There isn't. mod_perl and Apache::DBI allow some connection pooling,
but
I'm not sure how it's done. Discussing DBI handles is definitely on
topic.
mod_perl + Apache::DBI doesn't do connection pooling in Apache 1.3.
The way 1.3 works is as follows:
Each Apache child has its own perl
69 matches
Mail list logo