Is selectrow_array really supposed to return an "empty list"

2005-12-06 Thread Martin J. Evans
The documentation for selecrow_array in DBI 1.49 says:

"If any method fails, and "RaiseError" is not set, selectrow_array will return
an empty list."

use DBI;
use strict;
use Data::Dumper;
my $dbh = DBI->connect('dbi:mysql:xxx','yyy','zzz');
$dbh->{RaiseError} = 0;
$dbh->{PrintError} = 0;
my @r = $dbh->selectrow_array('select xxx from yyy');
print "rows = ", $#r, "\n";
print "err = ", $dbh->err, "\n";
print "errstr = ", $dbh->errstr, "\n";
print Dumper(@r);

and column xxx and table yyy does not exist I get:

rows = 0
err = 1146
errstr = Table 'yyy' doesn't exist
$VAR1 = undef;

when I expected -1 for rows - as in:

perl -e 'my @a=(); print $#a;' outputs -1 for an empty list, not 0 for a list
containing an undef.

It does not seem to matter what the driver is - I tried dbi::ODBC too.

Martin
--
Martin J. Evans
Easysoft Ltd, UK
Development



Re: Is selectrow_array really supposed to return an "empty list"

2005-12-06 Thread Tim Bunce
Looks like a bug. The C version of selectrow_array is using
XSRETURN_UNDEF which will return an undef not an empty list.
Patch to follow, hopefully today.

Thanks!

Tim.

On Tue, Dec 06, 2005 at 11:41:18AM -, Martin J. Evans wrote:
> The documentation for selecrow_array in DBI 1.49 says:
> 
> "If any method fails, and "RaiseError" is not set, selectrow_array will return
> an empty list."
> 
> use DBI;
> use strict;
> use Data::Dumper;
> my $dbh = DBI->connect('dbi:mysql:xxx','yyy','zzz');
> $dbh->{RaiseError} = 0;
> $dbh->{PrintError} = 0;
> my @r = $dbh->selectrow_array('select xxx from yyy');
> print "rows = ", $#r, "\n";
> print "err = ", $dbh->err, "\n";
> print "errstr = ", $dbh->errstr, "\n";
> print Dumper(@r);
> 
> and column xxx and table yyy does not exist I get:
> 
> rows = 0
> err = 1146
> errstr = Table 'yyy' doesn't exist
> $VAR1 = undef;
> 
> when I expected -1 for rows - as in:
> 
> perl -e 'my @a=(); print $#a;' outputs -1 for an empty list, not 0 for a list
> containing an undef.
> 
> It does not seem to matter what the driver is - I tried dbi::ODBC too.
> 
> Martin
> --
> Martin J. Evans
> Easysoft Ltd, UK
> Development
> 


Why can I find postings on google groups that I never saw on this list

2005-12-06 Thread Martin J. Evans
I needed to find a thread I remembered from this mailing list and thought of
the list of mailing list archives on the dbi.perl.org web page. I found what I
was after in the groups.google.com archive but was surprised to see a number of
other posts I did not recollect. Examples are:

"DBD::Oracle for Oracle 9.2" thread started 1-dec-05
http://groups.google.com/group/perl.dbi.users/browse_thread/thread/6ea69bfe603db
4f5/e70f0c2efc0819a4?hl=en
 
and

How to Handle Transparent Application Failover TAF with DBD-Oracle
http://groups.google.com/group/perl.dbi.users/browse_thread/thread/e15d0e9ecc588
0ea/fc7c403d629391af?lnk=raot&hl=en#fc7c403d629391af

In particular I could not believe I would have missed someone saying:

"You can't do it. DBD::Oracle doesn't support TAF, direct loads or array
interface. DBI is not database neutral. DBI is geared toward MySQL and
PostgreSQL.

DBD::Oracle is not being fixed because Tim Bunce is pushin open source
databases, and Oracle driver isn't getting fixed and/or enriched with the new
features. If you want a decent database driver, try with Python. "

I cannot find these postings on the mail-archive.com or nntp.perl.org archives
so where did they come from? Is this some sort of mailing list to news gateway
issue I've missed?

