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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations)
Fri Nov 29 04:50:21 2002 UTC (21 years, 5 months ago) by joko
Branch: MAIN
Changes since 1.1: +2 -1 lines
+ minor rule update

1 joko 1.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 joko 1.2 #print "_get_rules_autoscan", "\n";
56 joko 1.1 return [
57     { eol => "\r\n", sep_char => ",", quote_char => "\"", escape_char => "" },
58     { eol => "\r\n", sep_char => ";", quote_char => "\"", escape_char => "" },
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 joko 1.2 { eol => "\n", sep_char => ";", quote_char => "\"", escape_char => "\\", always_quote => 1 },
63 joko 1.1 ];
64     }
65    
66     1;
67    
68    
69     __END__
70    
71     =head1 NAME
72    
73     DBD::AutoCSV - A DBI driver based on DBD::CSV with automatic features
74    
75     =head1 DESCRIPTION
76    
77     It is about using DBD::CSV together with the "scan" feature and a preconfigured rulebase.
78    
79     See DBD::CSV for more informations. (perldoc DBD::CSV)
80     DBD::AutoCSV inherits from DBD::CSV.
81    
82     See L<DBI(3)> for details on DBI, L<SQL::Statement(3)> for details on
83     SQL::Statement and L<DBD::File(3)> for details on the base class
84     DBD::File.
85    
86    
87     =head1 WARNING
88    
89     THIS IS ALPHA SOFTWARE. It adds some dangerous features...
90    
91    
92     =head2 Prerequisites
93    
94     =over 4
95    
96     =item DBI
97    
98     the DBI (Database independent interface for Perl), version 1.00 or
99     a later release
100    
101     =item SQL::Statement
102    
103     a simple SQL engine
104    
105     =item Text::CSV_XS
106    
107     this module is used for writing rows to or reading rows from CSV files.
108    
109     =item DBD::CSV
110    
111     A DBI driver for CSV and similar structured files
112    
113     =back
114    
115    
116     =head1 AUTHOR AND COPYRIGHT
117    
118     This module is currently maintained by
119    
120     Andreas Motl
121     <andreas.motl@ilo.de>
122    
123     It is heavily based on various modules authored
124     and/or currently maintained by Jeff Zucker.
125    
126     The original author of DBD::CSV is Jochen Wiedmann.
127    
128     Copyright (C) 2002 by Andreas Motl
129    
130     All rights reserved.
131    
132     You may distribute this module under the terms of either the GNU
133     General Public License or the Artistic License, as specified in
134     the Perl README file.
135    
136     =head1 SEE ALSO
137    
138     L<DBI(3)>, L<Text::CSV_XS(3)>, L<SQL::Statement(3)>, L<DBD::CSV(3)>
139    
140     =cut

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