'namespace::clean' => '0.24',
'Path::Class' => '0.18',
'Scope::Guard' => '0.03',
- 'SQL::Abstract' => '1.78',
+ 'SQL::Abstract' => '1.78_02', # TEMPORARY
'Try::Tiny' => '0.07',
# Technically this is not a core dependency - it is only required
use warnings;
use base 'DBIx::Class::Row';
-use DBIx::Class::_Util 'is_literal_value';
+use SQL::Abstract 'is_literal_value';
use namespace::clean;
sub filter_column {
use warnings;
use base 'DBIx::Class::Row';
-use DBIx::Class::_Util 'is_literal_value';
+use SQL::Abstract 'is_literal_value';
use namespace::clean;
=head1 NAME
use List::Util 'first';
use Try::Tiny;
use DBIx::Class::Carp;
-use DBIx::Class::_Util 'is_literal_value';
+use SQL::Abstract 'is_literal_value';
###
### Internal method
use Context::Preserve 'preserve_context';
use Try::Tiny;
use Data::Compare (); # no imports!!! guard against insane architecture
-use DBIx::Class::_Util qw(is_plain_value is_literal_value);
+use SQL::Abstract qw(is_plain_value is_literal_value);
use namespace::clean;
# default cursor class, overridable in connect_info attributes
use base qw/DBIx::Class::Storage::DBI/;
use mro 'c3';
-use DBIx::Class::_Util qw(modver_gt_or_eq sigwarn_silencer is_plain_value);
+use SQL::Abstract 'is_plain_value';
+use DBIx::Class::_Util qw(modver_gt_or_eq sigwarn_silencer);
use DBIx::Class::Carp;
use Try::Tiny;
use namespace::clean;
use List::Util 'first';
use Scalar::Util 'blessed';
use Sub::Name 'subname';
-use DBIx::Class::_Util qw(is_plain_value is_literal_value UNRESOLVABLE_CONDITION);
+use DBIx::Class::_Util 'UNRESOLVABLE_CONDITION';
+use SQL::Abstract qw(is_plain_value is_literal_value);
use namespace::clean;
#
use Carp 'croak';
use Scalar::Util qw(weaken blessed reftype);
use List::Util qw(first);
-use overload ();
use base 'Exporter';
our @EXPORT_OK = qw(
sigwarn_silencer modver_gt_or_eq fail_on_internal_wantarray
refdesc refcount hrefaddr is_exception
- is_plain_value is_literal_value
UNRESOLVABLE_CONDITION
);
eval { $mod->VERSION($ver) } ? 1 : 0;
}
-sub is_literal_value ($) {
- (
- ref $_[0] eq 'SCALAR'
- or
- ( ref $_[0] eq 'HASH' and keys %{$_[0]} == 1 and defined $_[0]->{-ident} and ! length ref $_[0]->{-ident} )
- or
- ( ref $_[0] eq 'REF' and ref ${$_[0]} eq 'ARRAY' )
- ) ? 1 : 0;
-}
-
-# FIXME XSify - this can be done so much more efficiently
-sub is_plain_value ($) {
- no strict 'refs';
- (
- # plain scalar
- (! length ref $_[0])
- or
- (
- blessed $_[0]
- and
- # deliberately not using Devel::OverloadInfo - the checks we are
- # intersted in are much more limited than the fullblown thing, and
- # this is a relatively hot piece of code
- (
- # FIXME - DBI needs fixing to stringify regardless of DBD
- #
- # either has stringification which DBI SHOULD prefer out of the box
- #first { *{$_ . '::(""'}{CODE} } @{ mro::get_linear_isa( ref $_[0] ) }
- overload::Method($_[0], '""')
- or
- # has nummification and fallback is *not* disabled
- (
- $_[1] = first { *{"${_}::(0+"}{CODE} } @{ mro::get_linear_isa( ref $_[0] ) }
- and
- ( ! defined ${"$_[1]::()"} or ${"$_[1]::()"} )
- )
- )
- )
- ) ? 1 : 0;
-}
-
{
my $list_ctx_ok_stack_marker;
Class::Accessor::Grouped
Class::C3::Componentised
+ SQL::Abstract
));
require DBICTest::Schema;
{
register_lazy_loadable_requires(qw(
DBI
- SQL::Abstract
Hash::Merge
));
last;
}
}
- fail ("${mod}::${name} appears to have entered inheritance chain by import into "
- . ($via || 'UNKNOWN')
- );
+
+ # exception time
+ if (
+ ( $name eq 'import' and $via = 'Exporter' )
+ ) {
+ pass("${mod}::${name} is a valid uncleaned import from ${name}");
+ }
+ else {
+ fail ("${mod}::${name} appears to have entered inheritance chain by import into "
+ . ($via || 'UNKNOWN')
+ );
+ }
}
}
use DBIx::Class::Optional::Dependencies ();
use lib qw(t/lib);
use DBICTest;
-use DBIx::Class::_Util 'is_literal_value';
+use SQL::Abstract 'is_literal_value';
plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_rdbms_pg')
unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_rdbms_pg');
+++ /dev/null
-use warnings;
-use strict;
-
-use Test::More;
-use Test::Warn;
-
-use lib qw(t/lib);
-use DBICTest;
-
-use DBIx::Class::_Util 'is_plain_value';
-
-{
- package # hideee
- DBICTest::SillyInt;
-
- use overload
- # *DELIBERATELY* unspecified
- #fallback => 1,
- '0+' => sub { ${$_[0]} },
- ;
-
-
- package # hideee
- DBICTest::SillyInt::Subclass;
-
- our @ISA = 'DBICTest::SillyInt';
-
-
- package # hideee
- DBICTest::CrazyInt;
-
- use overload
- '0+' => sub { 666 },
- '""' => sub { 999 },
- fallback => 1,
- ;
-}
-
-# check DBI behavior when fed a stringifiable/nummifiable value
-{
- my $crazynum = bless {}, 'DBICTest::CrazyInt';
- cmp_ok( $crazynum, '==', 666 );
- cmp_ok( $crazynum, 'eq', 999 );
-
- my $schema = DBICTest->init_schema( no_populate => 1 );
- $schema->storage->dbh_do(sub {
- $_[1]->do('INSERT INTO artist (name) VALUES (?)', {}, $crazynum );
- });
-
- is( $schema->resultset('Artist')->next->name, 999, 'DBI preferred stringified version' );
-}
-
-# make sure we recognize overloaded stuff properly
-{
- my $num = bless( \do { my $foo = 69 }, 'DBICTest::SillyInt::Subclass' );
- ok( is_plain_value $num, 'parent-fallback-provided stringification detected' );
- is("$num", 69, 'test overloaded object stringifies, without specified fallback');
-}
-
-done_testing;
use lib qw(t/lib);
use DBICTest ':DiffSQL';
-use DBIx::Class::_Util qw(UNRESOLVABLE_CONDITION modver_gt_or_eq);
+use DBIx::Class::_Util 'UNRESOLVABLE_CONDITION';
use Data::Dumper;
efcc_result => { 'group.is_active' => 1, 'me.is_active' => 1 },
},
- # need fixed SQLA to correctly work with this
- #
- ( modver_gt_or_eq('SQL::Abstract', '1.78_01') ? {
+ {
where => { -and => [
artistid => { -value => [1] },
charfield => { -ident => 'foo' },
charfield => { -ident => 'foo' },
rank => { -ident => 'bar' },
},
- } : () ),
+ },
{
where => { artistid => [] },
--- /dev/null
+use warnings;
+use strict;
+
+use Test::More;
+
+use lib qw(t/lib);
+use DBICTest;
+
+{
+ package # hideee
+ DBICTest::CrazyInt;
+
+ use overload
+ '0+' => sub { 666 },
+ '""' => sub { 999 },
+ fallback => 1,
+ ;
+}
+
+# check DBI behavior when fed a stringifiable/nummifiable value
+{
+ my $crazynum = bless {}, 'DBICTest::CrazyInt';
+ cmp_ok( $crazynum, '==', 666 );
+ cmp_ok( $crazynum, 'eq', 999 );
+
+ my $schema = DBICTest->init_schema( no_populate => 1 );
+ $schema->storage->dbh_do(sub {
+ $_[1]->do('INSERT INTO artist (name) VALUES (?)', {}, $crazynum );
+ });
+
+ is( $schema->resultset('Artist')->next->name, 999, 'DBI preferred stringified version' );
+}
+done_testing;