DBIx::Simple::SQE - Add subquery emulation to DBIx::Simple
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 );
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.
query
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.
(SELECT ...)
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.
Subquery emulation used to be built into DBIx::Simple itself. It was enabled by using the emulate_subqueries property (or its alias esq).
emulate_subqueries
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.
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.
Juerd Waalboer <juerd@cpan.org> <http://juerd.nl/>
DBIx::Simple
To install DBIx::Simple, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DBIx::Simple
CPAN shell
perl -MCPAN -e shell install DBIx::Simple
For more information on module installation, please visit the detailed CPAN module installation guide.