NAME
Acme::BeyondPerl::ToSQL - RDBMS calculates instead of Perl
SYNOPSIS
use Acme::BeyondPerl::ToSQL ("dbi:SQLite:dbname=acme_db","","");
my $value = 5;
print 2 + $value , "\n"; # 7
print 1.2 - 0.2 , "\n"; # 1
print 9 / 2 , "\n"; # 4.5
# DEBUG MODE
# use Acme::BeyondPerl::ToSQL ({
# dbi => ["dbi:SQLite:dbname=acme_db","",""], debug => 1,
# });
#
# SELECT 1.2000000000000000 - 0.2000000000000000
# SELECT 9.0 / 2.0
# SELECT 2.0 + 5.0
# use Acme::BeyondPerl::ToSQL ({
# dbi => ["dbi:Pg:dbname=$dbname;host=$host", $user, $pass], debug => 1,
# });
#
# SELECT CAST(1.2 AS double precision) - CAST(0.2 AS double precision)
# SELECT CAST(9 AS double precision) / CAST(2 AS double precision)
# SELECT CAST(2 AS double precision) + CAST(5 AS double precision)
DESCRIPTION
When you use Acme::BeyondPerl::ToSQL
, your RDBMS will calculate instead of Perl!
Currently supported RDBMS are SQLite, PostgreSQL and MySQL.
HOW TO USE
- Acme::BeyondPerl::ToSQL ($dsn, $user, $pass, $opts)
-
To use DBI, you must pass some arguments.
use Acme::BeyondPerl::ToSQL ("dbi:SQLite:dbname=acme_db","",""); use Acme::BeyondPerl::ToSQL ("dbi:Pg:dbname=$dbname;host=$host", $user, $pass, \%opts);
- Acme::BeyondPerl::ToSQL ({dbi => $arrayref, debug => $true_or_false})
-
use Acme::BeyondPerl::ToSQL ({ dbi => ["dbi:SQLite:dbname=acme_db","",""], debug => 1, });
EXPORT
None.
BUGS
All the effects of this module are constrained to overload
and overload::constant
.
There might be an operator not supported.
When this module is used at the same time with two or more files on Windows 2000 + ActivePerl, I find a warning "Attempt to free unreferenced scalar".
SEE ALSO
AUTHOR
Makamaka Hannyaharamitu, <makamaka[at]cpan.org>
COPYRIGHT AND LICENSE
Copyright 2005 by Makamaka Hannyaharamitu
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.