[Bps-public-commit] dbix-searchbuilder branch, master, updated. 1.60-32-g8ffb532

Ruslan Zakirov ruz at bestpractical.com
Fri Sep 16 07:42:36 EDT 2011


The branch, master has been updated
       via  8ffb5328fe5b72850759c27efe4b4b712d1b0616 (commit)
       via  d2715f45362048eadbc891154e6a15b2699e96eb (commit)
       via  b0dfebfa0ff33bd03348fca190c6910bca1bd461 (commit)
       via  ca58644a0a1443bea58dd1d383af237104881c09 (commit)
       via  20b138a2568703fbffd546ce0c03072d0eb83739 (commit)
       via  5ebfa9da9016d0fd5f878d6ea38ad4f384a658bd (commit)
       via  1bf01e3c4b471fd9691581d0f881ffd7cad9e524 (commit)
       via  1797e88ab02735474ad49b5f26f61325d244ad0d (commit)
       via  e37fa5c9a580f3388e89eff46a556d9d620f2c28 (commit)
       via  0e97716d37975b1684b9da002965af2d05ed98b0 (commit)
       via  4291d1ebc8b10ca43804e0560ec4d89e3c0dbca2 (commit)
       via  25fc357c4ecea12e46adfafd566d8c8329e28aff (commit)
       via  d88b6d4c909dd3cd977542c2f47c5579045565a8 (commit)
       via  1a125f11f8d44b8eb4f2f13b9b0d20ca1a739f71 (commit)
       via  94ae8ce5fc0d4ef232c2fd989340e55c1fcac2a0 (commit)
       via  f545667ab56d1afb34a00bac13ea03d38932535c (commit)
      from  88db6a132f3da462d54528464758a3f430c4c8c8 (commit)

Summary of changes:
 Changes                                 |    1 +
 lib/DBIx/SearchBuilder/Handle.pm        |  153 +++++++++++++
 lib/DBIx/SearchBuilder/Handle/Oracle.pm |   80 +++++++-
 lib/DBIx/SearchBuilder/Handle/Pg.pm     |   74 +++++++
 lib/DBIx/SearchBuilder/Handle/SQLite.pm |   59 +++++
 lib/DBIx/SearchBuilder/Handle/mysql.pm  |   64 ++++++
 t/02records_datetime.t                  |  365 +++++++++++++++++++++++++++++++
 7 files changed, 794 insertions(+), 2 deletions(-)
 create mode 100644 t/02records_datetime.t

- Log -----------------------------------------------------------------
commit b0dfebfa0ff33bd03348fca190c6910bca1bd461
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Sep 16 15:40:42 2011 +0400

    documentation for data time related functions

diff --git a/lib/DBIx/SearchBuilder/Handle.pm b/lib/DBIx/SearchBuilder/Handle.pm
index 2067d37..d4abcd7 100755
--- a/lib/DBIx/SearchBuilder/Handle.pm
+++ b/lib/DBIx/SearchBuilder/Handle.pm
@@ -1485,6 +1485,25 @@ sub DateTimeFunction {
     return $res;
 }
 
