Sugama Keita > SQL-OOP-0.20 > SQL::OOP::Base

Download:
SQL-OOP-0.20.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Source   Latest Release: SQL-OOP-0.21

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 ^

AUTHOR ^

Sugama Keita, <sugama@jamadam.com>

COPYRIGHT AND LICENSE ^

Copyright (C) 2011 by Sugama Keita.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: