@ISA
=
qw(DBIx::SearchBuilder::Handle)
;
use
vars
qw($VERSION @ISA $DBIHandle $DEBUG)
;
sub
Insert {
my
$self
=
shift
;
my
$sth
=
$self
->SUPER::Insert(
@_
);
if
(!
$sth
) {
print
"no sth! ("
.
$self
->dbh->{ix_sqlerrd}[1].
")\n"
;
return
(
$sth
);
}
$self
->{id}=
$self
->dbh->{ix_sqlerrd}[1];
warn
"$self no row id returned on row creation"
unless
(
$self
->{
'id'
});
return
(
$self
->{
'id'
});
}
sub
CaseSensitive {
my
$self
=
shift
;
return
(1);
}
sub
BuildDSN {
my
$self
=
shift
;
my
%args
= (
Driver
=>
undef
,
Database
=>
undef
,
Host
=>
undef
,
Port
=>
undef
,
SID
=>
undef
,
RequireSSL
=>
undef
,
@_
);
my
$dsn
=
"dbi:$args{'Driver'}:"
;
$dsn
.=
"$args{'Database'}"
if
(
defined
$args
{
'Database'
} &&
$args
{
'Database'
});
$self
->{
'dsn'
}=
$dsn
;
}
sub
ApplyLimits {
my
$self
=
shift
;
my
$statementref
=
shift
;
my
$per_page
=
shift
;
my
$first
=
shift
;
if
(
$per_page
) {
$$statementref
=~ s[^\s
*SELECT
][SELECT FIRST
$per_page
]i;
}
}
sub
Disconnect {
my
$self
=
shift
;
if
(
$self
->dbh) {
my
$status
=
$self
->dbh->disconnect();
$self
->dbh(
undef
);
return
$status
;
}
else
{
return
;
}
}
sub
DistinctQuery {
my
$self
=
shift
;
my
$statementref
=
shift
;
my
$table
=
shift
;
$$statementref
=
"SELECT * FROM $table main WHERE id IN ( SELECT DISTINCT main.id FROM $$statementref )"
;
}