SQL::OOP::Base - SQL Generator base class
my $sql = SQL::OOP::Base->new('field1 = ?', [1]); my $sql = $select->to_string; my @bind = $select->bind;
This class represents SQLs or SQL snippets.
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]);
This method returns the SQL string.
$sql->to_string # 'a = ? and b = ?'
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'
This method returns binded values in array.
$sql->bind # [10,20]
To install SQL::OOP, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SQL::OOP
CPAN shell
perl -MCPAN -e shell install SQL::OOP
For more information on module installation, please visit the detailed CPAN module installation guide.