NAME
DBIx::Roles::SQLAbstract - Exports SQL commands insert
, select
etc as methods.
DESCRIPTION
The role exports SQL commands insert
, select
, update
, delete
after SQL::Abstract fashion. See SQL::Abstract for syntax of these methods.
SYNOPSIS
my
$dbh
= DBI->
connect
(
"dbi:Pg:dbname=template1"
,
"postgres"
,
"password"
,
);
$dbh
->
select
(
$table
, \
@fields
, \
%where
, \
@order
);
$dbh
-> insert(
$table
, \
%fieldvals
|| \
@values
);
$dbh
-> update(
$table
, \
%fieldvals
, \
%where
);
$dbh
->
delete
(
$table
, \
%where
);
API
Mostly all of the text below is copy-pasted from SQL::Abstract (c) 2001-2005 Nathan Wiger
- insert( $table, \%fieldvals || \@values);
-
This is the simplest function. You simply give it a table name and either an arrayref of values or hashref of field/value pairs.
- select ($table, \@fields, \%where, \@order)
-
This takes a table, arrayref of fields (or '*'), optional hashref WHERE clause, and optional arrayref order by.
Prepares and executes a query, and returns the statement handle, if successful.
- update( $table, \%fieldvals, \%where);
-
This takes a table, hashref of field/value pairs, and an optional hashref WHERE clause.
- delete( $table, \%where);
-
This takes a table name and optional hashref WHERE clause.
SEE ALSO
COPYRIGHT
Copyright (c) 2005 catpipe Systems ApS. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
AUTHOR
Dmitry Karasik <dk@catpipe.net>