Things missing from DBI-1.31

2002-11-30 Thread Steven N. Hirsch
Tim,

The following bits of my Proxy patches seem to be missing from the
released DBI-1.31.  I can assure you that localizing the 'die' handler is
quite necessary to keep client behavior the same between direct connect
and proxy connect.  If you no longer have my message with the original
rationale, let me know and I can resend.

Regards,

Steve



--- DBI-1.31/lib/DBD/Proxy.pm.orig  Fri Oct 11 12:13:45 2002
+++ DBI-1.31/lib/DBD/Proxy.pm   Wed Sep 18 09:56:20 2002
@@ -234,6 +234,7 @@
  'type' => $type,
  'h' => "DBI::_::$type"
);
+local $SIG{__DIE__} = 'DEFAULT';
 my $method_code = UNIVERSAL::can($expand{'h'}, $method) ?
q/package ~class~;
   sub ~method~ {
@@ -283,6 +284,7 @@
 }
 
 if ($type eq 'remote'  ||  $type eq 'cached') {
+local $SIG{__DIE__} = 'DEFAULT';
my $result = eval { $dbh->{'proxy_dbh'}->STORE($attr => $val) };
return DBD::Proxy::proxy_set_err($dbh, $@) if $@; # returns undef
$dbh->{$attr} = $val if $type eq 'cached';
@@ -302,6 +304,7 @@
 
 return $dbh->SUPER::FETCH($attr) unless $type eq 'remote';
 
+local $SIG{__DIE__} = 'DEFAULT';
 my $result = eval { $dbh->{'proxy_dbh'}->FETCH($attr) };
 return DBD::Proxy::proxy_set_err($dbh, $@) if $@;
 return $result;
@@ -320,6 +323,7 @@
 if ( $proto_ver > 1 ) {
   $sth->{'proxy_attr_cache'} = {cache_filled => 0};
   my $rdbh = $dbh->{'proxy_dbh'};
+  local $SIG{__DIE__} = 'DEFAULT';
   my $rsth = eval { $rdbh->prepare($sth->{'Statement'}, $sth->{'proxy_attr'}, 
undef, $proto_ver) };
   return DBD::Proxy::proxy_set_err($sth, $@) if $@;
   return DBD::Proxy::proxy_set_err($sth, "Constructor didn't return a handle: 
$rsth")
@@ -355,7 +359,7 @@
 #$dbh->{'proxy_quote'} = 'backslash_escaped';
 # for example.
 # Jochen
-
+local $SIG{__DIE__} = 'DEFAULT';
 my $result = eval { $dbh->{'proxy_dbh'}->quote(@_) };
 return DBD::Proxy::proxy_set_err($dbh, $@) if $@;
 return $result;
@@ -365,6 +369,7 @@
 my $dbh = shift;
 my $rdbh = $dbh->{'proxy_dbh'};
 #warn "table_info(@_)";
+local $SIG{__DIE__} = 'DEFAULT';
 my($numFields, $names, $types, @rows) = eval { $rdbh->table_info(@_) };
 return DBD::Proxy::proxy_set_err($dbh, $@) if $@;
 my $sth = DBI::_new_sth($dbh, {
@@ -395,6 +400,7 @@
 
 sub type_info_all {
 my $dbh = shift;
+local $SIG{__DIE__} = 'DEFAULT';
 my $result = eval { $dbh->{'proxy_dbh'}->type_info_all(@_) };
 return DBD::Proxy::proxy_set_err($dbh, $@) if $@;
 return $result;
@@ -450,6 +456,7 @@
 
 my ($numRows, @outData);
 
+local $SIG{__DIE__} = 'DEFAULT';
 if ( $proto_ver > 1 ) {
   ($numRows, @outData) = eval { $rsth->execute($params, $proto_ver) };
   return DBD::Proxy::proxy_set_err($sth, $@) if $@;
@@ -527,6 +534,7 @@
die "Attempt to fetch row without execute";
}
my $num_rows = $sth->FETCH('RowCacheSize') || 20;
+   local $SIG{__DIE__} = 'DEFAULT';
my @rows = eval { $rsth->fetch($num_rows) };
return DBD::Proxy::proxy_set_err($sth, $@) if $@;
unless (@rows == $num_rows) {
@@ -559,6 +567,7 @@
? $sth->{'proxy_no_finish'}
: $sth->FETCH('Database')->{'proxy_no_finish'};
 unless ($no_finish) {
+local $SIG{__DIE__} = 'DEFAULT';
my $result = eval { $rsth->finish() };
return DBD::Proxy::proxy_set_err($sth, $@) if $@;
return $result;
@@ -581,6 +590,7 @@
 
 if ($type eq 'remote') {
my $rsth = $sth->{'proxy_sth'}  or  return undef;
+local $SIG{__DIE__} = 'DEFAULT';
my $result = eval { $rsth->STORE($attr => $val) };
return DBD::Proxy::proxy_set_err($sth, $@) if ($@);
return $result;
@@ -610,6 +620,7 @@
 
 if ($type ne 'local') {
my $rsth = $sth->{'proxy_sth'}  or  return undef;
+local $SIG{__DIE__} = 'DEFAULT';
my $result = eval { $rsth->FETCH($attr) };
return DBD::Proxy::proxy_set_err($sth, $@) if $@;
return $result;
--- DBI-1.31/lib/DBI/ProxyServer.pm.origTue Oct 29 05:00:57 2002
+++ DBI-1.31/lib/DBI/ProxyServer.pm Tue Sep 17 13:20:02 2002
@@ -220,7 +220,7 @@
 my $msg = $@;
 undef $dbh->{'private_server'};
 if ($msg) {
-   $server->Error($msg);
+   $server->Debug("CallMethod died with: $@");
die $msg;
 } else {
$server->Debug("CallMethod: <= " . join(",", @result));




Re: ANNOUNCE: DBD::Pg 1.20

2002-11-30 Thread Dave Rolsky
On Sat, 30 Nov 2002, Thomas A. Lowery wrote:

> On Sat, Nov 30, 2002 at 10:47:09AM -0700, Jason E. Stewart wrote:
> > "Dave Rolsky" <[EMAIL PROTECTED]> writes:
> >
> > > I found a bug in the ->tables method.  It includes all the system tables.
> > > A patch is at the bottom of the message.
>
> I modified the tables and table_info methods to include the system tables.

Why?  It's really pretty irritating since they _always_ will be included.
And you didn't modify the docs to match, since they still say that they're
_not_ included.


-dave

/*==
www.urth.org
we await the New Sun
==*/



DBD::Pg tables() (was Re: ANNOUNCE: DBD::Pg 1.20)

2002-11-30 Thread David Wheeler
On Saturday, November 30, 2002, at 01:18  PM, Thomas A. Lowery wrote:


IMHO: a Pg only function is not a good option.  It's very difficult to 
write
portable code.

Fair enough.


The DBI doc reads:
   "tables"
   Warning: This method is experimental and may change.

 @names = $dbh->tables( $catalog, $schema, $table, $type );
 @names = $dbh->tables;# deprecated





With the "table" method including catalog, schema, and type, I can see 
no reason to
exclude the system tables.

Well, since it appears that DBD::Pg's tables() method currently doesn't 
support the $catalog, $schema, $table, $type arguments, perhaps it 
should be updated to do so, and have the deprecated call to tables() 
with no args not return system tables.

Thoughts?

David

P.S.: PostgreSQL 7.3 support schemas, so the argument form of tables() 
may be more valuable than ever.

--
David Wheeler AIM: dwTheory
[EMAIL PROTECTED] ICQ: 15726394
http://david.wheeler.net/  Yahoo!: dew7e
   Jabber: [EMAIL PROTECTED]



Minor bug? segfault with fetchrow_hashref false syntax

2002-11-30 Thread Ian Barwick
Hi

A bug report for a segfault caused by wrong syntax in
fetchrow_hashref:

I meant to write:

  my $ref = $q->fetchall_hashref('foo_id');

but I actually wrote:

  my $ref = $q->fetchrow_hashref('foo_id');

and got a segmentation fault.

When I replace 'foo_id' with 'FOO_ID' I get 

Can't get DBI::st=HASH(0x80f38e0)->{FOO_ID}: unrecognised attribute at 
hashref.pl line 11.

The same occurs with both DBI::Oracle (1.12) and DBD::Pg (1.12)
using DBI 1.30.

As the problem only occurs through erroneous syntax, I presume
it's non-critical/urgent, but thought a report might be useful.


Ian Barwick
[EMAIL PROTECTED]




Re: Taint tests disabled in DBI-1.31

2002-11-30 Thread David Wheeler
On Saturday, November 30, 2002, at 02:24  PM, Steven N. Hirsch wrote:


Is 1.31 released?  If not, where can I grab a preview?


Yes it is. Available on the CPAN.

David

--
David Wheeler AIM: dwTheory
[EMAIL PROTECTED] ICQ: 15726394
http://david.wheeler.net/  Yahoo!: dew7e
   Jabber: [EMAIL PROTECTED]




Re: Taint tests disabled in DBI-1.31

2002-11-30 Thread Steven N. Hirsch
On Sat, 30 Nov 2002, Bradley Baetz wrote:

> Tim,
> 
> The tests for the new Taint stuff which was added appear to be disabled
> in 1.31 - line 227 has
> 
> if (0 && is_tainted($^X) && !$DBI::PurePerl) {
> 
> Was there a reason for this? Thats not in the final pach which I sent,
> and the tests pass for me.

Is 1.31 released?  If not, where can I grab a preview?






Re: ANNOUNCE: DBD::Pg 1.20

2002-11-30 Thread Thomas A. Lowery
On Sat, Nov 30, 2002 at 12:51:14PM -0800, David Wheeler wrote:
> On Saturday, November 30, 2002, at 12:47  PM, Thomas A. Lowery wrote:
> 
> >I modified the tables and table_info methods to include the system 
> >tables.
> 
> Okay, so the question is, is this a desirable change? Do people want to 
> know about the system tables or not? Is there a standard answer to this 
> question? Should we have a separate method that includes system tables?

IMHO: a Pg only function is not a good option.  It's very difficult to write
portable code.

The DBI doc reads:
   "tables"
   Warning: This method is experimental and may change.

 @names = $dbh->tables( $catalog, $schema, $table, $type );
 @names = $dbh->tables;# deprecated

   Simple interface to table_info( ). Returns a list of
   matching table names, possibly including a cata­
   log/schema prefix.

   See "table_info" for a description of the parameters.

   If "$dbh-">"get_info(29)" returns true (29 is
   SQL_IDENTIFIER_QUOTE_CHAR) then the table names are
   constructed and quoted by "quote_identifier" to ensure
   they are usable even if they contain whitespace or
   reserved words etc.

With the "table" method including catalog, schema, and type, I can see no reason to
exclude the system tables.

-- 
Thomas A. Lowery
See DBI/FAQ http://xmlproj.dyndns.org/cgi-bin/fom




Re: ANNOUNCE: DBD::Pg 1.20

2002-11-30 Thread David Wheeler
On Saturday, November 30, 2002, at 12:47  PM, Thomas A. Lowery wrote:


I modified the tables and table_info methods to include the system 
tables.

Okay, so the question is, is this a desirable change? Do people want to 
know about the system tables or not? Is there a standard answer to this 
question? Should we have a separate method that includes system tables?

Enquiring minds want to know!

Best,

David

--
David Wheeler AIM: dwTheory
[EMAIL PROTECTED] ICQ: 15726394
http://david.wheeler.net/  Yahoo!: dew7e
   Jabber: [EMAIL PROTECTED]



Re: ANNOUNCE: DBD::Pg 1.20

2002-11-30 Thread Thomas A. Lowery
On Sat, Nov 30, 2002 at 10:47:09AM -0700, Jason E. Stewart wrote:
> "Dave Rolsky" <[EMAIL PROTECTED]> writes:
> 
> > I found a bug in the ->tables method.  It includes all the system tables.
> > A patch is at the bottom of the message.

I modified the tables and table_info methods to include the system tables.

> > I'd like to offer a test patch but I don't know exactly what you'd expect
> > to find in the schema during testing.
> 
> t/01setup.t has the following:
> 
>   my $sql = <   CREATE TABLE test (
> id int,
> name text,
> val text,
> score float,
> date timestamp default 'now()'
>   )
>   SQL

-- 
Thomas A. Lowery
See DBI/FAQ http://xmlproj.dyndns.org/cgi-bin/fom



Re: ANNOUNCE: DBD::Pg 1.20

2002-11-30 Thread Jason E. Stewart
"Jason E. Stewart" <[EMAIL PROTECTED]> writes:

> "Dave Rolsky" <[EMAIL PROTECTED]> writes:
> 
> > I found a bug in the ->tables method.  It includes all the system tables.
> > A patch is at the bottom of the message.
> 
> Thanks Dave,

Patch applied and committed. It will appear in the next release of
DBD::Pg. 

jas.



DBI 1.31 Warnings

2002-11-30 Thread David Wheeler
I got some warnings while compiling DBI 1.31 on Mac OS X 10.2.2. Here's 
the version of gcc I'm using:

mercury% cc -v
Reading specs from /usr/libexec/gcc/darwin/ppc/3.1/specs
Thread model: posix
Apple Computer, Inc. GCC version 1161, based on gcc version 3.1 
20020420 (prerelease)

and the warnings:

/usr/local/bin/perl /usr/local/lib/perl5/5.8.0/ExtUtils/xsubpp  
-typemap /usr/local/lib/perl5/5.8.0/ExtUtils/typemap  Perl.xs > 
Perl.xsc && mv Perl.xsc Perl.c
cc -c   -I/sw/include -pipe -fno-common -no-cpp-precomp 
-fno-strict-aliasing -O3   -DVERSION=\"1.31\" -DXS_VERSION=\"1.31\"  
"-I/usr/local/lib/perl5/5.8.0/darwin/CORE"  -Wall -Wno-comment 
-DDBI_NO_THREADS Perl.c
Perl.xsi: In function `XS_DBD__Perl__st__prepare':
Perl.xsi:303: warning: operation on `lna' may be undefined
Perl.xsi: In function `XS_DBD__Perl__st_bind_param':
Perl.xsi:339: warning: operation on `lna' may be undefined
Perl.xsi: In function `XS_DBD__Perl__st_bind_param_inout':
Perl.xsi:375: warning: operation on `lna' may be undefined
/usr/local/bin/perl /usr/local/lib/perl5/5.8.0/ExtUtils/xsubpp  
-typemap /usr/local/lib/perl5/5.8.0/ExtUtils/typemap  DBI.xs > DBI.xsc 
&& mv DBI.xsc DBI.c
cc -c   -I/sw/include -pipe -fno-common -no-cpp-precomp 
-fno-strict-aliasing -O3   -DVERSION=\"1.31\" -DXS_VERSION=\"1.31\"  
"-I/usr/local/lib/perl5/5.8.0/darwin/CORE"  -Wall -Wno-comment 
-DDBI_NO_THREADS DBI.c
In file included from DBI.xs:1355:
DBI.xs: In function `dbih_set_attr_k':
DBI.xs:536: warning: passing arg 0 of `set_trace' from incompatible 
pointer type
DBI.xs: In function `XS_DBD_st_bind_col':
DBI.xs:3366: warning: operation on `lna' may be undefined
DBI.xs: In function `XS_DBD_st_bind_columns':
DBI.xs:3387: warning: operation on `lna' may be undefined

Regards,

David
--
David Wheeler AIM: dwTheory
[EMAIL PROTECTED] ICQ: 15726394
http://david.wheeler.net/  Yahoo!: dew7e
   Jabber: [EMAIL PROTECTED]



Re: ANNOUNCE: DBD::Pg 1.20

2002-11-30 Thread Jason E. Stewart
"Dave Rolsky" <[EMAIL PROTECTED]> writes:

> I found a bug in the ->tables method.  It includes all the system tables.
> A patch is at the bottom of the message.

Thanks Dave,

> The SQL was correct in 1.13 so I'm not sure how this happened.  There's
> also no real test of this method in the test suite, other than testing to
> make sure that calling it doesn't die.  But you need to test that it
> returns the right thing too ;)
> 
> I'd like to offer a test patch but I don't know exactly what you'd expect
> to find in the schema during testing.

t/01setup.t has the following:

  my $sql = <


Taint tests disabled in DBI-1.31

2002-11-30 Thread Bradley Baetz
Tim,

The tests for the new Taint stuff which was added appear to be disabled
in 1.31 - line 227 has

if (0 && is_tainted($^X) && !$DBI::PurePerl) {

Was there a reason for this? Thats not in the final pach which I sent,
and the tests pass for me.

Thanks,

Bradley