Martin
--
Martin J. Evans
Easysoft Ltd, UK
Development



Re: Why can I find postings on google groups that I never saw on this list

2005-12-06 Thread Jonathan Leffler
On 12/6/05, Martin J. Evans <[EMAIL PROTECTED]> wrote:
> I needed to find a thread I remembered from this mailing list and thought of
> the list of mailing list archives on the dbi.perl.org web page. I found what I
> was after in the groups.google.com archive but was surprised to see a number 
> of
> other posts I did not recollect. Examples are:
>
> "DBD::Oracle for Oracle 9.2" thread started 1-dec-05
> http://groups.google.com/group/perl.dbi.users/browse_thread/thread/6ea69bfe603db
> 4f5/e70f0c2efc0819a4?hl=en
>
> and
>
> How to Handle Transparent Application Failover TAF with DBD-Oracle
> http://groups.google.com/group/perl.dbi.users/browse_thread/thread/e15d0e9ecc588
> 0ea/fc7c403d629391af?lnk=raot&hl=en#fc7c403d629391af
>
> In particular I could not believe I would have missed someone saying:
>
> "You can't do it. DBD::Oracle doesn't support TAF, direct loads or array
> interface. DBI is not database neutral. DBI is geared toward MySQL and
> PostgreSQL.
>
> DBD::Oracle is not being fixed because Tim Bunce is pushin open source
> databases, and Oracle driver isn't getting fixed and/or enriched with the new
> features. If you want a decent database driver, try with Python. "
>
> I cannot find these postings on the mail-archive.com or nntp.perl.org archives
> so where did they come from? Is this some sort of mailing list to news gateway
> issue I've missed?

The mailing list is closed - only signed up members can post.
There's no way for groups.google.com to enforce that restriction, so
'phantom' postings can appear at Google.  'Bart the Bear" has never
posted to dbi-users that I recall.

--
Jonathan Leffler <[EMAIL PROTECTED]>  #include 
Guardian of DBD::Informix - v2005.02 - http://dbi.perl.org
"I don't suffer from insanity - I enjoy every minute of it."


RE: Why can I find postings on google groups that I never saw on this list

2005-12-06 Thread Andy Hassall
> I cannot find these postings on the mail-archive.com or 
> nntp.perl.org archives
> so where did they come from? Is this some sort of mailing 
> list to news gateway
> issue I've missed?

It looks like the common factor in both cases is that the postings were
posted through Google Groups itself onto their view of the perl.dbi.users
newsgroup. 

It seems that postings made in this way don't get back to nntp.perl.org
(where they exist as newsgroups - they're not part of the Usenet hierarchy
proper), and so also don't make it to the corresponding mailing lists.

