Skip to content

Commit

Permalink
Remove the redefer stuff for now.
Browse files Browse the repository at this point in the history
This is a partial reversion of 22515, but that commit included quite a
lot of general cleanup as well.
  • Loading branch information
mauzo committed Feb 25, 2012
1 parent b0abade commit fe25747
Showing 1 changed file with 5 additions and 22 deletions.
27 changes: 5 additions & 22 deletions lib/DBIx/Irian/Query.pm
Expand Up @@ -30,10 +30,8 @@ use overload
fallback => 1;

my $Defer = "DBIx::Irian::Query";
my $Redefer = "DBIx::Irian::Query::Redefer";

sub is_defer ($) { blessed $_[0] and blessed $_[0] eq $Defer }
sub is_redefer ($) { blessed $_[0] and blessed $_[0] eq $Redefer }
sub is_cv ($) {
ref $_[0] and not blessed $_[0] and reftype $_[0] eq "CODE" }

Expand All @@ -47,22 +45,9 @@ sub new {
sub defer (&$) {
$Defer->new(subname $_[1], $_[0]);
}
sub redefer ($) {
is_defer $_[0] or croak "redefer of non-deferred '$_[0]'";
bless $_[0], $Redefer;
}
sub placeholder (&$);
sub placeholder (&$) {
my ($cv, $n) = @_;
$Defer->new(
sub {
my ($q) = @_;
$q->{db} and return "?";
my $val = $cv->($q);
redefer placeholder { $val } $n;
},
subname($n, $cv),
) ;
$Defer->new("?", subname($n, $cv));
}

sub djoin {
Expand Down Expand Up @@ -91,9 +76,8 @@ sub concat {
my (@str, @val);
($str[0], $val[0]) = @$left;
($str[1], $val[1]) =
is_redefer $right ? ([$right], [])
: is_defer $right ? @$right
: (["$right"], []);
is_defer $right ? @$right :
(["$right"], []);

my @ord = $reverse ? (1, 0) : (0, 1);
bless [[map @$_, @str[@ord]], [map @$_, @val[@ord]]], $Defer;
Expand All @@ -117,7 +101,6 @@ sub undefer {
my ($d, $q) = @_;
#no overloading;
is_cv $d and $d = $d->($q);
is_redefer $d and bless $d, $Defer;
#no warnings "uninitialized";
#trace EXP => "UNDEFER [$_[0]] -> [$d]";
$d;
Expand Down Expand Up @@ -155,8 +138,8 @@ tie %Q, "Tie::OneOff", sub {
my ($q) = @_;
my $id = qex $k, $q;

# If we haven't got a DB yet, re-defer
$q->{db} or return redefer $Q{$id};
# If we haven't got a DB yet, croak
$q->{db} or croak "can't use %Q without a db";

$q->{dbh} ||= $q->{db}->dbh;
$q->{dbh}->quote_identifier($id)
Expand Down

0 comments on commit fe25747

Please sign in to comment.