Acme-BeyondPerl-ToSQL

 view release on metacpan or  search on metacpan

lib/Acme/BeyondPerl/ToSQL.pm  view on Meta::CPAN

	my ($ori, $interp, $contect) = @_;
	return bless \$interp, __PACKAGE__ . "::$Type\::__Float";
}


##############################################################################
# Use From Objects
##############################################################################

sub _calc_by_rdbm {
	if($DEBUG){ print "$_[0]\n"; }
	_float_handler( undef, $Dbh->selectrow_array($_[0]) );
}


sub _nomethod {
	my ($x, $y, $swap, $op) = @_;
	croak "This operator '$op' is not implemented in $Type";
}


lib/Acme/BeyondPerl/ToSQL.pm  view on Meta::CPAN

=head1 NAME

Acme::BeyondPerl::ToSQL - RDBMS calculates instead of Perl

=head1 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

lib/Acme/BeyondPerl/ToSQL/SQLite.pm  view on Meta::CPAN

sub ops { return $OPs; }

##############################################################################
#
##############################################################################

package Acme::BeyondPerl::ToSQL::SQLite::__Integer;

use base qw(Acme::BeyondPerl::ToSQL::SQLite);

sub as_sql { sprintf("%.1f", ${$_[0]}); }

##############################################################################
#
##############################################################################

package Acme::BeyondPerl::ToSQL::SQLite::__Float;

use base qw(Acme::BeyondPerl::ToSQL::SQLite);
use strict;

sub as_sql { sprintf("%.16f", ${$_[0]}); }

##############################################################################
1;
__END__

=pod

=head1 NAME

Acme::BeyondPerl::ToSQL::SQLite - SQLite support for Acme::BeyondPerl::ToSQL



( run in 1.488 second using v1.01-cache-2.11-cpan-de7293f3b23 )