GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  DBIX::CUSTOM::WHERE (3)

.ds Aq ’

NAME

DBIx::Custom::Where - Where clause

CONTENTS

SYNOPSYS



  # Create DBIx::Custom::Where object
  my $where = $dbi->where;
 
  # Clause
  $where->clause([and, title like :title, price = :price]);
  $where->clause([and, :title{like}, :price{=}]);
 
  # Stringify where clause
  my $where_clause = "$where";
  my $where_clause = $where->to_string;
    # -> where title like :title and price = :price
 
  # Only price condition
  $where->clause([and, :title{like}, :price{=}]);
  $where->param({price => 1900});
    # -> where price = :price
 
  # Only title condition
  $where->clause([and, :title{like}, :price{=}]);
  $where->param({title => Perl});
    # -> where title like :title
 
  # Nothing
  $where->clause([and, :title{like}, :price{=}]);
  $where->param({});
    # => Nothing
 
  # or condition
  $where->clause([or, :title{like}, :price{=}]);
    # -> where title = :title or price like :price
 
  # More than one parameter
  $where->clause([and, :price{>}, :price{<}]);
  $where->param({price => [1000, 2000]});
    # -> where price > :price and price < :price
 
  # Only first condition
  $where->clause([and, :price{>}, :price{<}]);
  $where->param({price => [1000, $dbi->not_exists]});
    # -> where price > :price
 
  # Only second condition
  $where->clause([and, :price{>}, :price{<}]);
  $where->param({price => [$dbi->not_exists, 2000]});
    # -> where price < :price
 
  # More complex condition
  $where->clause(
    [
      and,
      :price{=},
      [or, :title{=}, :title{=}, :title{=}]
    ]
  );
    # -> pirce = :price and (title = :title or title = :title or tilte = :title)
 
  # Using Full-qualified column name
  $where->clause([and, :book.title{like}, :book.price{=}]);
    # -> book.title like :book.title and book.price = :book.price



ATTRIBUTES

    clause



  my $clause = $where->clause;
  $where = $where->clause(
    [and,
      :title{=},
      [or, :date{<}, :date{>}]
    ]
  );



Where clause. Above one is expanded to the following SQL by to_string If all parameter names is exists.



  where title = :title and ( date < :date or date > :date )



    param



  my $param = $where->param;
  $where = $where->param({
    title => Perl,
    date => [2010-11-11, 2011-03-05],
  });



    dbi



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



DBIx::Custom object.

METHODS

DBIx::Custom::Where inherits all methods from Object::Simple and implements the following new ones.

    to_string



  $where->to_string;



Convert where clause to string.

double quote is override to execute to_string method.



  my $string_where = "$where";



Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 DBIX::CUSTOM::WHERE (3) 2013-03-04

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.