1DBD::File(3) User Contributed Perl Documentation DBD::File(3)
2
3
4
6 DBD::File - Base class for writing DBI drivers
7
9 This module is a base class for writing other DBDs.
10 It is not intended to function as a DBD itself.
11 If you want to access flatfiles, use DBD::AnyData, or DBD::CSV,
12 (both of which are subclasses of DBD::File).
13
15 The DBD::File module is not a true DBI driver, but an abstract base
16 class for deriving concrete DBI drivers from it. The implication is,
17 that these drivers work with plain files, for example CSV files or INI
18 files. The module is based on the SQL::Statement module, a simple SQL
19 engine.
20
21 See DBI for details on DBI, SQL::Statement for details on SQL::State‐
22 ment and DBD::CSV or DBD::IniFile for example drivers.
23
24 Metadata
25
26 The following attributes are handled by DBI itself and not by
27 DBD::File, thus they all work like expected:
28
29 Active
30 ActiveKids
31 CachedKids
32 CompatMode (Not used)
33 InactiveDestroy
34 Kids
35 PrintError
36 RaiseError
37 Warn (Not used)
38
39 The following DBI attributes are handled by DBD::File:
40
41 AutoCommit
42 Always on
43
44 ChopBlanks
45 Works
46
47 NUM_OF_FIELDS
48 Valid after "$sth-"execute>
49
50 NUM_OF_PARAMS
51 Valid after "$sth-"prepare>
52
53 NAME
54 Valid after "$sth-"execute>; undef for Non-Select statements.
55
56 NULLABLE
57 Not really working, always returns an array ref of one's, as
58 DBD::CSV doesn't verify input data. Valid after "$sth-"execute>;
59 undef for Non-Select statements.
60
61 These attributes and methods are not supported:
62
63 bind_param_inout
64 CursorName
65 LongReadLen
66 LongTruncOk
67
68 Additional to the DBI attributes, you can use the following dbh
69 attribute:
70
71 f_dir
72 This attribute is used for setting the directory where CSV files
73 are opened. Usually you set it in the dbh, it defaults to the cur‐
74 rent directory ("."). However, it is overwritable in the statement
75 handles.
76
77 Driver private methods
78
79 data_sources
80 The "data_sources" method returns a list of subdirectories of the
81 current directory in the form "DBI:CSV:f_dir=$dirname".
82
83 If you want to read the subdirectories of another directory, use
84
85 my($drh) = DBI->install_driver("CSV");
86 my(@list) = $drh->data_sources('f_dir' => '/usr/local/csv_data' );
87
88 list_tables
89 This method returns a list of file names inside $dbh->{'f_dir'}.
90 Example:
91
92 my($dbh) = DBI->connect("DBI:CSV:f_dir=/usr/local/csv_data");
93 my(@list) = $dbh->func('list_tables');
94
95 Note that the list includes all files contained in the directory,
96 even those that have non-valid table names, from the view of SQL.
97
99 · The module is using flock() internally. However, this function
100 is not available on all platforms. Using flock() is disabled on
101 MacOS and Windows 95: There's no locking at all (perhaps not so
102 important on MacOS and Windows 95, as there's a single user
103 anyways).
104
106 This module is currently maintained by
107
108 Jeff Zucker < jzucker @ cpan.org >
109
110 The original author is Jochen Wiedmann.
111
112 Copyright (C) 2004 by Jeff Zucker Copyright (C) 1998 by Jochen Wiedmann
113
114 All rights reserved.
115
116 You may freely distribute and/or modify this module under the terms of
117 either the GNU General Public License (GPL) or the Artistic License, as
118 specified in the Perl README file.
119
121 DBI, Text::CSV_XS, SQL::Statement
122
123
124
125perl v5.8.8 2006-02-07 DBD::File(3)