DBIx-Class
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
autodetection
- 'uniqueidentifier' support with auto newid()
- Dynamic cursor support and other MARS options for ODBC
- savepoints with auto_savepoint => 1
- Support for MSSQL 'money' type
- Support for 'smalldatetime' type used in MSSQL and Sybase for
InflateColumn::DateTime
- Support for Postgres 'timestamp without timezone' type in
InflateColumn::DateTime (RT#48389)
- Added new MySQL specific on_connect_call macro 'set_strict_mode'
(also known as make_mysql_not_suck_as_much)
- Multiple prefetch-related fixes:
- Adjust overly agressive subquery join-chain pruning
- Always preserve the outer join-chain - fixes numerous
problems with search_related chaining
- Deal with the distinct => 1 attribute properly when using
prefetch
- An extension of the select-hashref syntax, allowing labeling
SQL-side aliasing: select => [ { max => 'foo', -as => 'bar' } ]
- Massive optimization of the DBI storage layer - reduce the
amount of connected() ping-calls
examples/Benchmarks/benchmark_hashrefinflator.pl view on Meta::CPAN
. " ($min_freq). Alternatively skip this check with --no-cpufreq-checks.\n";
}
}
my %skip_commits = map { $_ => 1 } qw/
e1540ee
a5b2936
4613ee1
419ff18
/;
my (@to_bench, $not_latest);
for my $commit (`git log --format=%h HEAD ^8330454^ $hri_fn `) {
chomp $commit;
next if $skip_commits{$commit};
my $diff = `git show -w -U0 --format=%ar%n%b $commit $hri_fn`;
if ($diff =~ /^ (?: \@\@ \s .+? | [+-] sub \s) \$? mk_hash /xm ) {
my ($age) = $diff =~ /\A(.+?)\n/;
push @to_bench, {
commit => $commit,
title => $not_latest ? $commit : 'LATEST',
desc => sprintf ("commit %s (%smade %s)...\t\t",
$commit,
$not_latest ? '' : 'LATEST, ',
$age,
),
code => scalar `git show $commit:lib/DBIx/Class/ResultClass/HashRefInflator.pm`,
};
last if @to_bench == $args->{'bench-commits'};
$not_latest = 1;
}
}
die "Can't find any commits... something is wrong\n" unless @to_bench;
unshift @to_bench, {
desc => "the current uncommitted HRI...\t\t\t\t",
title => 'CURRENT',
code => do { local (@ARGV, $/) = ($hri_fn); <> },
} if `git status --porcelain $hri_fn`;
lib/DBIx/Class/Manual/Cookbook.pod view on Meta::CPAN
without even instantiating a cursor.
Before replacing all your calls to C<first()> with C<single()> please observe the
following CAVEATS:
=over
=item *
While single() takes a search condition just like search() does, it does
_not_ accept search attributes. However one can always chain a single() to
a search():
my $top_cd = $cd_rs->search({}, { order_by => 'rating' })->single;
=item *
Since single() is the engine behind find(), it is designed to fetch a
single row per database query. Thus a warning will be issued when the
underlying SELECT returns more than one row. Sometimes however this usage
lib/DBIx/Class/Storage/DBI/SQLite.pm view on Meta::CPAN
unless (defined $DBD::SQLite::__DBIC_TXN_SYNC_SANE__) {
$DBD::SQLite::__DBIC_TXN_SYNC_SANE__ = modver_gt_or_eq('DBD::SQLite', '1.38_02');
}
# fallback to travesty
unless ($DBD::SQLite::__DBIC_TXN_SYNC_SANE__) {
# since we do not have access to sqlite3_get_autocommit(), do a trick
# to attempt to *safely* determine what state are we *actually* in.
# FIXME
# also using T::T here leads to bizarre leaks - will figure it out later
my $really_not_in_txn = do {
local $@;
# older versions of DBD::SQLite do not properly detect multiline BEGIN/COMMIT
# statements to adjust their {AutoCommit} state. Hence use such a statement
# pair here as well, in order to escape from poking {AutoCommit} needlessly
# https://rt.cpan.org/Public/Bug/Display.html?id=80087
eval {
# will fail instantly if already in a txn
$dbh->do("-- multiline\nBEGIN");
$dbh->do("-- multiline\nCOMMIT");
1;
} or do {
($@ =~ /transaction within a transaction/)
? 0
: undef
;
};
};
# if we were unable to determine this - we may very well be dead
if (not defined $really_not_in_txn) {
$ping_fail = 1;
}
# check the AC sync-state
elsif ($really_not_in_txn xor $dbh->{AutoCommit}) {
carp_unique (sprintf
'Internal transaction state of handle %s (apparently %s a transaction) does not seem to '
. 'match its AutoCommit attribute setting of %s - this is an indication of a '
. 'potentially serious bug in your transaction handling logic',
$dbh,
$really_not_in_txn ? 'NOT in' : 'in',
$dbh->{AutoCommit} ? 'TRUE' : 'FALSE',
);
# it is too dangerous to execute anything else in this state
# assume everything works (safer - worst case scenario next statement throws)
return 1;
}
}
# do the actual test and return on no failure
lib/DBIx/Class/_Util.pm view on Meta::CPAN
sub is_exception ($) {
my $e = $_[0];
# this is not strictly correct - an eval setting $@ to undef
# is *not* the same as an eval setting $@ to ''
# but for the sake of simplicity assume the following for
# the time being
return 0 unless defined $e;
my ($not_blank, $suberror);
{
local $@;
eval {
$not_blank = ($e ne '') ? 1 : 0;
1;
} or $suberror = $@;
}
if (defined $suberror) {
if (length (my $class = blessed($e) )) {
carp_unique( sprintf(
'External exception class %s implements partial (broken) overloading '
. 'preventing its instances from being used in simple ($x eq $y) '
. 'comparisons. Given Perl\'s "globally cooperative" exception '
sub DBICTest::Schema::deployment_statements {
$custom_deployment_statements_called = 1;
my $self = shift;
return $self->next::method(@_);
}
# Check deployment statements ctx sensitivity
{
my $schema = DBICTest->init_schema (no_deploy => 1, quote_names => 1);
my $not_first_table_creation_re = qr/CREATE TABLE "fourkeys_to_twokeys"/;
my $statements = $schema->deployment_statements;
like (
$statements,
$not_first_table_creation_re,
'All create statements returned in 1 string in scalar ctx'
);
my @statements = $schema->deployment_statements;
cmp_ok (scalar @statements, '>', 1, 'Multiple statement lines in array ctx');
my $i = 0;
while ($i <= $#statements) {
last if $statements[$i] =~ $not_first_table_creation_re;
$i++;
}
ok (
($i > 0) && ($i <= $#statements),
"Creation statement was found somewherere within array ($i)"
);
}
{
t/cdbi/sweet/08pager.t view on Meta::CPAN
is( $it->next, undef, "disable_sql_paging next past end of page ok" );
# based on a failing criteria submitted by waswas
( $pager, $it ) = DBICTest::CD->page(
{ title => [
-and =>
{
-like => '%bees'
},
{
-not_like => 'Forkful%'
}
]
},
{ rows => 5 }
);
is( $it->count, 1, "complex abstract count ok" );
done_testing;
t/sqlmaker/limit_dialects/basic.t view on Meta::CPAN
);
is( $cds[0]->title, "Spoonful of bees", "offset with no limit" );
$it = $schema->resultset("CD")->search(
{ title => [
-and =>
{
-like => '%bees'
},
{
-not_like => 'Forkful%'
}
]
},
{ rows => 5 }
);
is( $it->count, 1, "complex abstract count ok" );
done_testing;
view all matches for this distributionview release on metacpan - search on metacpan
( run in 9.241 seconds using v1.00-cache-2.02-grep-82fe00e-cpan-f5108d614456 )