NAME

SQL::OOP::Base - SQL Generator base class

SYNOPSIS

my $sql = SQL::OOP::Base->new('field1 = ?', [1]);

my $sql  = $select->to_string;
my @bind = $select->bind;

DESCRIPTION

This class represents SQLs or SQL snippets.

SQL::OOP::Base->new($str, $array_ref)

Constructor. It takes String and array ref.

my $sql = SQL::OOP::Base->new('a = ? and b = ?', [10,20]);

$str can be a code ref. If so, the code invokes immediately inside constructor.

my $sql = SQL::OOP::Base->new(sub {return 'a = ? and b = ?'}, [10,20]);

SQL::OOP::Base->quote_char($quote_char)

SQL::OOP::Base->escape_code_ref($code_ref)

$instance->to_string()

This method returns the SQL string.

$sql->to_string # 'a = ? and b = ?'

$instance->to_string_embedded() [EXPERIMENTAL]

This method returns the SQL string with binded values embedded. This method aimed at use of debugging.

$sql->to_string_embedded # a = 'value' and b = 'value'

$instance->bind()

This method returns binded values in array.

$sql->bind      # [10,20]

$instance->generate()

SQL::OOP::Base->quote()

SEE ALSO