line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# -*- perl -*- |
2
|
|
|
|
|
|
|
# vim:ts=4:sw=4:aw:ai: |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# DBI::Format::CSV - a package for displaying result tables |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# Copyright (c) 2001, 2002 Thomas A. Lowery |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
# The DBI::Shell::CSV module is free software; you can redistribute |
9
|
|
|
|
|
|
|
# it and/or modify it under the same terms as Perl itself. |
10
|
|
|
|
|
|
|
# |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
73
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
package DBI::Format::CSV; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $VERSION = '11.96_03'; # TRIAL VERSION |
17
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
@DBI::Format::CSV::ISA = qw(DBI::Format::Base); |
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
6
|
use Text::Abbrev; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
50
|
|
22
|
1
|
|
|
1
|
|
5
|
use Text::Reform qw(form break_with); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
9
|
|
23
|
1
|
|
|
1
|
|
1079
|
use Text::CSV_XS; |
|
1
|
|
|
|
|
12198
|
|
|
1
|
|
|
|
|
266
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub header { |
26
|
3
|
|
|
3
|
0
|
8
|
my ($self, $sth, $fh, $sep) = @_; |
27
|
3
|
|
|
|
|
23
|
$self->SUPER::header($sth, $fh, $sep); |
28
|
3
|
|
|
|
|
7
|
$self->{'data'} = []; |
29
|
3
|
|
|
|
|
6
|
$self->{'formats'} = []; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
$self->{csv_obj} = Text::CSV_XS->new({ |
32
|
|
|
|
|
|
|
binary => 1, |
33
|
|
|
|
|
|
|
sep_char => $self->{sep}, |
34
|
3
|
|
|
|
|
31
|
always_quote => 1, |
35
|
|
|
|
|
|
|
}); |
36
|
|
|
|
|
|
|
|
37
|
3
|
|
|
|
|
458
|
my $names = $sth->{'NAME'}; |
38
|
3
|
|
|
|
|
7
|
my $csv = $self->{csv_obj}; |
39
|
3
|
|
|
|
|
61
|
my $status = $csv->print($fh, $names); |
40
|
3
|
|
|
|
|
167
|
$fh->print( "\n" ); |
41
|
3
|
|
|
|
|
42
|
return 1; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub row { |
45
|
30
|
|
|
30
|
0
|
52
|
my($self, $orig_row) = @_; |
46
|
30
|
|
|
|
|
51
|
my $i = 0; |
47
|
30
|
|
|
|
|
107
|
my @row = $self->SUPER::row([@$orig_row]); # don't alter original |
48
|
|
|
|
|
|
|
|
49
|
30
|
|
|
|
|
66
|
my $columns = $self->{'columns'}; |
50
|
30
|
|
|
|
|
52
|
my $breaks = $self->{'breaks'}; |
51
|
|
|
|
|
|
|
|
52
|
30
|
|
|
|
|
44
|
my $fh = $self->{'fh'}; |
53
|
30
|
|
|
|
|
42
|
my $csv = $self->{csv_obj}; |
54
|
30
|
|
|
|
|
178
|
my $status = $csv->print($fh, \@row); |
55
|
30
|
|
|
|
|
1298
|
$fh->print( "\n" ); |
56
|
|
|
|
|
|
|
|
57
|
30
|
|
|
|
|
429
|
return ++$self->{rows}; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub trailer { |
62
|
3
|
|
|
3
|
0
|
5
|
my $self = shift; |
63
|
|
|
|
|
|
|
# $self->SUPER::trailer(@_); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 NAME |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
DBI::Format::CSV - A package for displaying result tables |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 SYNOPSIS |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 DESCRIPTION |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
THIS PACKAGE IS STILL VERY EXPERIMENTAL. THINGS WILL CHANGE. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 AUTHOR AND COPYRIGHT |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Orignal Format module is Copyright (c) 1997, 1998 |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Jochen Wiedmann |
83
|
|
|
|
|
|
|
Am Eisteich 9 |
84
|
|
|
|
|
|
|
72555 Metzingen |
85
|
|
|
|
|
|
|
Germany |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Email: joe@ispsoft.de |
88
|
|
|
|
|
|
|
Phone: +49 7123 14887 |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
SQLMinus is Copyright (c) 2001, 2002 Thomas A. Lowery |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
The DBI::Format::CSV module is free software; you can redistribute it and/or |
93
|
|
|
|
|
|
|
modify it under the same terms as Perl itself. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 SEE ALSO |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
L, L, L |