Showing 2 changed files with 17 additions and 22 deletions
+3 -1
lib/DBIx/Custom.pm
... ...
@@ -3335,7 +3335,8 @@ Table name.
3335 3335
   where => 'title is null'
3336 3336
   #  -> where title is null
3337 3337
 
3338
-Where clause. See L<DBIx::Custom::Where>.
3338
+Where clause.
3339
+See also L<DBIx::Custom::Where> to know how to create where clause.
3339 3340
   
3340 3341
 =back
3341 3342
 
... ...
@@ -3615,6 +3616,7 @@ You can use this in insert statement.
3615 3616
   );
3616 3617
 
3617 3618
 Create a new L<DBIx::Custom::Where> object.
3619
+See L<DBIx::Custom::Where> to know how to create where clause.
3618 3620
 
3619 3621
 =head1 ENVIRONMENTAL VARIABLES
3620 3622
 
+14 -21
lib/DBIx/Custom/Where.pm
... ...
@@ -150,53 +150,48 @@ DBIx::Custom::Where - Where clause
150 150
   # Create DBIx::Custom::Where object
151 151
   my $where = $dbi->where;
152 152
   
153
-  # Set clause and parameter
153
+  # Clause
154
+  $where->clause(['and', 'title like :title', 'price = :price']);
154 155
   $where->clause(['and', ':title{like}', ':price{=}']);
155 156
   
156
-  # Create where clause by to_string method
157
-  my $where_clause = $where->to_string;
158
-  
159
-  # Create where clause by stringify
157
+  # Stringify where clause
160 158
   my $where_clause = "$where";
161
-  
162
-  # Created where clause in the above way
163
-  where :title{=} and :price{like}
159
+  my $where_clause = $where->to_string;
160
+    # -> where title like :title and price = :price
164 161
   
165 162
   # Only price condition
166 163
   $where->clause(['and', ':title{like}', ':price{=}']);
167 164
   $where->param({price => 1900});
168
-  my $where_clause = "$where";
169
-  
170
-  # Created where clause in the above way
171
-  where :price{=}
165
+    # -> where price = :price
172 166
   
173 167
   # Only title condition
174 168
   $where->clause(['and', ':title{like}', ':price{=}']);
175 169
   $where->param({title => 'Perl'});
176
-  my $where_clause = "$where";
177
-  
178
-  # Created where clause in the above way
179
-  where :title{like}
170
+    # -> where title like :title
180 171
   
181 172
   # Nothing
182 173
   $where->clause(['and', ':title{like}', ':price{=}']);
183 174
   $where->param({});
184
-  my $where_clause = "$where";
175
+    # => Nothing
185 176
   
186 177
   # or condition
187 178
   $where->clause(['or', ':title{like}', ':price{=}']);
179
+    # -> where title = :title or price like :price
188 180
   
189 181
   # More than one parameter
190 182
   $where->clause(['and', ':price{>}', ':price{<}']);
191 183
   $where->param({price => [1000, 2000]});
184
+    # -> where price > :price and price < :price
192 185
   
193 186
   # Only first condition
194 187
   $where->clause(['and', ':price{>}', ':price{<}']);
195 188
   $where->param({price => [1000, $dbi->not_exists]});
189
+    # -> where price > :price
196 190
   
197 191
   # Only second condition
198 192
   $where->clause(['and', ':price{>}', ':price{<}']);
199 193
   $where->param({price => [$dbi->not_exists, 2000]});
194
+    # -> where price < :price
200 195
   
201 196
   # More complex condition
202 197
   $where->clause(
... ...
@@ -206,13 +201,11 @@ DBIx::Custom::Where - Where clause
206 201
       ['or', ':title{=}', ':title{=}', ':title{=}']
207 202
     ]
208 203
   );
209
-  my $where_clause = "$where";
210
-  
211
-  # Created where clause in the above way
212
-  where :price{=} and (:title{=} or :title{=} or :title{=})
204
+    # -> pirce = :price and (title = :title or title = :title or tilte = :title)
213 205
   
214 206
   # Using Full-qualified column name
215 207
   $where->clause(['and', ':book.title{like}', ':book.price{=}']);
208
+    # -> book.title like :book.title and book.price = :book.price
216 209
 
217 210
 =head1 ATTRIBUTES
218 211