summaryrefslogtreecommitdiff
path: root/fml/lib/SQL
diff options
context:
space:
mode:
authorfukachan <fukachan>2001-03-18 14:29:10 +0000
committerfukachan <fukachan>2001-03-18 14:29:10 +0000
commit7d35db79dd6659487fe26447ab22caa36e597eda (patch)
tree3fbaa8530edde4898ca261d86878977a2c20d5c7 /fml/lib/SQL
parente44c90f1228747f8e7c0952047ff934b9039d9cb (diff)
downloadfml8-7d35db79dd6659487fe26447ab22caa36e597eda.tar.gz
fml8-7d35db79dd6659487fe26447ab22caa36e597eda.tar.bz2
fml8-7d35db79dd6659487fe26447ab22caa36e597eda.zip
IO::Adapter::DBI -< IO::Adapter::MySQL
SQL::Schema::toymodel holds model specific functions and nuke $args->{query} parameters.
Diffstat (limited to 'fml/lib/SQL')
-rw-r--r--fml/lib/SQL/Schema/toymodel.pm20
1 files changed, 19 insertions, 1 deletions
diff --git a/fml/lib/SQL/Schema/toymodel.pm b/fml/lib/SQL/Schema/toymodel.pm
index 5ae90645..0c15e750 100644
--- a/fml/lib/SQL/Schema/toymodel.pm
+++ b/fml/lib/SQL/Schema/toymodel.pm
@@ -31,8 +31,26 @@ model.
=cut
-sub new
+
+sub build_sql_query
{
+ my ($self, $args) = @_;
+ my $query = $args->{ query };
+ my $ml_name = $self->{ _params }->{ ml_name };
+ my $file = $self->{ _params }->{ file };
+ my $address = $args->{ address };
+ my $table = $self->{ _table };
+
+ if ($query eq 'add') {
+ "insert into $table values ('$ml_name', '$file', '$address', 0, 0)";
+ }
+ elsif ($query eq 'delete') {
+ "delete from $table where ml='$ml_name' and address='$address'";
+ }
+ else {
+ "select address from $table where ml='$ml_name' and file='$file'";
+ }
}
+
1;