DBIx::Custom::Order

作者: JSON_NULL | 来源:发表于2017-12-07 13:31 被阅读1次

简介

DBIx::Custom::Order模块主要用于为查询生成order子句。

# Result
my $order = DBIx::Custom::Order->new;
$order->prepend('title', 'author desc');
my $order_by = "$order";

属性

dbi

my $dbi = $order->dbi;
$order = $order->dbi($dbi);

DBIx::Custom对象。

orders

my $orders = $result->orders;
$result = $result->orders(\%orders);

一个数组引用,存储order by子句的各个order项。用于在调用to_string方法时生成order by 子句。

方法

prepend

$order->prepend('title', 'author desc');

从前面向orders属性中添加order项。

to_string

my $order_by = $order->to_string;

创建一个order by 子句。如果有多个重复的列名,则只有第一个起作用。

重载的操作符

use overload
  'bool'   => sub {1},
  '""'     => sub { shift->to_string },
  fallback => 1;

相关文章

  • DBIx::Custom::Order

    简介 DBIx::Custom::Order模块主要用于为查询生成order子句。 属性 dbi DBIx::Cu...

  • DBIx::Custom::Mapper

    简介 DBIx::Custom::Mapper模块是DBIx::Custom框架的参数映射器。 属性 param ...

  • DBIx::Custom::Model

    简介 DBIx::Custom::Model模块是DBIx::Custom框架中的模型对象。每个Model对象都对...

  • DBIx::Custom

    简介 DBIx::Custom是一个DBI的包装器,此模块具有以下功能: 可以更容易的执行insert、updat...

  • DBIx::Custom::Result

    简介 DBIx::Custom::Result模块是对 select 语句查询结果的封装。 属性 dbi DBIx...

  • DBIx::Custom::Where

    简介 属性 clause 一个数组引用,存储where子中的所有where项,用于在调用to_string方法时生...

  • SQL之DBIx::Custom

    说明 写这篇文章的目的只是因为自己要用这个模块,在CPAN和Github上面有详细的介绍说明以及使用方式,但是每次...

  • DBIx::Custom框架实践方法

    简介 本文旨在说明在实际的软件开发过程中如何使用DBIx::Custom框架完成对数据库的操作。 扩展last_i...

  • How to change mouse cursor and t

    In order to get your custom cursor to work with all appli...

  • angular material 主体化自定义组件

    Theming your custom components 主体化自定义的组件 In order to styl...

网友评论

    本文标题:DBIx::Custom::Order

    本文链接:https://www.haomeiwen.com/subject/zhkdixtx.html