Apache2::Controller::SQL::MySQL - useful database methods for MySQL
Version 1.001.001
package UFP::SFC::Controller::Tools; use base qw( Apache2::Controller Apache2::Controller::SQL::MySQL ); # ...
Provides some useful methods for interacting with a MySQL database.
This isn't really standard or a necessary part of A2C, I just find it handy.
Don't depend on this. I intend to remove it in a future release because it is not relevant.
insert_hash( \%hashref )
Insert data into the database.
# http://sfc.ufp/tools/register_crew/enterprise?captain=kirk&sci=spock&med=mccoy sub register_crew { my ($self, $ship) = @_; my $crew = $self->param(); $self->insert_hash({ table => "crew_$ship", data => $crew, }); $self->print("Warp factor 5, engage.\n"); return Apache2::Const::HTTP_OK; }
Requires a database handle be assigned to $self->{dbh}. See Apache2::Controller::DBI::Connector.
$self->{dbh}
Hashref argument supports these fields:
The SQL table to insert into.
The hash ref of field data to insert.
Optional string of SQL for after 'ON DUPLICATE KEY UPDATE'. Format it yourself.
Array ref of bind values for extra ? characters in on_dup_sql.
?
on_dup_sql
Apache2::Controller::DBI::Connector
Apache2::Controller
Mark Hedges, hedges +(a t)- formdata.biz
hedges +(a t)- formdata.biz
Copyright 2008-2010 Mark Hedges. CPAN: markle
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
This software is provided as-is, with no warranty and no guarantee of fitness for any particular purpose.
To install Apache2::Controller, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Apache2::Controller
CPAN shell
perl -MCPAN -e shell install Apache2::Controller
For more information on module installation, please visit the detailed CPAN module installation guide.