.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "SQL::Abstract::Plugin::BangOverrides 3pm" .TH SQL::Abstract::Plugin::BangOverrides 3pm "2021-09-30" "perl v5.32.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" SQL::Abstract::Plugin::BangOverrides .SS "\s-1SYNOPSIS\s0" .IX Subsection "SYNOPSIS" .Vb 3 \& $sqla\->plugin(\*(Aq+BangOverrides\*(Aq); \& ... \& profit(); .Ve .SH "METHODS" .IX Header "METHODS" .SS "register_extensions" .IX Subsection "register_extensions" Wraps all currently existing clause based statements such that when a clause of '!name' is encountered, if its value is a coderef, it's called with the original value of the 'name' clause and expected to return a replacement, and if not, it's simply used as a direct replacement. .PP This allows for passing data through existing systems that attempt to have their own handling for thing but whose capabilities are now superceded by SQL::Abstract, and is primarily useful to provide access to experimental feature bundles such as SQL::Abstract::Plugin::ExtraClauses. .PP As an example of such a thing, given an appropriate \s-1DBIC\s0 setup (see \f(CW\*(C`examples/bangdbic.pl\*(C'\fR): .PP .Vb 1 \& $s\->storage\->sqlmaker\->plugin(\*(Aq+ExtraClauses\*(Aq)\->plugin(\*(Aq+BangOverrides\*(Aq); \& \& my $rs2 = $s\->resultset(\*(AqFoo\*(Aq)\->search({ \& \-op => [ \*(Aq=\*(Aq, { \-ident => \*(Aqouter.y\*(Aq }, { \-ident => \*(Aqme.x\*(Aq } ] \& }); \& # (SELECT me.x, me.y, me.z FROM foo me WHERE ( outer.y = me.x )) \& \& my $rs3 = $rs2\->search({}, { \& \*(Aq!from\*(Aq => sub { my ($sqla, $from) = @_; \& my $base = $sqla\->expand_expr({ \-old_from => $from }); \& return [ $base, \-join => [ \*(Aqwub\*(Aq, on => [ \*(Aqme.z\*(Aq => \*(Aqwub.z\*(Aq ] ] ]; \& } \& }); \& # (SELECT me.x, me.y, me.z FROM foo me JOIN wub ON me.z = wub.z WHERE ( outer.y = me.x )) \& \& my $rs4 = $rs3\->search({}, { \& \*(Aq!with\*(Aq => [ [ qw(wub x y z) ], $s\->resultset(\*(AqBar\*(Aq)\->as_query ], \& }); \& # (WITH wub(x, y, z) AS (SELECT me.a, me.b, me.c FROM bar me) SELECT me.x, me.y, me.z FROM foo me JOIN wub ON me.z = wub.z WHERE ( outer.y = me.x )) \& \& my $rs5 = $rs\->search({}, { select => [ { \-coalesce => [ { \-ident => \*(Aqx\*(Aq }, { \-value => 7 } ] } ] }); \& # (SELECT \-COALESCE( \-IDENT( x ), \-VALUE( 7 ) ) FROM foo me WHERE ( z = ? )) \& \& my $rs6 = $rs\->search({}, { \*(Aq!select\*(Aq => [ { \-coalesce => [ { \-ident => \*(Aqx\*(Aq }, { \-value => 7 } ] } ] }); \& # (SELECT COALESCE(x, ?) FROM foo me WHERE ( z = ? )) .Ve