- dbi_option attribute is renamed to option, dbi_op...
...tion is DEPRECATED!
... | ... |
@@ -1,3 +1,7 @@ |
1 |
+0.1729 |
|
2 |
+ - dbi_option attribute is renamed to option, dbi_option is DEPRECATED! |
|
3 |
+ - default_dbi_option is renamed to default_option, default_dbi_option |
|
4 |
+ is DEPRECATED! |
|
1 | 5 |
0.1728 |
2 | 6 |
- added {key => ..., value => ...} syntax to DBIx::Custom::Mapper map method |
3 | 7 |
,and argument of string and code reference is DEPRECATED! |
... | ... |
@@ -39,8 +39,8 @@ has [qw/connector dsn password quote user exclude_table user_table_info |
39 | 39 |
} |
40 | 40 |
} |
41 | 41 |
}, |
42 |
- dbi_option => sub { {} }, |
|
43 |
- default_dbi_option => sub { |
|
42 |
+ option => sub { {} }, |
|
43 |
+ default_option => sub { |
|
44 | 44 |
{ |
45 | 45 |
RaiseError => 1, |
46 | 46 |
PrintError => 0, |
... | ... |
@@ -178,9 +178,9 @@ sub connect { |
178 | 178 |
my $dsn = $self->dsn; |
179 | 179 |
my $user = $self->user; |
180 | 180 |
my $password = $self->password; |
181 |
- my $dbi_option = {%{$self->dbi_options}, %{$self->dbi_option}}; |
|
181 |
+ my $option = $self->_option; |
|
182 | 182 |
my $connector = DBIx::Connector->new($dsn, $user, $password, |
183 |
- {%{$self->default_dbi_option} , %$dbi_option}); |
|
183 |
+ {%{$self->default_option} , %$option}); |
|
184 | 184 |
$self->connector($connector); |
185 | 185 |
} |
186 | 186 |
|
... | ... |
@@ -1347,11 +1347,8 @@ sub _connect { |
1347 | 1347 |
unless $dsn; |
1348 | 1348 |
my $user = $self->user; |
1349 | 1349 |
my $password = $self->password; |
1350 |
- my $dbi_option = {%{$self->dbi_options}, %{$self->dbi_option}}; |
|
1351 |
- warn "dbi_options is DEPRECATED! use dbi_option instead\n" |
|
1352 |
- if keys %{$self->dbi_options}; |
|
1353 |
- |
|
1354 |
- $dbi_option = {%{$self->default_dbi_option}, %$dbi_option}; |
|
1350 |
+ my $option = $self->_option; |
|
1351 |
+ $option = {%{$self->default_option}, %$option}; |
|
1355 | 1352 |
|
1356 | 1353 |
# Connect |
1357 | 1354 |
my $dbh; |
... | ... |
@@ -1360,7 +1357,7 @@ sub _connect { |
1360 | 1357 |
$dsn, |
1361 | 1358 |
$user, |
1362 | 1359 |
$password, |
1363 |
- $dbi_option |
|
1360 |
+ $option |
|
1364 | 1361 |
); |
1365 | 1362 |
}; |
1366 | 1363 |
|
... | ... |
@@ -1404,6 +1401,16 @@ sub _need_tables { |
1404 | 1401 |
} |
1405 | 1402 |
} |
1406 | 1403 |
|
1404 |
+sub _option { |
|
1405 |
+ my $self = shift; |
|
1406 |
+ my $option = {%{$self->dbi_options}, %{$self->dbi_option}, %{$self->option}}; |
|
1407 |
+ warn "dbi_options is DEPRECATED! use option instead\n" |
|
1408 |
+ if keys %{$self->dbi_options}; |
|
1409 |
+ warn "dbi_option is DEPRECATED! use option instead\n" |
|
1410 |
+ if keys %{$self->dbi_option}; |
|
1411 |
+ return $option; |
|
1412 |
+} |
|
1413 |
+ |
|
1407 | 1414 |
sub _push_join { |
1408 | 1415 |
my ($self, $sql, $join, $join_tables) = @_; |
1409 | 1416 |
|
... | ... |
@@ -1658,6 +1665,12 @@ has 'data_source'; |
1658 | 1665 |
has dbi_options => sub { {} }; |
1659 | 1666 |
has filter_check => 1; |
1660 | 1667 |
has 'reserved_word_quote'; |
1668 |
+has dbi_option => sub { {} }; |
|
1669 |
+has default_dbi_option => sub { |
|
1670 |
+ warn "default_dbi_option is DEPRECATED! use default_option instead"; |
|
1671 |
+ return shift->default_option; |
|
1672 |
+}; |
|
1673 |
+ |
|
1661 | 1674 |
|
1662 | 1675 |
# DEPRECATED! |
1663 | 1676 |
sub assign_param { |
... | ... |
@@ -1949,7 +1962,7 @@ DBIx::Custom - Execute insert, update, delete, and select statement easily |
1949 | 1962 |
dsn => "dbi:mysql:database=dbname", |
1950 | 1963 |
user => 'ken', |
1951 | 1964 |
password => '!LFKD%$&', |
1952 |
- dbi_option => {mysql_enable_utf8 => 1} |
|
1965 |
+ option => {mysql_enable_utf8 => 1} |
|
1953 | 1966 |
); |
1954 | 1967 |
|
1955 | 1968 |
# Insert |
... | ... |
@@ -2062,13 +2075,13 @@ Connection manager object. if C<connector> is set, you can get C<dbh> |
2062 | 2075 |
through connection manager. Conection manager object must have C<dbh> mehtod. |
2063 | 2076 |
|
2064 | 2077 |
This is L<DBIx::Connector> example. Please pass |
2065 |
-C<default_dbi_option> to L<DBIx::Connector> C<new> method. |
|
2078 |
+C<default_option> to L<DBIx::Connector> C<new> method. |
|
2066 | 2079 |
|
2067 | 2080 |
my $connector = DBIx::Connector->new( |
2068 | 2081 |
"dbi:mysql:database=$database", |
2069 | 2082 |
$user, |
2070 | 2083 |
$password, |
2071 |
- DBIx::Custom->new->default_dbi_option |
|
2084 |
+ DBIx::Custom->new->default_option |
|
2072 | 2085 |
); |
2073 | 2086 |
|
2074 | 2087 |
my $dbi = DBIx::Custom->connect(connector => $connector); |
... | ... |
@@ -2090,18 +2103,18 @@ Note that L<DBIx::Connector> must be installed. |
2090 | 2103 |
|
2091 | 2104 |
Data source name, used when C<connect> method is executed. |
2092 | 2105 |
|
2093 |
-=head2 C<dbi_option> |
|
2106 |
+=head2 C<option> |
|
2094 | 2107 |
|
2095 |
- my $dbi_option = $dbi->dbi_option; |
|
2096 |
- $dbi = $dbi->dbi_option($dbi_option); |
|
2108 |
+ my $option = $dbi->option; |
|
2109 |
+ $dbi = $dbi->option($option); |
|
2097 | 2110 |
|
2098 | 2111 |
L<DBI> option, used when C<connect> method is executed. |
2099 |
-Each value in option override the value of C<default_dbi_option>. |
|
2112 |
+Each value in option override the value of C<default_option>. |
|
2100 | 2113 |
|
2101 |
-=head2 C<default_dbi_option> |
|
2114 |
+=head2 C<default_option> |
|
2102 | 2115 |
|
2103 |
- my $default_dbi_option = $dbi->default_dbi_option; |
|
2104 |
- $dbi = $dbi->default_dbi_option($default_dbi_option); |
|
2116 |
+ my $default_option = $dbi->default_option; |
|
2117 |
+ $dbi = $dbi->default_option($default_option); |
|
2105 | 2118 |
|
2106 | 2119 |
L<DBI> default option, used when C<connect> method is executed, |
2107 | 2120 |
default to the following values. |
... | ... |
@@ -2293,12 +2306,6 @@ Create column clause. The follwoing column clause is created. |
2293 | 2306 |
|
2294 | 2307 |
You can change separator by C<separator> attribute. |
2295 | 2308 |
|
2296 |
- # Separator is double underbar |
|
2297 |
- $dbi->separator('__'); |
|
2298 |
- |
|
2299 |
- book.author as "book__author", |
|
2300 |
- book.title as "book__title" |
|
2301 |
- |
|
2302 | 2309 |
# Separator is hyphen |
2303 | 2310 |
$dbi->separator('-'); |
2304 | 2311 |
|
... | ... |
@@ -2311,7 +2318,7 @@ You can change separator by C<separator> attribute. |
2311 | 2318 |
dsn => "dbi:mysql:database=dbname", |
2312 | 2319 |
user => 'ken', |
2313 | 2320 |
password => '!LFKD%$&', |
2314 |
- dbi_option => {mysql_enable_utf8 => 1} |
|
2321 |
+ option => {mysql_enable_utf8 => 1} |
|
2315 | 2322 |
); |
2316 | 2323 |
|
2317 | 2324 |
Connect to the database and create a new L<DBIx::Custom> object. |
... | ... |
@@ -2957,7 +2964,7 @@ Create column clause for myself. The follwoing column clause is created. |
2957 | 2964 |
dsn => "dbi:mysql:database=dbname", |
2958 | 2965 |
user => 'ken', |
2959 | 2966 |
password => '!LFKD%$&', |
2960 |
- dbi_option => {mysql_enable_utf8 => 1} |
|
2967 |
+ option => {mysql_enable_utf8 => 1} |
|
2961 | 2968 |
); |
2962 | 2969 |
|
2963 | 2970 |
Create a new L<DBIx::Custom> object. |
... | ... |
@@ -3489,6 +3496,8 @@ DEBUG output encoding. Default to UTF-8. |
3489 | 3496 |
L<DBIx::Custom> |
3490 | 3497 |
|
3491 | 3498 |
# Attribute methods |
3499 |
+ default_dbi_option # will be removed 2017/1/1 |
|
3500 |
+ dbi_option # will be removed 2017/1/1 |
|
3492 | 3501 |
data_source # will be removed at 2017/1/1 |
3493 | 3502 |
dbi_options # will be removed at 2017/1/1 |
3494 | 3503 |
filter_check # will be removed at 2017/1/1 |
... | ... |
@@ -56,13 +56,13 @@ Create C<order by> clause flexibly |
56 | 56 |
dsn => "dbi:mysql:database=bookshop", |
57 | 57 |
user => 'ken', |
58 | 58 |
password => '!LFKD%$&', |
59 |
- dbi_option => {mysql_enable_utf8 => 1} |
|
59 |
+ option => {mysql_enable_utf8 => 1} |
|
60 | 60 |
); |
61 | 61 |
|
62 | 62 |
You can connect to database by C<connect> method. |
63 | 63 |
C<dsn> is data source name, C<user> is user name, C<password> is password. |
64 | 64 |
|
65 |
-C<dbi_option> is L<DBI> option. |
|
65 |
+C<option> is L<DBI> option. |
|
66 | 66 |
By default, the following option is set. |
67 | 67 |
Exeption is thrown when fatal error occur and commit mode is auto commit. |
68 | 68 |
|
... | ... |
@@ -1729,7 +1729,9 @@ ok(!defined $result->default_filter); |
1729 | 1729 |
$result->default_filter('one'); |
1730 | 1730 |
is($result->default_filter->(), 1); |
1731 | 1731 |
|
1732 |
-test 'dbi_option'; |
|
1732 |
+test 'option'; |
|
1733 |
+$dbi = DBIx::Custom->connect(option => {PrintError => 1}); |
|
1734 |
+ok($dbi->dbh->{PrintError}); |
|
1733 | 1735 |
$dbi = DBIx::Custom->connect(dbi_option => {PrintError => 1}); |
1734 | 1736 |
ok($dbi->dbh->{PrintError}); |
1735 | 1737 |
$dbi = DBIx::Custom->connect(dbi_options => {PrintError => 1}); |
... | ... |
@@ -116,7 +116,7 @@ test 'dbh'; |
116 | 116 |
"dbi:mysql:database=$database", |
117 | 117 |
$user, |
118 | 118 |
$password, |
119 |
- DBIx::Custom->new->default_dbi_option |
|
119 |
+ DBIx::Custom->new->default_option |
|
120 | 120 |
); |
121 | 121 |
|
122 | 122 |
my $dbi = DBIx::Custom->connect(connector => $connector); |
... | ... |
@@ -182,7 +182,7 @@ use Scalar::Util 'blessed'; |
182 | 182 |
user => $user, |
183 | 183 |
password => $password, |
184 | 184 |
dsn => "dbi:mysql:dbname=$database", |
185 |
- dbi_options => {AutoCommit => 0, mysql_enable_utf8 => 1} |
|
185 |
+ option => {AutoCommit => 0, mysql_enable_utf8 => 1} |
|
186 | 186 |
); |
187 | 187 |
$dbi->connect; |
188 | 188 |
ok(!$dbi->dbh->{AutoCommit}); |
... | ... |
@@ -195,7 +195,7 @@ test 'fork'; |
195 | 195 |
"dbi:mysql:database=$database", |
196 | 196 |
$user, |
197 | 197 |
$password, |
198 |
- DBIx::Custom->new->default_dbi_option |
|
198 |
+ DBIx::Custom->new->default_option |
|
199 | 199 |
); |
200 | 200 |
|
201 | 201 |
my $dbi = DBIx::Custom->new(connector => $connector); |
... | ... |
@@ -44,7 +44,7 @@ $dbi->execute('create table table1 (key1 varchar(255), key2 varchar(255))'); |
44 | 44 |
test 'connector => 1'; |
45 | 45 |
{ |
46 | 46 |
my $dbi = DBIx::Custom->connect(dsn => $dsn, user => $user, password => $password, |
47 |
- dbi_option => {PrintError => 1}, connector => 1); |
|
47 |
+ option => {PrintError => 1}, connector => 1); |
|
48 | 48 |
is(ref $dbi->connector, 'DBIx::Connector'); |
49 | 49 |
ok($dbi->dbh->{PrintError}); |
50 | 50 |
$dbi->delete_all(table => 'table1'); |