DB/CRUD.pm

filter: Statementstmt 10.3% 17 / 164 Branchbran 0.0% 0 / 146 Conditioncond 0.0% 0 / 28 MC/DCmcdc 0.0% 0 / 16 Subroutinesub 20.0% 5 / 25 Podpod 0.0% 0 / 20 totaltotal 5.5% 22 / 399 CC 86 SCAR 42.5
CC
86
Cov
5%
putrec
156.0
update
132.0
getrec
110.0
CRAP 70.4
« DB.pm ↑ Summary ._DB.pm »
1 # CRUD.pm
2 # by Bill Weinman -- Database CRUD
3 # Copyright (c) 1995-2008 The BearHeart Group, LLC
4 #
5 # based upon the old bwDB.pm
6 # Note bene: CRUD is Create, Retrieve, Update, and Delete
7 #
8 # See POD for History
9 #
10 package BW::DB::CRUD;
11 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 ▶use Digest::MD5;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶use BW::Constants;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 ▶use base qw( BW::DB BW::Base );
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 1 our $VERSION = "0.10";
19  
20 # _setter_getter entry points
21 0 ▶sub id_type { BW::Base::_setter_getter(@_); }
Subroutine id_type: not called CC=1 SCAR=6.9
Pod undocumented
22  
23 ### main crud methods
24  
25 # sub getrec( table, id, options ... )
26 #
27 # caching getrec
28 #
29 # options:
30 # refresh -- force refresh of cache from database
31 #
32 sub getrec
33 0 ▶{
Subroutine getrec: not called CC=10 SCAR=47.0
Pod undocumented
34 0 my $sn = 'getrec';
35 0 ▶ my $self = shift or return undef;
Branch: 1 branch
BranchTrueFalseTotal
my $self = shift() or return undef 0 0 0
36 0 ▶ my $t = shift or return $self->_error("$sn: no table name");
Branch: 1 branch
BranchTrueFalseTotal
my $t = shift() or return $self->_error("${sn}: no table name") 0 0 0
37 0 ▶ my $id = shift or return $self->_error("$sn: no id");
Branch: 1 branch
BranchTrueFalseTotal
my $id = shift() or return $self->_error("${sn}: no id") 0 0 0
38 0 ▶ my $opt = shift || '';
Condition0%0/2
shift() || ''
l!l
00
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
39 0 my $rc;
40  
41 0 my $cache = $self->{db_cache}{$t}{$id};
42 0 ▶ if ( $cache and @$cache and $opt ne 'refresh' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cache and @$cache and $opt ne 'refresh') { } 0 0 0
Condition0%0/6
$cache and @$cache and $opt ne "refresh"
!ll&&!rl&&r
000
$cache and @$cache
!ll&&!rl&&r
000
MC/DC0%0/3
$cache and @$cache and $opt ne "refresh"
$cache @$cache $opt ne "refresh"
Truth table0%0/4
A and B and C
A= $cacheB= @$cacheC= $opt ne "refresh"
ABCresult
0XX0
10X0
1100
1111
43 0 return $cache;
44 } else {
45 0 $rc = $self->get( $t, "${t}_id", $id );
46 0 ▶ return $self->{db_cache}{$t}{$id} = $rc if $rc and @$rc;
Branch: 1 branch
BranchTrueFalseTotal
if $rc and @$rc 0 0 0
Condition0%0/3
$rc and @$rc
!ll&&!rl&&r
000
MC/DC0%0/2
$rc and @$rc
$rc @$rc
Truth table0%0/3
A and B
A= $rcB= @$rc
ABresult
0X0
100
111
47 }
48  
49 0 return VOID;
50 }
51  
52 # sub putrec( table, id, rechash )
53 #
54 # caching update and insert
55 #
56 # old records will be updated based on id or rechash->{table_id}
57 # new records will be inserted with id or a new id
58 #
59 sub putrec
60 0 ▶{
Subroutine putrec: not called CC=12 SCAR=50.5
Pod undocumented
61 0 my $sn = 'putrec';
62 0 ▶ my $self = shift or return undef;
Branch: 1 branch
BranchTrueFalseTotal
my $self = shift() or return undef 0 0 0
63 0 ▶ my $t = shift or return $self->_error("$sn: no table name");
Branch: 1 branch
BranchTrueFalseTotal
my $t = shift() or return $self->_error("${sn}: no table name") 0 0 0
64 0 ▶ my $id = shift || ''; # can be blank for new recs
Condition0%0/2
shift() || ''
l!l
00
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
65 0 ▶ my $rechash = shift or return $self->_error("$sn no rechash");
Branch: 1 branch
BranchTrueFalseTotal
my $rechash = shift() or return $self->_error("$sn no rechash") 0 0 0
66 0 my $table_id = $t . '_id';
67  
68 0 ▶ if ( $rechash->{$table_id} and !$id ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rechash->{$table_id} and not $id) 0 0 0
Condition0%0/3
$rechash->{$table_id} and not $id
!ll&&!rl&&r
000
MC/DC0%0/2
$rechash->{$table_id} and not $id
$rechash->{$table_id} not $id
Truth table0%0/3
A and not(B)
A= $rechash->{$table_id}B= not $id
ABresult
0X0
100
111
69 0 $id = $rechash->{$table_id};
70 }
71  
72 0 ▶ if ( $id and $self->getrec( $t, $id ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($id and $self->getrec($t, $id)) { } 0 0 0
Condition0%0/3
$id and $self->getrec($t, $id)
!ll&&!rl&&r
000
MC/DC0%0/2
$id and $self->getrec($t, $id)
$id $self->getrec($t, $id)
Truth table0%0/3
A and B
A= $idB= $self->getrec($t, $id)
ABresult
0X0
100
111
73 0 ▶ $self->update( $t, $table_id, $id, $rechash ) or return FAILURE;
Branch: 1 branch
BranchTrueFalseTotal
$self->update($t, $table_id, $id, $rechash) or return "" 0 0 0
74 } else {
75 0 ▶ $id = $rechash->{$table_id} = $self->gen_id unless $id;
Branch: 1 branch
BranchTrueFalseTotal
unless $id 0 0 0
76 0 ▶ $self->insert( $t, $rechash ) or return FAILURE;
Branch: 1 branch
BranchTrueFalseTotal
$self->insert($t, $rechash) or return "" 0 0 0
77 }
78  
79 0 return $self->{db_cache}{$t}{$id} = $rechash;
80 }
81  
82 # sub delrec( table, id )
83 #
84 # caching delete
85 #
86 sub delrec
87 0 ▶{
Subroutine delrec: not called CC=5 SCAR=34.0
Pod undocumented
88 0 my $sn = 'delrec';
89 0 ▶ my $self = shift or return undef;
Branch: 1 branch
BranchTrueFalseTotal
my $self = shift() or return undef 0 0 0
90 0 ▶ my $t = shift or return $self->_error("$sn: no table name");
Branch: 1 branch
BranchTrueFalseTotal
my $t = shift() or return $self->_error("${sn}: no table name") 0 0 0
91 0 ▶ my $id = shift || ''; # can be blank for new recs
Condition0%0/2
shift() || ''
l!l
00
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
92  
93 # delete from cache
94 0 ▶ delete $self->{db_cache}{$t}{$id} if $self->{db_cache}{$t}{$id};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"db_cache"}{$t}{$id} 0 0 0
95  
96 # delete from db
97 0 return $self->delete( $t, $t . '_id', $id );
98 }
99  
100 # delete ( table, key, value )
101 # returns TRUE or FALSE
102 sub delete
103 0 ▶{
Subroutine delete: not called CC=7 SCAR=40.3
Pod undocumented
104 0 ▶ my $self = shift or return undef;
Branch: 1 branch
BranchTrueFalseTotal
my $self = shift() or return undef 0 0 0
105 0 ▶ my $table = shift or return undef;
Branch: 1 branch
BranchTrueFalseTotal
my $table = shift() or return undef 0 0 0
106 0 ▶ my $key = shift or return undef;
Branch: 1 branch
BranchTrueFalseTotal
my $key = shift() or return undef 0 0 0
107 0 ▶ my $value = shift or return undef;
Branch: 1 branch
BranchTrueFalseTotal
my $value = shift() or return undef 0 0 0
108  
109 0 ▶ $self->sql_connect unless $self->{dbh};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"dbh"} 0 0 0
110 0 ▶ return $self->_error("Database not connected.") unless $self->{dbh};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"dbh"} 0 0 0
111  
112 0 my $query = "DELETE FROM $table WHERE $key = ?";
113 0 return $self->sql_do( $query, $value );
114 }
115  
116 # get ( table, key, value )
117 # returns hashref (from DBI) or FALSE
118 sub get
119 0 ▶{
Subroutine get: not called CC=3 SCAR=24.8
Pod undocumented
120 0 my $sn = 'get';
121 0 my ( $self, $table, $key, $value ) = @_;
122  
123 0 ▶ $self->sql_connect unless $self->{dbh};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"dbh"} 0 0 0
124 0 ▶ return $self->_error("Database not connected.") unless $self->{dbh};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"dbh"} 0 0 0
125  
126 0 my $query = "SELECT * FROM $table WHERE $key = ?";
127 0 return $self->sql_select( $query, $value );
128 }
129  
130 # search
131 # alias for search_multi -- legacy support for a while
132 0 ▶sub search { return search_multi(@_) }
Subroutine search: not called CC=1 SCAR=6.9
Pod undocumented
133  
134 # search_multi ( table, key, value )
135 # returns arrayref of hashes
136 # use for non-unique keys
137 sub search_multi
138 0 ▶{
Subroutine search_multi: not called CC=7 SCAR=40.3
Pod undocumented
139 0 ▶ my $self = shift or return undef;
Branch: 1 branch
BranchTrueFalseTotal
my $self = shift() or return undef 0 0 0
140 0 ▶ my $table = shift or return undef;
Branch: 1 branch
BranchTrueFalseTotal
my $table = shift() or return undef 0 0 0
141 0 ▶ my $key = shift or return undef;
Branch: 1 branch
BranchTrueFalseTotal
my $key = shift() or return undef 0 0 0
142 0 ▶ my $value = shift or return undef;
Branch: 1 branch
BranchTrueFalseTotal
my $value = shift() or return undef 0 0 0
143  
144 0 ▶ $self->sql_connect unless $self->{dbh};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"dbh"} 0 0 0
145 0 ▶ return $self->_error("Database not connected.") unless $self->{dbh};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"dbh"} 0 0 0
146  
147 0 my $query = "SELECT * FROM $table WHERE $key LIKE ? ORDER BY $key";
148 0 return $self->sql_select( $query, $value );
149 }
150  
151 # update ( table, key, value, { name => value, ... } )
152 sub update
153 0 ▶{
Subroutine update: not called CC=11 SCAR=48.8
Pod undocumented
154 0 my $sn = 'update';
155 0 ▶ my $self = shift or return undef;
Branch: 1 branch
BranchTrueFalseTotal
my $self = shift() or return undef 0 0 0
156 0 ▶ my $table = shift or return undef;
Branch: 1 branch
BranchTrueFalseTotal
my $table = shift() or return undef 0 0 0
157 0 ▶ my $key = shift or return undef;
Branch: 1 branch
BranchTrueFalseTotal
my $key = shift() or return undef 0 0 0
158 0 ▶ my $value = shift or return undef;
Branch: 1 branch
BranchTrueFalseTotal
my $value = shift() or return undef 0 0 0
159 0 ▶ my $nvpairs = shift or return undef;
Branch: 1 branch
BranchTrueFalseTotal
my $nvpairs = shift() or return undef 0 0 0
160 0 my @cols;
161 my @vals;
162  
163 0 ▶ $self->sql_connect unless $self->{dbh};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"dbh"} 0 0 0
164 0 ▶ return $self->_error("Database not connected.") unless $self->{dbh};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"dbh"} 0 0 0
165  
166 0 foreach my $k ( keys %{$nvpairs} ) {
167 0 push @cols, "$k = ?";
168 0 push @vals, $nvpairs->{$k};
169 }
170 0 ▶ return undef unless ( @cols and @vals );
Branch: 1 branch
BranchTrueFalseTotal
unless @cols and @vals 0 0 0
Condition0%0/3
@cols and @vals
!ll&&!rl&&r
000
MC/DC0%0/2
@cols and @vals
@cols @vals
Truth table0%0/3
A and B
A= @colsB= @vals
ABresult
0X0
100
111
171  
172 0 my $query = "UPDATE $table SET " . join( ', ', @cols ) . " WHERE $key = ?";
173  
174 0 push @vals, $value;
175 0 return $self->sql_do( $query, @vals );
176 }
177  
178 ### nv routines
179  
180 # setnv ( object_type, object_id, name, value, attribute, flags, seq )
181 # requires a table named "nv"
182 sub setnv
183 0 ▶{
Subroutine setnv: not called CC=10 SCAR=47.0
Pod undocumented
184 0 ▶ my $self = shift or return undef;
Branch: 1 branch
BranchTrueFalseTotal
my $self = shift() or return undef 0 0 0
185 0 my $sn = 'setnv';
186 0 my ( $t, $id, $n, $v, $a, $f, $s ) = @_;
187 0 ▶ return $self->_error("$sn: missing object type") unless $t;
Branch: 1 branch
BranchTrueFalseTotal
unless $t 0 0 0
188 0 ▶ return $self->_error("$sn: missing object id") unless $id;
Branch: 1 branch
BranchTrueFalseTotal
unless $id 0 0 0
189 0 ▶ return $self->_error("$sn: missing name") unless $n;
Branch: 1 branch
BranchTrueFalseTotal
unless $n 0 0 0
190 0 ▶ return $self->_error("$sn: missing value") unless $v;
Branch: 1 branch
BranchTrueFalseTotal
unless $v 0 0 0
191  
192 0 my $rec = {
193 object_type => $t,
194 object_id => $id,
195 name => $n,
196 value => $v
197 };
198  
199 0 ▶ $rec->{attribute} = $a if $a;
Branch: 1 branch
BranchTrueFalseTotal
if $a 0 0 0
200 0 ▶ $rec->{flags} = $f if $f;
Branch: 1 branch
BranchTrueFalseTotal
if $f 0 0 0
201 0 ▶ $rec->{seq} = $s if $s;
Branch: 1 branch
BranchTrueFalseTotal
if $s 0 0 0
202  
203 0 my $rc = $self->putrec( 'nv', undef, $rec );
204 0 ▶ if ( $rc->{nv_id} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rc->{'nv_id'}) { } 0 0 0
205 0 return $rc->{nv_id};
206 } else {
207 0 return $self->{FALSE};
208 }
209 }
210  
211 # getnv ( t, id, n )
212 # returns hash of first rec found
213 # if no n, error
214 sub getnv
215 0 ▶{
Subroutine getnv: not called CC=5 SCAR=34.0
Pod undocumented
216 0 ▶ my $self = shift or return undef;
Branch: 1 branch
BranchTrueFalseTotal
my $self = shift() or return undef 0 0 0
217 0 my $sn = 'getnv';
218 0 my ( $t, $id, $n ) = @_;
219 0 ▶ return $self->_error("$sn: missing object type") unless $t;
Branch: 1 branch
BranchTrueFalseTotal
unless $t 0 0 0
220 0 ▶ return $self->_error("$sn: missing object id") unless $id;
Branch: 1 branch
BranchTrueFalseTotal
unless $id 0 0 0
221 0 ▶ return $self->_error("$sn: missing object name") unless $n;
Branch: 1 branch
BranchTrueFalseTotal
unless $n 0 0 0
222  
223 0 return $self->sql_select(
224 qq{
225 SELECT * FROM nv WHERE object_type = ? AND object_id = ? AND name = ?
226 }, $t, $id, $n
227 );
228 }
229  
230 # searchnv ( t, id, name, value, attribute )
231 # returns arrayref of hashes { keys: nv_id, object_type, object_id, name, value }
232 # if no n, returns all nvs for t, id
233 sub searchnv
234 0 ▶{
Subroutine searchnv: not called CC=7 SCAR=40.3
Pod undocumented
235 0 ▶ my $self = shift or return undef;
Branch: 1 branch
BranchTrueFalseTotal
my $self = shift() or return undef 0 0 0
236 0 my $sn = 'searchnv';
237 0 my ( $t, $id, $n, $v, $a ) = @_;
238 0 ▶ return $self->_error("$sn: missing object type") unless $t;
Branch: 1 branch
BranchTrueFalseTotal
unless $t 0 0 0
239 0 ▶ return $self->_error("$sn: missing object id") unless $id;
Branch: 1 branch
BranchTrueFalseTotal
unless $id 0 0 0
240 0 ▶ return $self->_error("$sn: missing nv name") unless $n;
Branch: 1 branch
BranchTrueFalseTotal
unless $n 0 0 0
241  
242 0 my $sql = qq{ SELECT * FROM nv WHERE object_type = ? AND object_id = ? AND name = ? };
243  
244 0 my @nvp = ( $t, $id, $n );
245  
246 0 ▶ if ($v) {
Branch: 1 branch
BranchTrueFalseTotal
if ($v) 0 0 0
247 0 $sql .= qq{ AND value = ? };
248 0 push( @nvp, $v );
249 }
250  
251 0 ▶ if ($a) {
Branch: 1 branch
BranchTrueFalseTotal
if ($a) 0 0 0
252 0 $sql .= qq{ AND attribute = ? };
253 0 push( @nvp, $a );
254 }
255  
256 0 $sql .= qq{ ORDER BY seq };
257  
258 0 return $self->sql_select( $sql, @nvp );
259 }
260  
261 # updnv ( nv_id, value, attribute )
262 # updates rec with new v
263 # returns TRUE (success) or FALSE (failure)
264 sub updnv
265 0 ▶{
Subroutine updnv: not called CC=7 SCAR=40.3
Pod undocumented
266 0 ▶ my $self = shift or return undef;
Branch: 1 branch
BranchTrueFalseTotal
my $self = shift() or return undef 0 0 0
267 0 my $sn = 'updnv';
268 0 my ( $nv_id, $v, $a ) = @_;
269 0 my $rec;
270 0 ▶ return $self->_error("$sn: missing nv_id") unless $nv_id;
Branch: 1 branch
BranchTrueFalseTotal
unless $nv_id 0 0 0
271 0 ▶ return $self->_error("$sn: missing value") unless $v;
Branch: 1 branch
BranchTrueFalseTotal
unless $v 0 0 0
272  
273 0 ▶ return $self->_error("$sn: nv $nv_id not found") unless $rec = $self->getrec( 'nv', $nv_id );
Branch: 1 branch
BranchTrueFalseTotal
unless $rec = $self->getrec("nv", $nv_id) 0 0 0
274  
275 0 ▶ $rec->{value} = $v if $v;
Branch: 1 branch
BranchTrueFalseTotal
if $v 0 0 0
276 0 ▶ $rec->{attribute} = $a if $a;
Branch: 1 branch
BranchTrueFalseTotal
if $a 0 0 0
277  
278 0 return $self->putrec( 'nv', $nv_id, $rec );
279 }
280  
281 # delnv ( nv_id )
282 # deletes nv rec
283 sub delnv
284 0 ▶{
Subroutine delnv: not called CC=3 SCAR=24.8
Pod undocumented
285 0 ▶ my $self = shift or return undef;
Branch: 1 branch
BranchTrueFalseTotal
my $self = shift() or return undef 0 0 0
286 0 my $sn = 'delnv';
287 0 ▶ my $nv_id = shift or return $self->_error("$sn: no nv_id");
Branch: 1 branch
BranchTrueFalseTotal
my $nv_id = shift() or return $self->_error("${sn}: no nv_id") 0 0 0
288  
289 0 return $self->delrec( 'nv', $nv_id );
290 }
291  
292 ### utilty routines
293  
294 # return a list of fields for a given table
295 sub fields_list
296 0 ▶{
Subroutine fields_list: not called CC=5 SCAR=34.0
Pod undocumented
297 0 ▶ my $self = shift or return undef;
Branch: 1 branch
BranchTrueFalseTotal
my $self = shift() or return undef 0 0 0
298 0 ▶ my $table_name = shift or return undef;
Branch: 1 branch
BranchTrueFalseTotal
my $table_name = shift() or return undef 0 0 0
299 0 my $fields_list;
300  
301 0 ▶ return $fields_list if ( $fields_list = $self->{fields_cache}{$table_name} );
Branch: 1 branch
BranchTrueFalseTotal
if $fields_list = $self->{"fields_cache"}{$table_name} 0 0 0
302  
303 0 my $query = " SHOW COLUMNS from $table_name "; # this is likely mysql-specific
304 0 $fields_list = $self->{dbh}->selectcol_arrayref( $query, { Columns => [1] } );
305 0 $self->{fields_cache}{$table_name} = $fields_list;
306 0 ▶ return $fields_list || undef;
Condition0%0/2
$fields_list || undef
l!l
00
MC/DC0%0/1
$fields_list || undef
$fields_list
Truth table0%0/2
A
A= $fields_list
Aresult
11
00
307 }
308  
309 sub gen_id
310 0 ▶{
Subroutine gen_id: not called CC=4 SCAR=30.0
Pod undocumented
311 0 ▶ my $self = shift or return undef;
Branch: 1 branch
BranchTrueFalseTotal
my $self = shift() or return undef 0 0 0
312 0 ▶ my $id_type = $self->id_type || '';
Condition0%0/2
$self->id_type || ''
l!l
00
MC/DC0%0/1
$self->id_type || ''
$self->id_type
Truth table0%0/2
A
A= $self->id_type
Aresult
11
00
313 0 ▶ if ( $id_type eq 'base64' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($id_type eq 'base64') { } 0 0 0
314 0 return $self->gen_id_base64;
315 } else {
316 0 return $self->gen_id_md5hash;
317 }
318 }
319  
320 sub gen_id_md5hash
321 0 ▶{
Subroutine gen_id_md5hash: not called CC=2 SCAR=17.9
Pod undocumented
322 0 ▶ my $self = shift or return undef;
Branch: 1 branch
BranchTrueFalseTotal
my $self = shift() or return undef 0 0 0
323 0 return $self->md5hash();
324 }
325  
326 sub gen_id_base64
327 0 ▶{
Subroutine gen_id_base64: not called CC=2 SCAR=17.9
Pod undocumented
328 0 ▶ my $self = shift or return undef;
Branch: 1 branch
BranchTrueFalseTotal
my $self = shift() or return undef 0 0 0
329 0 return $self->md5base64();
330 }
331  
332 sub md5base64 # returns a url-safe base-64 MD5 hash for use as an ID field
333 0 ▶{
Subroutine md5base64: not called CC=2 SCAR=17.9
Pod undocumented
334 0 my ( $self, $parm ) = @_;
335 0 ▶ $parm = 'unk' unless $parm;
Branch: 1 branch
BranchTrueFalseTotal
unless $parm 0 0 0
336 0 my $r = Digest::MD5::md5_base64( $$, time, rand, $parm );
337 0 $r =~ tr|+/|!-|; # '+' and '/' chars are nasty for URLs
338 0 return $r;
339 }
340  
341 sub md5hash
342 0 ▶{
Subroutine md5hash: not called CC=1 SCAR=6.9
Pod undocumented
343 0 return Digest::MD5::md5_hex( $$, time, rand );
344 }
345  
346 1 1;
347  
348 =head1 NAME
349  
350 BW::DB::CRUD - Database CRUD
351  
352 =head1 SYNOPSIS
353  
354 Database CRUD: (C)reate, (R)etrieve, (U)pdate, (D)elete
355  
356 use BW::DB::CRUD;
357 my $o = BW::DB::CRUD->new;
358  
359 =head1 METHODS
360  
361 =over 4
362  
363 =item B<new>( )
364  
365 Constructs a new BW::DB::CRUD object.
366  
367 Returns a blessed BW::DB::CRUD object reference.
368 Returns undef (VOID) if the object cannot be created.
369  
370 =item B<error>
371  
372 Returns and clears the object error message.
373  
374 =back
375  
376 =head1 WARNING
377  
378 This module is currently in an unfinished state. Do not use this
379 for new projects. The interface WILL change.
380  
381 =head1 AUTHOR
382  
383 Written by Bill Weinman E<lt>http://bw.org/E<gt>.
384  
385 =head1 COPYRIGHT
386  
387 Copyright (c) 1995-2010 The BearHeart Group, LLC
388  
389 =head1 HISTORY
390  
391 2010-02-17 bw -- first CPAN version - not ready for prime time!
392 2008-03-27 bw -- cleanup for publishing
393 2007-10-21 bw -- fixed a caching bug in getrec
394 2007-10-19 bw -- initial version.
395  
396 =cut
397  
« DB.pm ↑ Summary ._DB.pm »