+=head2 ConvertTimezoneFunction
+
+Generates a function applied to Field argument that converts timezone.
+By default converts from UTC. Examples:
+
+    # UTC => Moscow
+    $handle->ConvertTimezoneFunction( Field => '?', To => 'Europe/Moscow');
+
+If there is problem with arguments or timezones are equal
+then Field returned without any function applied. Field argument
+is not escaped in any way, it's your job.
+
+Implementation is very database specific. To be portable convert
+from UTC or to UTC. Some databases have internal storage for
+information about timezones that should be kept up to date.
+Read documentation for your DB.
+
+=cut
+
 sub ConvertTimezoneFunction {
     my $self = shift;
     my %args = (
diff --git a/lib/DBIx/SearchBuilder/Handle/Oracle.pm b/lib/DBIx/SearchBuilder/Handle/Oracle.pm
index 6e1eaa2..a7f7b65 100755
--- a/lib/DBIx/SearchBuilder/Handle/Oracle.pm
+++ b/lib/DBIx/SearchBuilder/Handle/Oracle.pm
@@ -321,6 +321,13 @@ sub Fields {
     return @{ $cache->{ lc $table } || [] };
 }
 
+=head2 SimpleDateTimeFunctions
+
+Returns hash reference with specific date time functions of this
+database for L<DBIx::SearchBuilder::Handle/DateTimeFunction>.
+
+=cut
+
 # http://download.oracle.com/docs/cd/B14117_01/server.101/b10749/ch4datetime.htm
 sub SimpleDateTimeFunctions {
     my $self = shift;
@@ -356,6 +363,20 @@ sub SimpleDateTimeFunctions {
     };
 }
 
+=head2 ConvertTimezoneFunction
+
+Custom implementation of L<DBIx::SearchBuilder::Handle/ConvertTimezoneFunction>.
+
+Use the following query to get list of timezones:
+
+    SELECT tzname FROM v$timezone_names;
+
+Read Oracle's docs about timezone files:
+
+    http://download.oracle.com/docs/cd/B14117_01/server.101/b10749/ch4datetime.htm#i1006667
+
+=cut
+
 sub ConvertTimezoneFunction {
     my $self = shift;
     my %args = (
diff --git a/lib/DBIx/SearchBuilder/Handle/Pg.pm b/lib/DBIx/SearchBuilder/Handle/Pg.pm
index 635b174..df32079 100755
--- a/lib/DBIx/SearchBuilder/Handle/Pg.pm
+++ b/lib/DBIx/SearchBuilder/Handle/Pg.pm
@@ -251,6 +251,12 @@ sub DistinctQuery {
     $$statementref = "SELECT main.* FROM $$statementref $group $order";
 }
 
+=head2 SimpleDateTimeFunctions
+
+Returns hash reference with specific date time functions of this
+database for L<DBIx::SearchBuilder::Handle/DateTimeFunction>.
+
+=cut
 
 sub SimpleDateTimeFunctions {
     my $self = shift;
diff --git a/lib/DBIx/SearchBuilder/Handle/SQLite.pm b/lib/DBIx/SearchBuilder/Handle/SQLite.pm
index e75222c..b7985cb 100644
--- a/lib/DBIx/SearchBuilder/Handle/SQLite.pm
+++ b/lib/DBIx/SearchBuilder/Handle/SQLite.pm
@@ -149,6 +149,13 @@ sub Fields {
     return @{ $cache->{ lc $table } || [] };
 }
 
+=head2 SimpleDateTimeFunctions
+
+Returns hash reference with specific date time functions of this
+database for L<DBIx::SearchBuilder::Handle/DateTimeFunction>.
+
+=cut
+
 sub SimpleDateTimeFunctions {
     my $self = shift;
     return $self->{'_simple_date_time_functions'} ||= {
diff --git a/lib/DBIx/SearchBuilder/Handle/mysql.pm b/lib/DBIx/SearchBuilder/Handle/mysql.pm
index a257bd8..346947c 100755
--- a/lib/DBIx/SearchBuilder/Handle/mysql.pm
+++ b/lib/DBIx/SearchBuilder/Handle/mysql.pm
@@ -137,6 +137,13 @@ sub Fields {
     return @{ $cache->{ lc $table } || [] };
 }
 
+=head2 SimpleDateTimeFunctions
+
+Returns hash reference with specific date time functions of this
+database for L<DBIx::SearchBuilder::Handle/DateTimeFunction>.
+
+=cut
+
 sub SimpleDateTimeFunctions {
     my $self = shift;
     return $self->{'_simple_date_time_functions'} ||= {
@@ -166,6 +173,20 @@ sub SimpleDateTimeFunctions {
 }
 
 
+=head2 ConvertTimezoneFunction
+
+Custom implementation of L<DBIx::SearchBuilder::Handle/ConvertTimezoneFunction>.
+
+Use the following query to get list of timezones:
+
+    SELECT Name FROM mysql.time_zone_name;
+
+Read docs about keeping timezone data up to date:
+
+    http://dev.mysql.com/doc/refman/5.5/en/time-zone-upgrades.html
+
+=cut
+
 sub ConvertTimezoneFunction {
     my $self = shift;
     my %args = (

commit d2715f45362048eadbc891154e6a15b2699e96eb
Merge: 88db6a1 b0dfebf
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Sep 16 15:41:07 2011 +0400

    Merge branch 'date-time-helpers'


commit 8ffb5328fe5b72850759c27efe4b4b712d1b0616
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Sep 16 15:42:09 2011 +0400

    update changelog

diff --git a/Changes b/Changes
index dda9b71..a460d2a 100755
--- a/Changes
+++ b/Changes
@@ -4,6 +4,7 @@ Revision history for Perl extension DBIx::SearchBuilder.
 
 * New methods in Handle for mass changes from select statements:
   InsertFromSelect, DeleteFromSelect and SimpleUpdateFromSelect
+* New methods in Handle for generation of date time related SQL
 
 1.60 Thu Sep 15 01:01:15 MSD 2011
 

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list