NAME
DBIx::Simple::SQE - Add subquery emulation to DBIx::Simple
SYNOPSIS
my $db = DBIx::Simple::SQE->connect(...);
my $result = $db->query(
q[
SELECT project_name
FROM projects
WHERE user_id IN (
SELECT id
FROM users
WHERE email = ?
)
AND status = ?
],
$email, $status
);
Is simply a more compact way of doing:
my $db = DBIx::Simple::SQE->connect(...);
my $result = $db->query(
sprintf(
q[
SELECT project_name
FROM projects
WHERE user_id IN (%s)
AND status = ?
],
join(
',',
map(
$db->dbh->quote($_),
$db->query(
q[
SELECT id
FROM users
WHERE email = ?
],
$email
)->flat
)
)
),
$status
);
DESCRIPTION
This module is not actively maintained. In practice that means that if you find a bug, you'll have to fix it yourself or live with it. (Patches are welcome, though). If DBIx::Simple changes in a way that is incompatible with this module, SQE will simply stop functioning correctly. Should you want to take over maintenance of this module, let me know.
This module extends DBIx::Simple by making query
emulate nested subqueries (SELECT only) by executing them and interpolating the results.
This module should not be used if the database provides real subqueries. It is better to use a database engine that has real subqueries than to use this module.
Only subqueries like (SELECT ...)
(note the parentheses) are interpolated.
Please note that emulation is done by doing multiple queries and is not atomic, as it would be if the database supported real subqueries. The queries are executed independently.
HISTORY
Subquery emulation used to be built into DBIx::Simple itself. It was enabled by using the emulate_subqueries
property (or its alias esq
).
Starting from version 1.20, the feature was deprecated. In version 1.23, it was finally removed. To give users some more time, it was moved to a separate module.
LICENSE
There is no license. This software was released into the public domain. Do with it what you want, but on your own risk. The author disclaims any responsibility.
AUTHOR
Juerd Waalboer <juerd@cpan.org> <http://juerd.nl/>