summaryrefslogtreecommitdiff
path: root/fml/lib/IO/Adapter/MySQL.pm
diff options
context:
space:
mode:
authorfukachan <fukachan>2001-08-05 12:07:22 +0000
committerfukachan <fukachan>2001-08-05 12:07:22 +0000
commit954837609d32b1441a7ac8042e8bf639bfe329ee (patch)
tree5f68f7ff35d2ecd07a34c455e4625fbcaa63c88f /fml/lib/IO/Adapter/MySQL.pm
parent63e18eb96c1e4c77f2b578036d072db68f372359 (diff)
downloadfml8-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/MySQL.pm')
-rw-r--r--fml/lib/IO/Adapter/MySQL.pm67
1 files changed, 8 insertions, 59 deletions
diff --git a/fml/lib/IO/Adapter/MySQL.pm b/fml/lib/IO/Adapter/MySQL.pm
index 9ac00c96..e425917f 100644
--- a/fml/lib/IO/Adapter/MySQL.pm
+++ b/fml/lib/IO/Adapter/MySQL.pm
@@ -3,7 +3,7 @@
# Copyright (C) 2000,2001 Ken'ichi Fukamachi
# All rights reserved.
#
-# $FML: MySQL.pm,v 1.13 2001/06/17 08:57:10 fukachan Exp $
+# $FML: MySQL.pm,v 1.14 2001/08/05 03:24:44 fukachan Exp $
#
@@ -95,9 +95,12 @@ sub configure
# $self->{ _driver } is the $config->{ driver } object.
unless ($@) {
- print STDERR "load $pkg\n" if $ENV{ 'debug' };
+ printf STDERR "%-20s %s\n", "loading", $pkg if $ENV{'debug'};
+
@ISA = ($pkg, @ISA);
$me->{ _driver } = $pkg;
+
+ printf STDERR "%-20s %s\n", "MySQL::ISA:", "@ISA" if $ENV{'debug'};
}
else {
error_set($self, $@);
@@ -131,14 +134,11 @@ sub get_next_value
# for the first time
unless ($self->{ _res }) {
# $self->{ _driver } is the $config->{ driver } object.
- if ( $self->{ _driver }->can('get_next_value') ) {
- $self->{ _driver }->get_next_value($args);
+ if ( $self->can('fetch_and_cache_address_list') ) {
+ $self->fetch_and_cache_address_list($args);
}
else {
- my $query = $self->build_sql_query({
- query => 'get_next_value',
- });
- $self->execute({ query => $query });
+ croak "cannot get next value\n";
}
}
@@ -153,57 +153,6 @@ sub get_next_value
}
-=head2 C<add($addr)>
-
-add C<$addr> to the sql server specified at new().
-IO::Adapter::SQL::$model provides model specific SQL query statement.
-If IO::Adapter::SQL::add() exists, IO::Adapter::SQL::add() is called.
-
-=head2 C<delete($addr)>
-
-delete C<$addr> from the sql server specified at new().
-IO::Adapter::SQL::$model provides model specific SQL query statement.
-If IO::Adapter::SQL::delete() exists, IO::Adapter::SQL::delete() is called.
-
-=cut
-
-
-sub add
-{
- my ($self, $addr) = @_;
-
- # $self->{ _driver } is the $config->{ driver } object.
- if ( $self->{ _driver }->can('add') ) {
- $self->{ _driver }->add($addr);
- }
- else {
- my $query = $self->build_sql_query({
- query => 'add',
- address => $addr,
- });
- $self->execute({ query => $query });
- }
-}
-
-
-sub delete
-{
- my ($self, $addr) = @_;
-
- # $self->{ _driver } is the $config->{ driver } object.
- if ( $self->{ _driver }->can('delete') ) {
- $self->{ _driver }->delete($addr);
- }
- else {
- my $query = $self->build_sql_query({
- query => 'delete',
- address => $addr,
- });
- $self->execute({ query => $query });
- }
-}
-
-
=head1 SEE ALSO
L<DBI>,