If this is the case, then it seems that Google Groups should either make
their version of the group read-only (this would seem to be the most
sensible option since it's really a mailing list you should subscribe to),
or fix the apparent propagation problem from postings made on their
interface back to the source (nntp.perl.org).

--
Andy Hassall :: [EMAIL PROTECTED] :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool 



RE: Why can I find postings on google groups that I never saw on this list

2005-12-06 Thread Martin J. Evans

On 06-Dec-2005 Andy Hassall wrote:
>> I cannot find these postings on the mail-archive.com or 
>> nntp.perl.org archives
>> so where did they come from? Is this some sort of mailing 
>> list to news gateway
>> issue I've missed?
> 
> It looks like the common factor in both cases is that the postings were
> posted through Google Groups itself onto their view of the perl.dbi.users
> newsgroup. 

Yes, thats how I saw it.

> It seems that postings made in this way don't get back to nntp.perl.org
> (where they exist as newsgroups - they're not part of the Usenet hierarchy
> proper), and so also don't make it to the corresponding mailing lists.
> 
> If this is the case, then it seems that Google Groups should either make
> their version of the group read-only (this would seem to be the most
> sensible option since it's really a mailing list you should subscribe to),
> or fix the apparent propagation problem from postings made on their
> interface back to the source (nntp.perl.org).

I find it rather disturbing I can be posting to the dbi-user list and someone
can answer on google groups and I don't see it. If google intend it to work
this way I'm amazed and rather worried as I didn't see anything on google
groups that made this clear.

Martin
--
Martin J. Evans
Easysoft Ltd, UK
Development



Re: Why can I find postings on google groups that I never saw on this list

2005-12-06 Thread Tim Bunce
On Tue, Dec 06, 2005 at 03:46:06PM -, Martin J. Evans wrote:
> I needed to find a thread I remembered from this mailing list and thought of
> the list of mailing list archives on the dbi.perl.org web page. I found what I
> was after in the groups.google.com archive but was surprised to see a number 
> of
> other posts I did not recollect. Examples are:
> 
> "DBD::Oracle for Oracle 9.2" thread started 1-dec-05
> http://groups.google.com/group/perl.dbi.users/browse_thread/thread/6ea69bfe603db
> 4f5/e70f0c2efc0819a4?hl=en
>  
> and
> 
> How to Handle Transparent Application Failover TAF with DBD-Oracle
> http://groups.google.com/group/perl.dbi.users/browse_thread/thread/e15d0e9ecc588
> 0ea/fc7c403d629391af?lnk=raot&hl=en#fc7c403d629391af
> 
> In particular I could not believe I would have missed someone saying:
> 
> "You can't do it. DBD::Oracle doesn't support TAF, direct loads or array
> interface. DBI is not database neutral. DBI is geared toward MySQL and
> PostgreSQL.
> 
> DBD::Oracle is not being fixed because Tim Bunce is pushin open source
> databases, and Oracle driver isn't getting fixed and/or enriched with the new
> features. If you want a decent database driver, try with Python. "
> 
> I cannot find these postings on the mail-archive.com or nntp.perl.org archives
> so where did they come from? Is this some sort of mailing list to news gateway
> issue I've missed?

Thanks for the heads up on this. I've posted this reply (via google groups):

---snip---

Bart the bear wrote:
> [EMAIL PROTECTED] wrote:
> > The Database Admins in the place where I work gave me the following the
> > tnsnames.ora entry and a couple others that look similar.
> >
> > stagging.rac =
> > (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST =
> > host.name.com)(PORT = 15)) (ADDRESS = (PROTOCOL = TCP)(HOST =
> > host.name.too.com)(PORT = 15)) (LOAD_BALANCE = yes) (FAILOVER = true))
> > (CONNECT_DATA = (SERVICE_NAME = stagging) ) )
> > I went poking around in the oracle.com site and found that this appears
> > to be Transparent Application Failover" (TAF).
> > http://www.oracle.com/ecostructure/blueprint_res/implement_database_configuration_availability.htm
> >
> >
> > Since I have been asked to setup a tool to do some work on this
> > database I went to try and find out how the DBD-Oracle handles this. So
> > far my google searches have come up with very little. Is there some
> > info or examples on how this is handled and/or how to format the
> > connect string?
> >
> > I am particularly interested in the connect string format that does not
> > require the use of the tnsnames.ora file but allows the host, port and
> > sid to be specified in the connect string.
> >
> > Example: DBI:Oracle:host=$host;sid=$sid;port=$port
> > If this is not currently supported has anyone tried to handle this
> > programmatically and know of any hidden fun in the way Oracle kicks the
> > failure out during failover?

Did you try it? That kind of connection string has been supported since 
DBD::Oracle 1.03 (12th July 1999) and is documented 
http://search.cpan.org/~timb/DBD-Oracle/Oracle.pm#Connecting_without_environment_variables_or_tnsname.ora_file

> > I did mistakenly post this question in
> > http://www.cpanforum.com/posts/1197

Very few people read cpanforum for DBI/DBD::Oracle related posts. Also, 
messages posted on google groups rarely get through to the dbi-users@perl.org 
mailing list.

It's only because someone posted a note about this thread on dbi-users@perl.org 
(where several thousand people are subscribed, including myself) that I'm 
replying here.

> You can't do it. DBD::Oracle doesn't support TAF, direct loads or array 
> interface.

DBD::Oracle supports using Oracle connection descriptions directly:

