/[cvs]/nfo/perl/libs/DBD/AutoCSV.pm
ViewVC logotype

Contents of /nfo/perl/libs/DBD/AutoCSV.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations)
Sun Nov 17 07:13:43 2002 UTC (21 years, 6 months ago) by joko
Branch: MAIN
+ initial check in

1 # -*- perl -*-
2 #
3 # DBD::AutoCSV - A DBI driver based on DBD::CSV with automatic features
4 #
5 # This module is currently maintained by
6 #
7 # Andreas Motl
8 # <andreas.motl@ilo.de>
9 #
10 # Copyright (C) 2002 by Andreas Motl
11 #
12 # All rights reserved.
13 #
14 # You may distribute this module under the terms of either the GNU
15 # General Public License or the Artistic License, as specified in
16 # the Perl README file.
17 #
18
19 require 5.004;
20 use strict;
21
22
23 require DynaLoader;
24 require DBD::CSV;
25 require IO::File;
26
27
28 package DBD::AutoCSV;
29
30 use vars qw(@ISA $VERSION $drh $err $errstr $sqlstate);
31
32 @ISA = qw(DBD::CSV);
33
34 $VERSION = '0.0001';
35
36 $err = 0; # holds error code for DBI::err
37 $errstr = ""; # holds error string for DBI::errstr
38 $sqlstate = ""; # holds error state for DBI::state
39 $drh = undef; # holds driver handle once initialised
40
41 @DBD::AutoCSV::dr::ISA = qw(DBD::CSV::dr);
42 @DBD::AutoCSV::db::ISA = qw(DBD::CSV::db);
43 @DBD::AutoCSV::st::ISA = qw(DBD::CSV::st);
44 @DBD::AutoCSV::Statement::ISA = qw(DBD::CSV::Statement);
45 @DBD::AutoCSV::Table::ISA = qw(DBD::CSV::Table);
46
47 $DBD::AutoCSV::dr::imp_data_size = 0;
48 $DBD::AutoCSV::dr::data_sources_attr = undef;
49 $DBD::AutoCSV::db::imp_data_size = 0;
50 $DBD::AutoCSV::st::imp_data_size = 0;
51
52 package DBD::CSV::Statement;
53
54 sub _get_rules_autoscan {
55 return [
56 { eol => "\r\n", sep_char => ",", quote_char => "\"", escape_char => "" },
57 { eol => "\r\n", sep_char => ";", quote_char => "\"", escape_char => "" },
58 { eol => "\n", sep_char => ";", quote_char => "\"", escape_char => "", always_quote => 1 },
59 { eol => "\n", sep_char => ":", quote_char => "", escape_char => "" }, # /etc/passwd
60 { eol => "\n", sep_char => ",", quote_char => "\"", escape_char => "" },
61 { eol => "\n", sep_char => "|", quote_char => "\"", escape_char => "" },
62 ];
63 }
64
65 1;
66
67
68 __END__
69
70 =head1 NAME
71
72 DBD::AutoCSV - A DBI driver based on DBD::CSV with automatic features
73
74 =head1 DESCRIPTION
75
76 It is about using DBD::CSV together with the "scan" feature and a preconfigured rulebase.
77
78 See DBD::CSV for more informations. (perldoc DBD::CSV)
79 DBD::AutoCSV inherits from DBD::CSV.
80
81 See L<DBI(3)> for details on DBI, L<SQL::Statement(3)> for details on
82 SQL::Statement and L<DBD::File(3)> for details on the base class
83 DBD::File.
84
85
86 =head1 WARNING
87
88 THIS IS ALPHA SOFTWARE. It adds some dangerous features...
89
90
91 =head2 Prerequisites
92
93 =over 4
94
95 =item DBI
96
97 the DBI (Database independent interface for Perl), version 1.00 or
98 a later release
99
100 =item SQL::Statement
101
102 a simple SQL engine
103
104 =item Text::CSV_XS
105
106 this module is used for writing rows to or reading rows from CSV files.
107
108 =item DBD::CSV
109
110 A DBI driver for CSV and similar structured files
111
112 =back
113
114
115 =head1 AUTHOR AND COPYRIGHT
116
117 This module is currently maintained by
118
119 Andreas Motl
120 <andreas.motl@ilo.de>
121
122 It is heavily based on various modules authored
123 and/or currently maintained by Jeff Zucker.
124
125 The original author of DBD::CSV is Jochen Wiedmann.
126
127 Copyright (C) 2002 by Andreas Motl
128
129 All rights reserved.
130
131 You may distribute this module under the terms of either the GNU
132 General Public License or the Artistic License, as specified in
133 the Perl README file.
134
135 =head1 SEE ALSO
136
137 L<DBI(3)>, L<Text::CSV_XS(3)>, L<SQL::Statement(3)>, L<DBD::CSV(3)>
138
139 =cut

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed