... | ... |
@@ -1,4 +1,5 @@ |
1 | 1 |
0.1724 |
2 |
+ - added EXPERIMENTAL like_value method to DBIx::Custom |
|
2 | 3 |
- sqlfilter option is renamed to after_build_sql, sqlfilter is DEPRECATED! |
3 | 4 |
- removed EXPERIMENTAL flag from DBIx::Custom::Mapper |
4 | 5 |
- removed EXPERIMENTAL flag from the following DBIx::Custom methods |
... | ... |
@@ -747,6 +747,8 @@ sub include_model { |
747 | 747 |
return $self; |
748 | 748 |
} |
749 | 749 |
|
750 |
+sub like_value { sub { "%$_[0]%" } } |
|
751 |
+ |
|
750 | 752 |
sub mapper { |
751 | 753 |
my $self = shift; |
752 | 754 |
return DBIx::Custom::Mapper->new(@_); |
... | ... |
@@ -2876,6 +2878,14 @@ with C<timestamp> option. |
2876 | 2878 |
|
2877 | 2879 |
If multiple column are specified, same value is used. |
2878 | 2880 |
|
2881 |
+=head2 C<like_value EXPERIMENTAL> |
|
2882 |
+ |
|
2883 |
+ my $like_value = $dbi->like_value |
|
2884 |
+ |
|
2885 |
+Constant code reference for the like value. |
|
2886 |
+ |
|
2887 |
+ sub { "%$_[0]%" } |
|
2888 |
+ |
|
2879 | 2889 |
=head2 C<mapper> |
2880 | 2890 |
|
2881 | 2891 |
my $mapper = $dbi->mapper(param => $param); |
... | ... |
@@ -1,5 +0,0 @@ |
1 |
-### DB2 Install |
|
2 |
- |
|
3 |
-cd /usr/local/src |
|
4 |
- |
|
5 |
-curl -L https://www6.software.ibm.com/sdfdl/v2/regs2/db2pmopn/db2_v97/expc/Xa.2/Xb.aA_60_-iVlRRTUNBO90Dq4FHTisv_wdecoCQFeRQbw/Xc.db2exc_974_LNX_x86.tar.gz/Xd./Xf.LPr.D1vk/Xg.6107654/Xi.swg-db2expressc/XY.regsrvs/XZ.2ygJIAbTC5bn3tv2hlm2PnXUcz8/db2exc_974_LNX_x86.tar.gz > db2exc_974_LNX_x86.tar.gz |
... | ... |
@@ -1,5 +0,0 @@ |
1 |
-# Create database |
|
2 |
-create database dbix_custom; |
|
3 |
- |
|
4 |
-# Create User |
|
5 |
-GRANT ALL PRIVILEGES ON dbix_custom.* TO dbix_custom@"localhost" IDENTIFIED BY 'dbix_custom'; |
... | ... |
@@ -1,55 +0,0 @@ |
1 |
-# Download |
|
2 |
-http://download.oracle.com/otn/linux/oracle10g/xe/10201/oracle-xe-univ-10.2.0.1-1.0.i386.rpm |
|
3 |
- |
|
4 |
-# Install |
|
5 |
-rpm -ivh oracle-xe-univ-10.2.0.1-1.0.i386.rpm |
|
6 |
-/etc/init.d/oracle-xe configure |
|
7 |
- |
|
8 |
-# Note |
|
9 |
-Port number is set to 8090 |
|
10 |
- |
|
11 |
-# HTTP access |
|
12 |
-http://127.0.0.1:8090/apex |
|
13 |
- |
|
14 |
-# Create user |
|
15 |
-id: dbix_custom |
|
16 |
-password: dbix_custom |
|
17 |
- |
|
18 |
-Add all privirage |
|
19 |
- |
|
20 |
-# DBD::Oracle |
|
21 |
-You must be install install client |
|
22 |
-oracle-instantclient11.2-basic-11.2.0.2.0.i386.rpm |
|
23 |
-oracle-instantclient11.2-devel-11.2.0.2.0.i386.rpm |
|
24 |
-oracle-instantclient11.2-sqlplus-11.2.0.2.0.i386.rpm |
|
25 |
- |
|
26 |
-rpm -hiv oracle-instantclient11.2-basic-11.2.0.2.0.i386.rpm |
|
27 |
-rpm -hiv oracle-instantclient11.2-devel-11.2.0.2.0.i386.rpm |
|
28 |
-rpm -hiv oracle-instantclient11.2-sqlplus-11.2.0.2.0.i386.rpm |
|
29 |
- |
|
30 |
-vi /etc/profile.d/oracle.sh |
|
31 |
-export ORACLE_HOME='/usr/lib/oracle/11.2/client' |
|
32 |
-export C_INCLUDE_PATH='/usr/include/oracle/11.2/client' |
|
33 |
-export LD_LIBRARY_PATH='/usr/lib/oracle/11.2/client/lib' |
|
34 |
- |
|
35 |
-vi /etc/ld.so.conf.d/oracle.conf |
|
36 |
-/usr/lib/oracle/11.2/client/lib |
|
37 |
- |
|
38 |
-cpan DBD::Oracle |
|
39 |
- |
|
40 |
-sqlplus dbix_custom/dbix_custom@localhost:1521/XE |
|
41 |
- |
|
42 |
-mkdir -p $ORACLE_HOME/network/admin/ |
|
43 |
-vi $ORACLE_HOME/network/admin/tnsnames.ora |
|
44 |
- |
|
45 |
-XE = |
|
46 |
- (DESCRIPTION = |
|
47 |
- (ADDRESS_LIST = |
|
48 |
- (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) |
|
49 |
- ) |
|
50 |
- (CONNECT_DATA = |
|
51 |
- (SID = orcl) |
|
52 |
- ) |
|
53 |
- ) |
|
54 |
- |
|
55 |
- |
... | ... |
@@ -1,35 +0,0 @@ |
1 |
-### CentOS5 |
|
2 |
- |
|
3 |
-# Install |
|
4 |
-yum -y install postgresql-server |
|
5 |
-yum -y install postgresql |
|
6 |
-yum -y install postgresql-devel |
|
7 |
-chkconfig --level 2345 postgresql on |
|
8 |
- |
|
9 |
-# Start server |
|
10 |
-service postgresql start |
|
11 |
- |
|
12 |
-# Change config file |
|
13 |
-vi /var/lib/pgsql/data/pg_hba.conf |
|
14 |
- # "local" is for Unix domain socket connections only |
|
15 |
- local all all trust |
|
16 |
- |
|
17 |
-# Create user and database |
|
18 |
-su - postgres |
|
19 |
-createuser -a -d -U postgres -P dbix_custom |
|
20 |
- # Shall the new role be a superuser? (y/n) -> y |
|
21 |
- # Shall the new role be allowed to create databases? (y/n) -> y |
|
22 |
- # Shall the new role be allowed to create more new roles? (y/n) -> y |
|
23 |
- |
|
24 |
-createdb dbix_custom -U dbix_custom |
|
25 |
- |
|
26 |
-# Connect to database |
|
27 |
-psql -U dbix_custom dbix_custom |
|
28 |
- |
|
29 |
-# Install DBD::pg |
|
30 |
-cpanm DBD::Pg |
|
31 |
- |
|
32 |
-### Memo |
|
33 |
- |
|
34 |
-# Drop user |
|
35 |
-dropuser dbix_custom |
... | ... |
@@ -1,13 +0,0 @@ |
1 |
-# Site |
|
2 |
-http://awoni.net/fc/sql-server-2008-express/ |
|
3 |
- |
|
4 |
- |
|
5 |
-# Install |
|
6 |
-http://www.microsoft.com/downloads/ja-jp/details.aspx?displaylang=ja&FamilyID=967225eb-207b-4950-91df-eeb5f35a80ee |
|
7 |
- |
|
8 |
- |
|
9 |
-# Note |
|
10 |
-You enable SQL Server authentication. |
|
11 |
-You create user "dbix_custom", password "dbix_custom" |
|
12 |
-You give create_table, insert, update, delete, select authority to user "dbix_custom". |
|
13 |
- |
... | ... |
@@ -2556,6 +2556,15 @@ $param = $dbi->mapper(param => {id => 1, author => 'Ken', price => 1900})->map( |
2556 | 2556 |
is_deeply($param, {"$table1.id" => 1, "$table1.author" => '%Ken%', |
2557 | 2557 |
"$table1.price" => 1900}); |
2558 | 2558 |
|
2559 |
+$dbi = DBIx::Custom->connect; |
|
2560 |
+$param = $dbi->mapper(param => {id => 1, author => 'Ken', price => 1900})->map( |
|
2561 |
+ id => "$table1.id", |
|
2562 |
+ author => ["$table1.author" => $dbi->like_value], |
|
2563 |
+ price => ["$table1.price", {condition => sub { $_[0] eq 1900 }}] |
|
2564 |
+); |
|
2565 |
+is_deeply($param, {"$table1.id" => 1, "$table1.author" => '%Ken%', |
|
2566 |
+ "$table1.price" => 1900}); |
|
2567 |
+ |
|
2559 | 2568 |
$param = $dbi->mapper(param => {id => 0, author => 0, price => 0})->map( |
2560 | 2569 |
id => "$table1.id", |
2561 | 2570 |
author => ["$table1.author", sub { '%' . $_[0] . '%' }], |