$dbh = DBI->connect('dbi:Oracle:', q{scott/tiger@(DESCRIPTION=
  (ADDRESS=(PROTOCOL=TCP)(HOST= foobar)(PORT=1521))
  (CONNECT_DATA=(SID=ORCL)))}, "");

I don't know if any deeper support is required for TAF, but if it is I'd be 
very happy to add it if someone sends me a patch.

> DBI is not database neutral. DBI is geared toward MySQL and PostgreSQL.

I don't know where you got that idea from, but it's wrong. DBD::Oracle was 
actually the very first DBI driver.

> DBD::Oracle is not being fixed because Tim Bunce is pushin open source 
> databases,

Also baseless and just plain wrong.

> and Oracle driver isn't getting fixed and/or enriched with the new features.

Also wrong. Real life has certainly delayed progress (most recently with the 
birth of my second daughter a few weeks ago) but the Oracle driver IS getting 
fixed and/or enriched with the new features. In fact 1.17 is about ready - a 
release candidate should be available within a week or two.

> If you want a decent database driver, try with Python.

Ah. Perhaps you're right, from your perspective, but I'd be grateful if you 
didn't promote other software by spreading misinformation about DBD::Oracle.

---snip---

Tim.


Re: Why can I find postings on google groups that I never saw on this list

