line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Goo::DatabaseThing::Maker; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
############################################################################### |
4
|
|
|
|
|
|
|
# Nigel Hamilton |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# Copyright Nigel Hamilton 2005 |
7
|
|
|
|
|
|
|
# All Rights Reserved |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
# Author: Nigel Hamilton |
10
|
|
|
|
|
|
|
# Filename: Goo::DatabaseThing::Maker.pm |
11
|
|
|
|
|
|
|
# Description: Make a new row in a Table |
12
|
|
|
|
|
|
|
# |
13
|
|
|
|
|
|
|
# Date Change |
14
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
15
|
|
|
|
|
|
|
# 16/10/2005 Auto generated file |
16
|
|
|
|
|
|
|
# 16/10/2005 Need to create a Table |
17
|
|
|
|
|
|
|
# |
18
|
|
|
|
|
|
|
############################################################################### |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
6767
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
36
|
|
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
1
|
|
5
|
use Goo::Object; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
20
|
|
23
|
1
|
|
|
1
|
|
7
|
use Goo::Prompter; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
24
|
1
|
|
|
1
|
|
6
|
use Goo::Database; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
25
|
1
|
|
|
1
|
|
6
|
use Goo::TextEditor; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
41
|
|
26
|
|
|
|
|
|
|
|
27
|
1
|
|
|
1
|
|
5
|
use base qw(Goo::Object); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
263
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
############################################################################### |
31
|
|
|
|
|
|
|
# |
32
|
|
|
|
|
|
|
# run - edit a task |
33
|
|
|
|
|
|
|
# |
34
|
|
|
|
|
|
|
############################################################################### |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub run { |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
my ($this, $thing, $field) = @_; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Goo::Header::show($thing->get_filename(), "database"); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
foreach my $column ($thing->get_columns()) { |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# create a filename |
50
|
|
|
|
|
|
|
my $temp_filename = "/tmp/" . $thing->{table} . "-" . $field . ".tmp"; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# write database value to a file |
53
|
|
|
|
|
|
|
Goo::FileUtilities::write_file($temp_filename, $dbo->{$field}); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# edit the value |
56
|
|
|
|
|
|
|
Goo::TextEditor::edit($temp_filename); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# slurp the file back into RAM |
59
|
|
|
|
|
|
|
$dbo->{$field} = Goo::FileUtilities::slurp($temp_filename); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# update the database |
62
|
|
|
|
|
|
|
$dbo->replace(); |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# remove the temporary file |
65
|
|
|
|
|
|
|
unlink($temp_filename); |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
__END__ |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 NAME |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Goo::DatabaseThing::Maker - Make a new row in a database table |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 SYNOPSIS |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
use Goo::DatabaseThing::Maker; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 DESCRIPTION |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 METHODS |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=over |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=item run |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
make a new row |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=back |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 AUTHOR |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Nigel Hamilton <nigel@trexy.com> |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 SEE ALSO |
100
|
|
|
|
|
|
|
|