The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Class::ReluctantORM::SQL::Param - Represent a placeholder in a SQL statement

SYNOPSIS

  use Class::ReluctantORM::SQL::Aliases;

  # Make a placeholder
  my $param = Param->new();

  # Set and read a value to the param
  $param->bind_value('foo');
  $param->bind_value(undef);  # This binds NULL
  my $val =  $param->bind_value();

  # Use the param in a Where criterion ('foo = ?')
  my $crit = Criterion->new('=', Column->new(column => 'foo'), $p);

DESCRIPTION

Represents a placeholder in a SQL statement.

CONSTRUCTOR

$p = Param->new();

$p = Param->new($value);

$p = Param->new(undef);

Makes a new param object.

In the first form, no value is bound.

In the second form, the given value is bound.

In the third form, the NULL value is bound.

ACCESSORS and MUTATORS

$v = $p->bind_value();

$p->bind_value($value);

$p->bind_value(undef);

Reads or sets the value used in Driver parameter binding.

In the first form, the value, if any, is returned. An undefined value is ambiguous; use has_bind_Value to detect a bind value.

In the second form, the bind value is set to the scalar provided.

In the third form, the bind value is set to undef, which means it will be interpreted by the Driver as NULL.

@empty = $p->child_expressions();

Always returns an empty list. Required by the Expression interface.

$bool = $p->has_bind_value()

If true a bind value has been set. Don't rely on bind_value(), as undef is a valid value.

$bool = $arg->is_param();

All objects of this class return true. The class add this method to its parent class, making all other subclasses of return false.

$bool = $p->is_leaf_expression();

Always returns true for this class. Required by the Expression interface.

$str = $param->pretty_print();

Renders a human-readable representation of the Param.

$clone = $p->clone();

Creates a new Param, copying the bound value of the original if it had one.

$bool = $param->is_equivalent($expr);

Returns true if $expr is a Param, with matching has_bind_value() and value.

AUTHOR

Clinton Wolfe