2005-12-06 Thread David Nicol
On 12/6/05, Martin J. Evans <[EMAIL PROTECTED]> wrote:
>
> On 06-Dec-2005 Andy Hassall wrote:
> > If this is the case, then it seems that Google Groups should either make
> > their version of the group read-only (this would seem to be the most
> > sensible option since it's really a mailing list you should subscribe to),
> > or fix the apparent propagation problem from postings made on their
> > interface back to the source (nntp.perl.org).
>
> I find it rather disturbing I can be posting to the dbi-user list and someone
> can answer on google groups and I don't see it. If google intend it to work
> this way I'm amazed and rather worried as I didn't see anything on google
> groups that made this clear.

As a former usenet admin I can attest that configuing the news server
to propoagate
the perl.* groups out through nntp.perl.org would be trival.  If
nntp.perl.org wants to
allow unverified content arriving through that channel to get copied out to
subsciber-only mailing lists, that's another story, as usenet can be
awfully spammy.

Google has pretty good junk filters though, so maybe opening that channel would
be a good thing, if googlegroups doesn't send any junk through.


Re: Why can I find postings on google groups that I never saw on this list

2005-12-06 Thread Martin J. Evans

David Nicol wrote:

On 12/6/05, Martin J. Evans <[EMAIL PROTECTED]> wrote:


On 06-Dec-2005 Andy Hassall wrote:


If this is the case, then it seems that Google Groups should either make
their version of the group read-only (this would seem to be the most
sensible option since it's really a mailing list you should subscribe to),
or fix the apparent propagation problem from postings made on their
interface back to the source (nntp.perl.org).


I find it rather disturbing I can be posting to the dbi-user list and someone
can answer on google groups and I don't see it. If google intend it to work
this way I'm amazed and rather worried as I didn't see anything on google
groups that made this clear.



As a former usenet admin I can attest that configuing the news server
to propoagate
the perl.* groups out through nntp.perl.org would be trival.  If
nntp.perl.org wants to
allow unverified content arriving through that channel to get copied out to
subsciber-only mailing lists, that's another story, as usenet can be
awfully spammy.

Google has pretty good junk filters though, so maybe opening that channel would
be a good thing, if googlegroups doesn't send any junk through.


What particularly worried me (and why I included it) was the total
misinformation (and I'm seriously holding back here) in a posting which 
went unanswered because we did not see it. Had that posting appeared in 
dbi-users I am sure there would have been no shortage of responses.


It almost seems like the mailing list has been userped in some way.
All conversation in one room is overheard by all interested parties
and all conversation in another room is only available to those who
turn up there too. I don't want to (and probably won't) look in two 
places for an reponse to a thread.


I can't pretend otherwise, I don't like what has happened here in google 
groups and was so surprised when I discovered it I first started looking

into my spam filters assuming some postings had been filtered out.

Martin


DBD::Oracle 2nd insert of row into table with 2 CLOBs hangs

2005-12-06 Thread Joe Slagel
Hi Tim & Folks,

We've found a interesting problem when inserting multiple rows into a
table containing two CLOB columns.  The second execute() hangs and
Oracle never responds.  The execute() hangs only when the character
sizes of the two strings are larger than 4000 characters each, and even
then not always. Code is below which demonstrates problem.  Any clues as
to whether this is in the DBD layer or in Oracle?

Thanks!!!

DBI Version:1.48
DBD::Oracle Version:1.16
Oracle Version: Oracle9i Release 9.2.0.7.0
Operating System:   Linux
Perl Version:   5.8.7

Code:



#!/usr/bin/perl -w
use strict;

use DBI;

$| = 1;

my $quals   = join ' ', map { $_ } ( 0..1022 );
my $discrep = join ' ', map { $_ } ( 0..1022 );

my $dbh = DBI->connect( 'DBI:Oracle:host=ora9sun;sid=ora9sun;port=1521',
'wollaston', '**', { AutoCommit => 0 } );

$dbh->do( "DROP TABLE badins" );
$dbh->do( "CREATE TABLE badins ( q  CLOB, d  CLOB )" );
$dbh->commit();

my $ins = $dbh->prepare( 'INSERT INTO badins ( q, d ) VALUES ( ?, ? )' );
for ( 1..2 )
   {
   print "length: ", (length ($quals) + length ($discrep)), "\n";
   print( "inserting..." );
   $ins->execute( $quals, $discrep );
   print( "done\n" );
   }
$dbh->rollback();

$dbh->do( "DROP TABLE badins" );
$dbh->commit();
 


--
Joe Slagel
Chief Software Architect
Geospiza Inc
www.geospiza.com




Installing DBI

2005-12-06 Thread Elton Hughes

Hello All,

Happy days are here. We have a brand new server. Our 11 year old Sun  
box is being retired and an new one is replacing it. Unfortunately I  
need to get DBI and DBD:Informix installed on the new system. I have  
not had to install anything in a long time. So bear with me, I am  
rusty at this.


Can I use the CPAN module to do this? If so, would 'install DBI' be  
the proper command? Followed by 'install DBD::Informix'?


Thanks!

Elton


=
 NOVA505 W. Olive Ave. Suite 550
 Elton Hughes (IT)Sunnyvale CA 94086
 Phone: 408-730-7235   Fax: 408-730-7643
-




Re: Installing DBI on Solaris for DBD::informix

2005-12-06 Thread Jonathan Leffler
On 12/6/05, Elton Hughes <[EMAIL PROTECTED]> wrote:
>
>
> Happy days are here. We have a brand new server. Our 11 year old Sun
> box is being retired and an new one is replacing it. Unfortunately I
> need to get DBI and DBD:Informix installed on the new system. I have
> not had to install anything in a long time. So bear with me, I am
> rusty at this.
>
> Can I use the CPAN module to do this? If so, would 'install DBI' be
> the proper command? Followed by 'install DBD::Informix'?


Yes, with caveats.

Presumably you're using Solaris 10?

I suggest looking hard at building your own Perl rather than using the one
distributed by Sun.

You need to get CPAN up and running (or CPANPLUS).  That's not too hard:

perl -MCPAN -e 'install Bundle::CPAN'

Before installing DBD::Informix, you need a working version of CSDK
(ClientSDK).
Working means, primarily, that you can connect to an IDS database whereever
you keep the database server, whether on the new Sun box or somewhere else.
That piece of configuration is independent of DBD::Informix, and the
Makefile.PL script insists that you do it.  (Well, you can override the test
- read the documentation; it is not recommended.)

If you have a working CSDK, then your outline is fine.

(Oh, I assume you have the correct C compiler for your Perl; if not, rebuild
Perl with the compiler you do have.)

--
Jonathan Leffler <[EMAIL PROTECTED]>  #include 
Guardian of DBD::Informix - v2005.02 - http://dbi.perl.org
"I don't suffer from insanity - I enjoy every minute of it."