NAME
DBIC::SqlMakerTest - Helper package for testing sql_maker component of DBIC
SYNOPSIS
use Test::More;
use DBIC::SqlMakerTest;
my ($sql, @bind) = $schema->storage->sql_maker->select(%args);
is_same_sql_bind(
$sql, \@bind,
$expected_sql, \@expected_bind,
'foo bar works'
);
DESCRIPTION
Exports functions that can be used to compare generated SQL and bind values.
This is a thin wrapper around SQL::Abstract::Test, which makes it easier to compare as_query sql/bind arrayrefrefs directly.
FUNCTIONS
is_same_sql_bind
is_same_sql_bind(
$given_sql, \@given_bind,
$expected_sql, \@expected_bind,
$test_msg
);
is_same_sql_bind(
$rs->as_query
$expected_sql, \@expected_bind,
$test_msg
);
is_same_sql_bind(
\[$given_sql, @given_bind],
$expected_sql, \@expected_bind,
$test_msg
);
Compares given and expected pairs of ($sql, \@bind), and calls "ok" in Test::Builder on the result, with $test_msg as message.
is_same_sql
is_same_sql(
$given_sql,
$expected_sql,
$test_msg
);
Compares given and expected SQL statement, and calls "ok" in Test::Builder on the result, with $test_msg as message.
is_same_bind
is_same_bind(
\@given_bind,
\@expected_bind,
$test_msg
);
Compares given and expected bind value lists, and calls "ok" in Test::Builder on the result, with $test_msg as message.
eq_sql
my $is_same = eq_sql($given_sql, $expected_sql);
Compares the two SQL statements. Returns true IFF they are equivalent.
eq_bind
my $is_same = eq_sql(\@given_bind, \@expected_bind);
Compares two lists of bind values. Returns true IFF their values are the same.
eq_sql_bind
my $is_same = eq_sql_bind(
$given_sql, \@given_bind,
$expected_sql, \@expected_bind
);
Compares the two SQL statements and the two lists of bind values. Returns true IFF they are equivalent and the bind values are the same.
SEE ALSO
SQL::Abstract::Test, Test::More, Test::Builder.
AUTHOR
Norbert Buchmuller, <norbi@nix.hu>
COPYRIGHT AND LICENSE
Copyright 2008 by Norbert Buchmuller.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.