(http://msdn.microsoft.com/en-us/library/ms190315.aspx)
- an sqlt_deploy_hook can now be shared between result sources using
a configurable callback trigger
- - new order_by => { -desc => 'colname' } syntax supported with
- SQLA >= 1.50
- - PG array datatype supported with SQLA >= 1.50
+ - new order_by => { -desc => 'colname' } syntax supported
+ - PG array datatype supported
- insert should use store_column, not set_column to avoid marking
clean just-stored values as dirty. New test for this (groditi)
- regression test for source_name (groditi)
=head2 Working with PostgreSQL array types
-If your SQL::Abstract version (>= 1.50) supports it, you can assign to
-PostgreSQL array values by passing array references in the C<\%columns>
-(C<\%vals>) hashref of the L<DBIx::Class::ResultSet/create> and
-L<DBIx::Class::Row/update> family of methods:
+You can also assign values to PostgreSQL array columns by passing array
+references in the C<\%columns> (C<\%vals>) hashref of the
+L<DBIx::Class::ResultSet/create> and L<DBIx::Class::Row/update> family of
+methods:
$resultset->create({
numbers => [1, 2, 3]
=over 4
-=item Value: ($order_by | \@order_by)
+=item Value: ( $order_by | \@order_by | \%order_by )
=back
-Which column(s) to order the results by. This is currently passed
-through directly to SQL, so you can give e.g. C<year DESC> for a
-descending order on the column `year'.
+Which column(s) to order the results by. If a single column name, or
+an arrayref of names is supplied, the argument is passed through
+directly to SQL. The hashref syntax allows for connection-agnostic
+specification of ordering direction:
-Please note that if you have C<quote_char> enabled (see
-L<DBIx::Class::Storage::DBI/connect_info>) you will need to do C<\'year DESC' > to
-specify an order. (The scalar ref causes it to be passed as raw sql to the DB,
-so you will need to manually quote things as appropriate.)
+ For descending order:
-If your L<SQL::Abstract> version supports it (>=1.50), you can also use
-C<{-desc => 'year'}>, which takes care of the quoting for you. This is the
-recommended syntax.
+ order_by => { -desc => [qw/col1 col2 col3/] }
+
+ For explicit ascending order:
+
+ order_by => { -asc => 'col' }
+
+The old scalarref syntax (i.e. order_by => \'year DESC') is still
+supported, although you are strongly encouraged to use the hashref
+syntax as outlined above.
=head2 columns
is_deeply($type_info, $test_type_info,
'columns_info_for - column data types');
-SKIP: {
- skip "SQL::Abstract < 1.49 does not pass through arrayrefs", 4
- if $SQL::Abstract::VERSION < 1.49;
-
+{
lives_ok {
$schema->resultset('ArrayTest')->create({
arrayfield => [1, 2],
my $sql_maker = $schema->storage->sql_maker;
-SKIP: {
- skip "SQL::Abstract < 1.49 does not pass through arrayrefs", 2
- if $SQL::Abstract::VERSION < 1.49;
-
+{
my ($sql, @bind) = $sql_maker->insert(
'lottery',
{
'scalar ORDER BY okay (multiple values)'
);
-SKIP: {
- skip "SQL::Abstract < 1.49 does not support hashrefs in order_by", 2
- if $SQL::Abstract::VERSION < 1.49;
-
+{
($sql, @bind) = $sql_maker->select(
[
{
'quoted table names for UPDATE'
);
-SKIP: {
- skip "select attr with star does not work in SQL::Abstract < 1.49", 1
- if $SQL::Abstract::VERSION < 1.49;
-
+{
($sql, @bind) = $sql_maker->select(
[
{
use Test::More;
-BEGIN {
- eval "use SQL::Abstract 1.49";
- plan $@
- ? ( skip_all => "Needs SQLA 1.49+" )
- : ( tests => 4 );
-}
+plan ( tests => 4 );
use lib qw(t/lib);
use DBICTest;
use Test::More;
-BEGIN {
- eval "use SQL::Abstract 1.49";
- plan $@
- ? ( skip_all => "Needs SQLA 1.49+" )
- : ( tests => 7 );
-}
+plan ( tests => 7 );
use lib qw(t/lib);
use DBICTest;