diff options
| author | fukachan <fukachan> | 2001-08-05 12:07:22 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2001-08-05 12:07:22 +0000 |
| commit | 954837609d32b1441a7ac8042e8bf639bfe329ee (patch) | |
| tree | 5f68f7ff35d2ecd07a34c455e4625fbcaa63c88f /fml/lib/IO/Adapter/SQL | |
| parent | 63e18eb96c1e4c77f2b578036d072db68f372359 (diff) | |
| download | fml8-954837609d32b1441a7ac8042e8bf639bfe329ee.tar.gz fml8-954837609d32b1441a7ac8042e8bf639bfe329ee.tar.bz2 fml8-954837609d32b1441a7ac8042e8bf639bfe329ee.zip | |
move main functions to IO::Adapter::SQL::toymodel
define fetch_and_cache_address_list() to fetch and cache the array of
address list. The main part of get_next_value().
Diffstat (limited to 'fml/lib/IO/Adapter/SQL')
| -rw-r--r-- | fml/lib/IO/Adapter/SQL/toymodel.pm | 66 |
1 files changed, 54 insertions, 12 deletions
diff --git a/fml/lib/IO/Adapter/SQL/toymodel.pm b/fml/lib/IO/Adapter/SQL/toymodel.pm index dc1e926b..8b4cc218 100644 --- a/fml/lib/IO/Adapter/SQL/toymodel.pm +++ b/fml/lib/IO/Adapter/SQL/toymodel.pm @@ -3,7 +3,7 @@ # Copyright (C) 2000,2001 Ken'ichi Fukamachi # All rights reserved. # -# $FML: toymodel.pm,v 1.1.1.1 2001/08/05 01:55:17 fukachan Exp $ +# $FML: toymodel.pm,v 1.2 2001/08/05 03:24:45 fukachan Exp $ # @@ -29,21 +29,63 @@ model. =head1 METHODS -=head2 C<build_sql_query($args)> +=cut + + +sub add +{ + my ($self, $addr) = @_; + + print STDERR "add( $addr )\n" if $ENV{'debug'}; - $args = { + my $query = $self->_build_sql_query({ query => 'add', - address => 'rudo@nuinui.net', - _params => { - ml_name => 'elena', - file => 'actives', - }, - } + address => $addr, + }); + $self->execute({ query => $query }); +} -=cut +sub delete +{ + my ($self, $addr) = @_; + + print STDERR "delete( $addr )\n" if $ENV{'debug'}; -sub build_sql_query + my $query = $self->_build_sql_query({ + query => 'delete', + address => $addr, + }); + $self->execute({ query => $query }); +} + + +sub fetch_and_cache_address_list +{ + my ($self, $args) = @_; + + my $query = $self->_build_sql_query({ + query => 'get_next_value', + }); + $self->execute({ query => $query }); +} + + +# Descriptions: +# +# $args = { +# query => 'add', +# address => 'rudo@nuinui.net', +# _params => { +# ml_name => 'elena', +# file => 'actives', +# }, +# } +# +# Arguments: $self $args +# Side Effects: +# Return Value: none +sub _build_sql_query { my ($self, $args) = @_; my $query = $args->{ query }; @@ -54,7 +96,7 @@ sub build_sql_query my $file = $self->{ _params }->{ file }; my $table = $self->{ _table }; - print STDERR "build_sql_query( query=$query )\n" if $ENV{'debug'}; + print STDERR "_build_sql_query( query=$query )\n" if $ENV{'debug'}; if ($query eq 'add') { "insert into $table values ('$ml_name', '$file', '$address', 0, 0)"; |
