File: sqlite.t

package info (click to toggle)
libdbix-class-helpers-perl 2.036000-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,008 kB
  • sloc: perl: 5,041; sql: 537; makefile: 7
file content (73 lines) | stat: -rw-r--r-- 2,703 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!perl

use strict;
use warnings;
use Test::More;
use lib 't/lib';
use A::ResultSet::DateMethods1;

A::ResultSet::DateMethods1->run_tests(SQLite => {
   engine => 'SQLite',
   utc_now => q<DATETIME('now')>,
   stringified_date => '2014-02-08 04:43:00',

   plucked_minute => '09',
   plucked_second => '08',

   connect_info => [ 'dbi:SQLite::memory:' ],


   add_sql_prefix => \[ 'DATETIME("me"."a_date", ? || ?)', 1, ' seconds' ],

   add_sql_by_part => {
      day    => \[ 'DATETIME("a_date", ? || ?)', 1, ' days' ],
      hour   => \[ 'DATETIME("a_date", ? || ?)', 2, ' hours' ],
      minute => \[ 'DATETIME("a_date", ? || ?)', 3, ' minutes' ],
      month  => \[ 'DATETIME("a_date", ? || ?)', 4, ' months' ],
      second => \[ 'DATETIME("a_date", ? || ?)', 5, ' seconds' ],
      year   => \[ 'DATETIME("a_date", ? || ?)', 6, ' years' ],
   },

   subtract_sql_prefix => \[ q{DATETIME("me"."a_date", '-' || ? || ?)}, 1, ' seconds' ],

   subtract_sql_by_part => {
      day    => \[ q{DATETIME("a_date", '-' || ? || ?)}, 1, ' days' ],
      hour   => \[ q{DATETIME("a_date", '-' || ? || ?)}, 2, ' hours' ],
      minute => \[ q{DATETIME("a_date", '-' || ? || ?)}, 3, ' minutes' ],
      month  => \[ q{DATETIME("a_date", '-' || ? || ?)}, 4, ' months' ],
      second => \[ q{DATETIME("a_date", '-' || ? || ?)}, 5, ' seconds' ],
      year   => \[ q{DATETIME("a_date", '-' || ? || ?)}, 6, ' years' ],
   },

   pluck_sql_prefix => \[ q<STRFTIME('%S', "me"."a_date")> ],

   pluck_sql_by_part => {
      year                => \[ q<STRFTIME('%Y', "a_date")> ],
      month               => \[ q<STRFTIME('%m', "a_date")> ],
      day_of_month        => \[ q<STRFTIME('%d', "a_date")> ],
      hour                => \[ q<STRFTIME('%H', "a_date")> ],
      day_of_year         => \[ q<STRFTIME('%j', "a_date")> ],
      minute              => \[ q<STRFTIME('%M', "a_date")> ],
      second              => \[ q<STRFTIME('%S', "a_date")> ],
      day_of_week         => \[ q<STRFTIME('%w', "a_date")> ],
      week                => \[ q<STRFTIME('%W', "a_date")> ],
      julian_day          => \[ q<STRFTIME('%J', "a_date")> ],
      seconds_since_epoch => \[ q<STRFTIME('%s', "a_date")> ],
      fractional_seconds  => \[ q<STRFTIME('%f', "a_date")> ],
   },

   pluck_sql_by_part_result => {
      month               => '01',
      day_of_month        => '02',
      hour                => '03',
      day_of_year         => '002',
      minute              => '04',
      second              => '05',
      week                => '01',
      julian_day          => '2455928.627835648',
      seconds_since_epoch => '1325473445',
      fractional_seconds  => '05.000',
   },
});

done_testing;