-
-
14 Oct 2011 05:36:12 UTC
- Distribution: SQL-Object
- Module version: 0.01
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Repository
- Issues (2)
- Testers (689 / 2 / 0)
- Kwalitee
Bus factor: 0- 80.92% Coverage
- License: perl_5
- Activity
24 month- Tools
- Download (20.75KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 1 contributors- Atsushi Kobayashi <nekokak _at_ gmail _dot_ com>
- Dependencies
- unknown
- Reverse dependencies
- CPAN Testers List
- Dependency graph
- NAME
- SYNOPSIS
- DESCRIPTION
- METHODS
- my $sql = sql($stmt, $bind)
- my $sql_type = sql_type(\$val, SQL_VARCHAR)
- my $sql = SQL::Object->new(sql => $sql, bind => \@bind);
- $sql = $sql->and($sql, @bind)
- $sql = $sql->or($sql, @bind)
- $sql = $sql->compose_and(sql($sql, $bind))
- $sql = $sql->compose_or(sql($sql, $bind))
- $sql->add_parens()
- $sql->as_sql()
- $sql->bind()
- SQL::Object::Type
- AUTHOR
- SEE ALSO
- LICENSE
NAME
SQL::Object - Yet another SQL condition builder
SYNOPSIS
use SQL::Object qw/sql_obj/; my $sql = sql_obj('foo.id=?',1); $sql->as_sql; # 'foo.id=?' $sql->bind; # qw/1/ $sql->and('foo.name=?','nekokak'); $sql->as_sql; # 'foo.id=? AND foo.name=?' $sql->bind; # qw/1 nekokak/ $sql->as_sql; # 'foo.id=? AND foo.name=?' my $other_cond = sql_obj('foo.id=?', 2); $other_cond->and('foo.name=?','tokuhirom'); $other_cond->as_sql; # 'foo.id=? AND foo.name=?' $sql = $sql | $other_cond; # $sql->compose_or($other_cond) $sql->as_sql; # ('foo.id=? AND foo.name=?') OR ('foo.id=? AND foo.name=?') $sql->bind; # qw/1 nekokak 2 tokuhirom/ $sql->add_parens; $sql = $sql & sql('baz.name=?','lestrrat'); # $sql->compose_and(sql('baz.name=?','lestrrat')) $sql->as_sql; # ((('foo.id=? AND foo.name=?') OR ('foo.id=? AND foo.name=?')) OR (foo.id IN (?,?))) AND baz.name=? $sql = sql_obj('SELECT * FROM user WHERE ') + $sql; $sql->as_sql; # SELECT * FROM user WHERE ((('foo.id=? AND foo.name=?') OR ('foo.id=? AND foo.name=?')) OR (foo.id IN (?,?))) AND baz.name=?
DESCRIPTION
SQL::Object is raw level SQL maker
METHODS
my $sql = sql($stmt, $bind)
create SQL::Object's instance.
my $sql_type = sql_type(\$val, SQL_VARCHAR)
create SQL::Object::Type's instance
my $sql = SQL::Object->new(sql => $sql, bind => \@bind);
create SQL::Object's instance
$sql = $sql->and($sql, @bind)
compose sql. operation 'ADN'.
$sql = $sql->or($sql, @bind)
compose sql. operation 'OR'.
$sql = $sql->compose_and(sql($sql, $bind))
compose sql object. operation 'AND'.
$sql = $sql->compose_or(sql($sql, $bind))
compose sql object. operation 'OR'.
$sql->add_parens()
bracket off current SQL.
$sql->as_sql()
get sql statement.
$sql->bind()
get sql bind variables.
SQL::Object::Type
SQL::Object:Type is SQL Types wrapper.
my $val = $sql_type->value()
return setting dereferenced value.
my $val_ref = $sql_type->value_ref()
return setting value reference.
my $sql_type = $sql_type->type()
return setting SQLType.
AUTHOR
Atsushi Kobayashi <nekokak _at_ gmail _dot_ com>
SEE ALSO
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Module Install Instructions
To install SQL::Object, copy and paste the appropriate command in to your terminal.
cpanm SQL::Object
perl -MCPAN -e shell install SQL::Object
For more information on module installation, please visit the detailed CPAN module installation guide.