RE: [PATCH] using Class::DBI with Sybase
[prev]
[thread]
[next]
[Date index for 2005/02/21]
From: ivor.williams@xxx.xxx Sent: 21 February 2005 17:59
>=20
> This fixes a couple of problems:
>=20
> 1. Mixed case columns. Sybase column names are case=20
> sensitive.
<snip>
> 2. Statement handle is "Active" but query has not been run=20
> and no column information is available.
<snip>
These sound like sybase specific issues. Have you looked at
Class::DBI::Sybase?
http://search.cpan.org/~daniel/Class-DBI-Sybase-0.31/Sybase.pm
Would be a better place for this code and already appears to
cover the handle is Active problem.
mark
--
> Ivor.
>=20
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- lib/Class/DBI.pm.orig=20
> +++ lib/Class/DBI.pm=20
> @@ -1125,6 +1125,11 @@
> $sth->bind_columns(\(@data{ @{ $sth->{NAME_lc} } }));
> push @rows, {%data} while $sth->fetch;
> };
> + eval {
> + $sth->execute(@$args);
> + $sth->bind_columns(\(@data{ @{ $sth->{NAME_lc} } }));
> + push @rows, {%data} while $sth->fetch;
> + } if $@;
> return $class->_croak("$class can't=20
> $sth->{Statement}: $@", err =3D> $@)
> if $@;
> return $class->_ids_to_objects(\@rows);
>=20
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- lib/Class/DBI/Column.pm.orig
> +++ lib/Class/DBI/Column.pm
> @@ -56,7 +56,20 @@
> );
> }
> =20
> -sub name_lc { lc shift->name }
> +our $FetchHashKeyName =3D 'NAME_lc';
> +=20
> +sub name_lc {=20
> + my $name =3D shift->name;
> + if ($FetchHashKeyName eq 'NAME_lc') {
> + lc $name;
> + }
> + elsif ($FetchHashKeyName eq 'NAME_uc') {
> + uc $name;
> + }
> + else {
> + $name;
> + }
> + }
> =20
> sub add_group {
> my ($self, $group) =3D @_;
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>=20
This email (and any attachments) is intended solely for the individual(s) t=
o whom addressed.=20
It may contain confidential and/or legally privileged information.=20
Any statement or opinions therein are not necessarily those of ITN unless s=
pecifically stated.=20
Any unauthorised use, disclosure or copying is prohibited.=20
If you have received this email in error, please notify the sender and dele=
te it from your system.=20
Security and reliability of the e-mail and attachments are not guaranteed.=20
You must take full responsibility for virus checking.
Independent Television News Limited,=20
Registered No. 548648 England,
VAT Reg. No: GB 756 2995 81,=20
200 Gray's Inn Road, London WC1X 8XZ,
Telephone: 020 7833 3000.
|
|
RE: [PATCH] using Class::DBI with Sybase
Addison, Mark 20:00 on 21 Feb 2005
|