SQLEngine/Driver/CSV.pm untested

filter: Statementstmt 0.0% 0 / 18 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 28 CC 1 SCAR 6.9
CC
1
Cov
0%
sql_seq_increment
2.0
sql_detect_table
2.0
dbms_null_becomes_emptystring
2.0
CRAP 2.0
1 =head1 NAME
2  
3 DBIx::SQLEngine::Driver::CSV - Support DBD::CSV driver
4  
5 =head1 SYNOPSIS
6  
7 B<DBI Wrapper>: Adds methods to a DBI database handle.
8  
9 my $sqldb = DBIx::SQLEngine->new( 'dbi:CSV:f_dir=my_data_path' );
10
11 B<Portability Subclasses:> Uses driver's idioms or emulation.
12
13 $hash_ary = $sqldb->fetch_select(
14 table => 'students'
15 limit => 5, offset => 10
16 );
17  
18 =head1 DESCRIPTION
19  
20 This package provides a subclass of DBIx::SQLEngine which compensates for
21 some of DBD::CSV's idiosyncrasies.
22  
23 Note that DBD::CSV does not support the normal full range of SQL DBMS
24 functionality. Upgrade to the latest versions of DBI and SQL::Statement and
25 consult their documentation to understand their current limits.
26  
27 =head2 About Driver Subclasses
28  
29 You do not need to use this package directly; when you connect to a database, the SQLEngine object is automatically re-blessed in to the appropriate subclass.
30  
31 =cut
32  
33 ########################################################################
34  
35 package DBIx::SQLEngine::Driver::CSV;
36  
37 use strict;
38 use Carp;
39  
40 ########################################################################
41  
42 use DBIx::SQLEngine::Driver::Trait::PerlDBLib qw( :all !sql_seq_increment );
43  
44 use DBIx::SQLEngine::Driver::Trait::NoJoins ':all';
45  
46 ########################################################################
47  
48 =head2 sql_seq_increment
49  
50 Overrides behavior of DBIx::SQLEngine::Driver::Trait::NoSequences.
51  
52 =cut
53  
54 # $sql, @params = $sqldb->sql_seq_increment( $table, $field, $current, $next );
55 sub sql_seq_increment {
56 my ($self, $table, $field, $current, $next) = @_;
57 my $seq_table = $self->seq_table_name;
58 $self->sql_update(
59 table => $seq_table,
60 values => { seq_value => $next },
61 criteria => ['seq_name = ?', "$table.$field"]
62 );
63 }
64  
65 ########################################################################
66  
67 =head2 sql_detect_table
68  
69 $sqldb->sql_detect_table ( $tablename ) : %sql_select_clauses
70  
71 Implemented using DBD::CSV's "select * from $tablename where 1 = 0".
72  
73 =cut
74  
75 sub sql_detect_table {
76 my ($self, $tablename) = @_;
77 return ( table => $tablename, criteria => '1 = 0' )
78 }
79  
80 ########################################################################
81  
82 =head2 dbms_null_becomes_emptystring
83  
84 $sqldb->dbms_null_becomes_emptystring () : 1
85  
86 Capability Limitation: This driver does not store real null or undefined values, converting them instead to empty strings.
87  
88 =cut
89  
90 sub dbms_null_becomes_emptystring { 1 }
91  
92 ########################################################################
93  
94 =head1 SEE ALSO
95  
96 See L<DBIx::SQLEngine> for the overall interface and developer documentation.
97  
98 See L<DBIx::SQLEngine::Docs::ReadMe> for general information about
99 this distribution, including installation and license information.
100  
101 =cut
102  
103 ########################################################################
104  
105 1;