[Sqlrelay-discussion] SQLRelay perl API - sub-classing SQLRelay::Cursor
Brought to you by:
mused
|
From: Victor <vi...@vs...> - 2007-03-01 15:00:17
|
Hello!
I have a problem with perl SQLRelay API.
I want to sub-class SQLRelay classes to add few methods for myself.
like
package MySQLRelayCursor;
use base SQLRelay::Cursor;
i want to add few fields as well
sub new {
my ($class, $con)=@_;
return undef unless defined $con;
my $self=SQLRelay::Cursor->new($con);
$self->getNullsAsUndefined(); # it is a real mess when you see mysql nulls as empty strings
$self->{MyField1} = 1; # new field!
$self->{MyField2} = 2; # new field!
bless $self, $class;
return $self;
}
and i am getting error
Not a HASH reference at /path/to/file ...
I think this means that you have no line like
my $self = {}; # ref to empty hash
in SQLRelay::Cursor::new or XS analog
Am I wrong ?
Maybe i just have some error in connections and in normal situation it returns hash ref ?
What is the best way to inherit SQLRelay::Cursor ? Maybe better make it aggregated object ?
What is the best practice for this ?
--
BR/Victor mailto:vi...@vs...
|