The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

SQL::Abstract::Plugin::ExtraClausesFixed - Fixes for ExtraClauses

DESCRIPTION

This is a subclass of SQL::Abstract::Plugin::ExtraClauses that fixes a few annoying bugs . Details below !

B <EXPERIMENTAL>

Using with DBIx::Class

In order to use this with DBIx::Class, you simply need to apply the DBIC-SQLA2 plugin, and then your SQLMaker will support these fixes!

Bugs fixed

using in -join

The ExtraClauses plugin has a bug that it double expands the using option for joins, making them unusable unless you explicitly pass in a hashref. This fixes, that allowing you to do natural joins using multiple columns.

setop inner select marshalling

ExtraClauses has a bug where it puts the group_by and having clauses after setops (like UNION and friends). This is incorrect, the inner subquery is meant to have those clauses. This is fixed here.

In order to use this feature, you must pass group_by or having with the bang override syntax ('!group_by' => ['things', 'and', 'stuff']). I may get an idea one day and figure out how to support it even with a bare group_by.

SQLite setop parens

Syntax across different DBMSs is annoying. DBIC likes assuming that you can arbitrarily wrap subqueries in as many parens as you'd like. SQLite considers it a syntax error if the queries that you join with a UNION are parenthesized. This class handles the selective parenthesizing. It will also strip parens if necessary from the output of a $rs->as_query, allowing you to use the setops in the most natural way.