| 1 | package TableData::DBI; | ||
| 2 | |||
| 3 | 3 | ▶ | use 5.010001; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 3 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 3 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 3 | ▶ | use Role::Tiny::With; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | 3 | our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY | |
| 10 | 3 | our $DATE = '2024-05-14'; # DATE | |
| 11 | 3 | our $DIST = 'TableDataRoles-Standard'; # DIST | |
| 12 | 3 | our $VERSION = '0.025'; # VERSION | |
| 13 | |||
| 14 | 3 | with 'TableDataRole::Source::DBI'; | |
| 15 | |||
| 16 | 3 | our %SPEC; | |
| 17 | |||
| 18 | $SPEC{new} = { | ||
| 19 | 3 | v => 1.1, | |
| 20 | is_meth => 1, | ||
| 21 | is_func => 0, | ||
| 22 | args => { | ||
| 23 | dsn => { | ||
| 24 | schema => 'str*', | ||
| 25 | }, | ||
| 26 | dbh => { | ||
| 27 | schema => 'obj*', | ||
| 28 | }, | ||
| 29 | sth => { | ||
| 30 | schema => 'obj*', | ||
| 31 | }, | ||
| 32 | |||
| 33 | # only when using dsn | ||
| 34 | user => { | ||
| 35 | schema => ['any*', of=>['str*', 'code*']], | ||
| 36 | }, | ||
| 37 | password => { | ||
| 38 | schema => ['any*', of=>['str*', 'code*']], | ||
| 39 | }, | ||
| 40 | |||
| 41 | # only when using dsn or dbh | ||
| 42 | query => { | ||
| 43 | schema => 'str*', | ||
| 44 | }, | ||
| 45 | table => { | ||
| 46 | schema => 'str*', | ||
| 47 | }, | ||
| 48 | |||
| 49 | # only when using sth | ||
| 50 | sth_bind_params => { | ||
| 51 | schema => 'array*', | ||
| 52 | }, | ||
| 53 | |||
| 54 | row_count_sth => { | ||
| 55 | schema => 'obj*', | ||
| 56 | }, | ||
| 57 | row_count_query => { | ||
| 58 | schema => 'obj*', | ||
| 59 | }, | ||
| 60 | |||
| 61 | # only when using row_count_sth | ||
| 62 | row_count_sth_bind_params => { | ||
| 63 | schema => 'array*', | ||
| 64 | }, | ||
| 65 | }, | ||
| 66 | args_rels => { | ||
| 67 | req_one => [qw/dsn dbh sth/], | ||
| 68 | choose_one => [qw/query table/], | ||
| 69 | 'dep_any&' => [ | ||
| 70 | [user => [qw/dsn/]], | ||
| 71 | [password => [qw/dsn/]], | ||
| 72 | [query => [qw/dsn dbh/]], | ||
| 73 | [row_count_query => [qw/dsn dbh/]], | ||
| 74 | [table => [qw/dsn dbh/]], | ||
| 75 | [sth_bind_params => [qw/sth/]], | ||
| 76 | [row_count_sth_bind_params => [qw/row_count_sth/]], | ||
| 77 | ], | ||
| 78 | }, | ||
| 79 | }; | ||
| 80 | |||
| 81 | 3 | 1; | |
| 82 | # ABSTRACT: Get table data from DBI | ||
| 83 | |||
| 84 | __END__ | ||