Fey::Role::SQL::HasBindParams - A role for queries which can have bind parameters


Fey documentation Contained in the Fey distribution.

Index


Code Index:

NAME

Top

Fey::Role::SQL::HasBindParams - A role for queries which can have bind parameters

VERSION

Top

version 0.40

SYNOPSIS

Top

  use Moose;

  with 'Fey::Role::SQL::HasBindParams';

DESCRIPTION

Top

Classes which do this role represent a query which can have bind parameters.

METHODS

Top

This role provides the following methods:

$query->bind_params()

Returns the bind params associated with the query.

$query->auto_placeholders()

This attribute determines whether values are automatically turned into placeholders and stored as bind parameters.

BUGS

Top

See Fey for details on how to report bugs.

AUTHOR

Top

Dave Rolsky <autarch@urth.org>

COPYRIGHT AND LICENSE

Top


Fey documentation Contained in the Fey distribution.

package Fey::Role::SQL::HasBindParams;
BEGIN {
  $Fey::Role::SQL::HasBindParams::VERSION = '0.40';
}

use strict;
use warnings;
use namespace::autoclean;

use Fey::Types qw( ArrayRef Bool );

use Moose::Role;

has '_bind_params' => (
    traits   => ['Array'],
    is       => 'ro',
    isa      => ArrayRef,
    default  => sub { [] },
    handles  => { _add_bind_param => 'push' },
    init_arg => undef,
);

has 'auto_placeholders' => (
    is      => 'ro',
    isa     => Bool,
    default => 1,
);

# This needs to be a method and not a delegated method so it can be excluded
# by classes which need to exclude it.
sub bind_params {
    return @{ $_[0]->_bind_params() };
}

1;

# ABSTRACT: A role for queries which can have bind parameters




__END__