I call :title named placeholder, stoping calling it...
...parameter
| ... | ... |
@@ -1,4 +1,5 @@ |
| 1 | 1 |
0.1707 |
| 2 |
+ - I call :title named placeholder, stoping calling it parameter |
|
| 2 | 3 |
- removed some EXPERIMENTAL status |
| 3 | 4 |
- fixed performance |
| 4 | 5 |
0.1706 |
| ... | ... |
@@ -2147,7 +2147,7 @@ Second argunet is data, embedded into column parameter. |
| 2147 | 2147 |
Return value is L<DBIx::Custom::Result> object when select statement is executed, |
| 2148 | 2148 |
or the count of affected rows when insert, update, delete statement is executed. |
| 2149 | 2149 |
|
| 2150 |
-Parameter is replaced by placeholder C<?>. |
|
| 2150 |
+Named placeholder such as C<:title> is replaced by placeholder C<?>. |
|
| 2151 | 2151 |
|
| 2152 | 2152 |
# Before |
| 2153 | 2153 |
select * from book where title = :title and author like :author |
| ... | ... |
@@ -2155,7 +2155,8 @@ Parameter is replaced by placeholder C<?>. |
| 2155 | 2155 |
# After |
| 2156 | 2156 |
select * from where title = ? and author like ?; |
| 2157 | 2157 |
|
| 2158 |
-You can specify operator with parameter by C<name{operator}> syntax.
|
|
| 2158 |
+You can specify operator with named placeholder |
|
| 2159 |
+ by C<name{operator}> syntax.
|
|
| 2159 | 2160 |
|
| 2160 | 2161 |
# Before |
| 2161 | 2162 |
select * from book where :title{=} and :author{like}
|
| ... | ... |
@@ -139,19 +139,17 @@ If you want to execute SQL, use C<execute> method. |
| 139 | 139 |
|
| 140 | 140 |
$dbi->execute("select * from book;");
|
| 141 | 141 |
|
| 142 |
-You can specify parameters. |
|
| 142 |
+You can specify named placeholder. |
|
| 143 | 143 |
|
| 144 | 144 |
$dbi->execute( |
| 145 | 145 |
"select * from book title = :title and author = :author;" |
| 146 | 146 |
{title => 'Perl', author => 'Ken'}
|
| 147 | 147 |
); |
| 148 | 148 |
|
| 149 |
-:title and :author is parameters, which is replaced to placeholers. |
|
| 149 |
+:title and :author is named placeholder, which is replaced to placeholers. |
|
| 150 | 150 |
|
| 151 | 151 |
select * from book title = ? and author = ?; |
| 152 | 152 |
|
| 153 |
-See also L<Parameter/"Parameter"> about parameter. |
|
| 154 |
- |
|
| 155 | 153 |
=head3 C<dbh> |
| 156 | 154 |
|
| 157 | 155 |
my $dbh = $dbi->dbh; |
| ... | ... |
@@ -230,17 +228,17 @@ C<fetch_hash_all> fetch all rows and put them into array of hash reference. |
| 230 | 228 |
|
| 231 | 229 |
If you want to get statment handle, use <sth> method. |
| 232 | 230 |
|
| 233 |
-=head2 Parameter |
|
| 231 |
+=head2 Named placeholder |
|
| 234 | 232 |
|
| 235 | 233 |
=head3 Basic of Parameter |
| 236 | 234 |
|
| 237 |
-You can embedd parameter into SQL. |
|
| 235 |
+You can embedd named placeholder into SQL. |
|
| 238 | 236 |
|
| 239 | 237 |
select * from book where title = :title and author like :author; |
| 240 | 238 |
|
| 241 |
-:title and :author is parameter |
|
| 239 |
+:title and :author is named placeholder |
|
| 242 | 240 |
|
| 243 |
-Parameter is converted to place holder. |
|
| 241 |
+Named placeholder is replaced by place holder. |
|
| 244 | 242 |
|
| 245 | 243 |
select * from book where title = ? and author like ?; |
| 246 | 244 |
|
| ... | ... |
@@ -300,7 +298,7 @@ C<clause> is the following format. |
| 300 | 298 |
['or' or 'and', PART1, PART1, PART1] |
| 301 | 299 |
|
| 302 | 300 |
First argument is 'or' or 'and'. |
| 303 |
-Later than first argument are part which contains parameter. |
|
| 301 |
+Later than first argument are part which contains named placeholder. |
|
| 304 | 302 |
|
| 305 | 303 |
You can write more complex format. |
| 306 | 304 |
|
| ... | ... |
@@ -318,7 +316,7 @@ After setting C<clause>, set C<param>. |
| 318 | 316 |
In this example, parameter contains only title. |
| 319 | 317 |
|
| 320 | 318 |
If you execute C<string_to>, you can get where clause |
| 321 |
-which contain only parameter name. |
|
| 319 |
+which contain only named placeholder. |
|
| 322 | 320 |
|
| 323 | 321 |
my $where_clause = $where->to_string; |
| 324 | 322 |
|
| ... | ... |
@@ -1,26 +0,0 @@ |
| 1 |
-use Test::More 'no_plan'; |
|
| 2 |
- |
|
| 3 |
-use strict; |
|
| 4 |
-use warnings; |
|
| 5 |
-use DBIx::Custom::Query; |
|
| 6 |
- |
|
| 7 |
-# Function for test name |
|
| 8 |
-sub test{ print "# $_[0]\n" }
|
|
| 9 |
- |
|
| 10 |
-# Variables for test |
|
| 11 |
-my $query; |
|
| 12 |
- |
|
| 13 |
-test 'Accessors'; |
|
| 14 |
-$query = DBIx::Custom::Query->new( |
|
| 15 |
- sql => 'a', |
|
| 16 |
- columns => 'b', |
|
| 17 |
- filter => 'c', |
|
| 18 |
- sth => 'e', |
|
| 19 |
- fetch_filter => 'f', |
|
| 20 |
-); |
|
| 21 |
- |
|
| 22 |
-is($query->sql, 'a', "sql"); |
|
| 23 |
-is($query->columns, 'b', "columns "); |
|
| 24 |
-is($query->filter, 'c', "filter"); |
|
| 25 |
-is($query->sth, 'e', "sth"); |
|
| 26 |
- |