#include <sqlpp/expressions/mathematical_function_expression.hpp>
namespace sqlpp{
namespace expressions{
unary_mathematical_function_expression::unary_mathematical_function_expression(
numeric_expression_shared_ptr expression_,
UnaryMathematicalFunction fcn_
)
: m_expression(expression_), m_fcn(fcn_){};
std::ostream& unary_mathematical_function_expression::get_expression(std::ostream& out_
, adaptors::database_adaptor_shared_ptr adaptor_) const
{
out_<<m_fcn<<"( ";
if (m_expression)
m_expression->get_expression(out_, adaptor_);
return out_<<")";
};
unary_mathematical_function_expression_shared_ptr abs(
numeric_expression_shared_ptr expression_
)
{
if (!expression_)
throw exceptions::sqlpp_exception("math function: expression is null");
return unary_mathematical_function_expression_shared_ptr(
new unary_mathematical_function_expression(
expression_,
UnaryMathematicalFunctionAbs
)
);
};
unary_mathematical_function_expression_shared_ptr degrees(
numeric_expression_shared_ptr expression_
)
{
if (!expression_)
throw exceptions::sqlpp_exception("math function: expression is null");
return unary_mathematical_function_expression_shared_ptr(
new unary_mathematical_function_expression(
expression_,
UnaryMathematicalFunctionDegrees
)
);
};
unary_mathematical_function_expression_shared_ptr rand(
numeric_expression_shared_ptr expression_
)
{
if (!expression_)
throw exceptions::sqlpp_exception("math function: expression is null");
return unary_mathematical_function_expression_shared_ptr(
new unary_mathematical_function_expression(
expression_,
UnaryMathematicalFunctionRand
)
);
};
unary_mathematical_function_expression_shared_ptr acos(
numeric_expression_shared_ptr expression_
)
{
if (!expression_)
throw exceptions::sqlpp_exception("math function: expression is null");
return unary_mathematical_function_expression_shared_ptr(
new unary_mathematical_function_expression(
expression_,
UnaryMathematicalFunctionAcos
)
);
};
unary_mathematical_function_expression_shared_ptr exp(
numeric_expression_shared_ptr expression_
)
{
if (!expression_)
throw exceptions::sqlpp_exception("math function: expression is null");
return unary_mathematical_function_expression_shared_ptr(
new unary_mathematical_function_expression(
expression_,
UnaryMathematicalFunctionExp
)
);
};
unary_mathematical_function_expression_shared_ptr round(
numeric_expression_shared_ptr expression_
)
{
if (!expression_)
throw exceptions::sqlpp_exception("math function: expression is null");
return unary_mathematical_function_expression_shared_ptr(
new unary_mathematical_function_expression(
expression_,
UnaryMathematicalFunctionRound
)
);
};
unary_mathematical_function_expression_shared_ptr asin(
numeric_expression_shared_ptr expression_
)
{
if (!expression_)
throw exceptions::sqlpp_exception("math function: expression is null");
return unary_mathematical_function_expression_shared_ptr(
new unary_mathematical_function_expression(
expression_,
UnaryMathematicalFunctionAsin
)
);
};
unary_mathematical_function_expression_shared_ptr floor(
numeric_expression_shared_ptr expression_
)
{
if (!expression_)
throw exceptions::sqlpp_exception("math function: expression is null");
return unary_mathematical_function_expression_shared_ptr(
new unary_mathematical_function_expression(
expression_,
UnaryMathematicalFunctionFloor
)
);
};
unary_mathematical_function_expression_shared_ptr sign(
numeric_expression_shared_ptr expression_
)
{
if (!expression_)
throw exceptions::sqlpp_exception("math function: expression is null");
return unary_mathematical_function_expression_shared_ptr(
new unary_mathematical_function_expression(
expression_,
UnaryMathematicalFunctionSign
)
);
};
unary_mathematical_function_expression_shared_ptr atan(
numeric_expression_shared_ptr expression_
)
{
if (!expression_)
throw exceptions::sqlpp_exception("math function: expression is null");
return unary_mathematical_function_expression_shared_ptr(
new unary_mathematical_function_expression(
expression_,
UnaryMathematicalFunctionAtan
)
);
};
unary_mathematical_function_expression_shared_ptr log(
numeric_expression_shared_ptr expression_
)
{
if (!expression_)
throw exceptions::sqlpp_exception("math function: expression is null");
return unary_mathematical_function_expression_shared_ptr(
new unary_mathematical_function_expression(
expression_,
UnaryMathematicalFunctionLog
)
);
};
unary_mathematical_function_expression_shared_ptr sin(
numeric_expression_shared_ptr expression_
)
{
if (!expression_)
throw exceptions::sqlpp_exception("math function: expression is null");
return unary_mathematical_function_expression_shared_ptr(
new unary_mathematical_function_expression(
expression_,
UnaryMathematicalFunctionSin
)
);
};
unary_mathematical_function_expression_shared_ptr log10(
numeric_expression_shared_ptr expression_
)
{
if (!expression_)
throw exceptions::sqlpp_exception("math function: expression is null");
return unary_mathematical_function_expression_shared_ptr(
new unary_mathematical_function_expression(
expression_,
UnaryMathematicalFunctionLog10
)
);
};
unary_mathematical_function_expression_shared_ptr square(
numeric_expression_shared_ptr expression_
)
{
if (!expression_)
throw exceptions::sqlpp_exception("math function: expression is null");
return unary_mathematical_function_expression_shared_ptr(
new unary_mathematical_function_expression(
expression_,
UnaryMathematicalFunctionSquare
)
);
};
unary_mathematical_function_expression_shared_ptr ceiling(
numeric_expression_shared_ptr expression_
)
{
if (!expression_)
throw exceptions::sqlpp_exception("math function: expression is null");
return unary_mathematical_function_expression_shared_ptr(
new unary_mathematical_function_expression(
expression_,
UnaryMathematicalFunctionCeiling
)
);
};
unary_mathematical_function_expression_shared_ptr pi()
{
return unary_mathematical_function_expression_shared_ptr(
new unary_mathematical_function_expression(
numeric_expression_shared_ptr(),
UnaryMathematicalFunctionPi
)
);
};
unary_mathematical_function_expression_shared_ptr sqrt(
numeric_expression_shared_ptr expression_
)
{
if (!expression_)
throw exceptions::sqlpp_exception("math function: expression is null");
return unary_mathematical_function_expression_shared_ptr(
new unary_mathematical_function_expression(
expression_,
UnaryMathematicalFunctionSqrt
)
);
};
unary_mathematical_function_expression_shared_ptr cos(
numeric_expression_shared_ptr expression_
)
{
if (!expression_)
throw exceptions::sqlpp_exception("math function: expression is null");
return unary_mathematical_function_expression_shared_ptr(
new unary_mathematical_function_expression(
expression_,
UnaryMathematicalFunctionCos
)
);
};
unary_mathematical_function_expression_shared_ptr tan(
numeric_expression_shared_ptr expression_
)
{
if (!expression_)
throw exceptions::sqlpp_exception("math function: expression is null");
return unary_mathematical_function_expression_shared_ptr(
new unary_mathematical_function_expression(
expression_,
UnaryMathematicalFunctionTan
)
);
};
unary_mathematical_function_expression_shared_ptr cot(
numeric_expression_shared_ptr expression_
)
{
if (!expression_)
throw exceptions::sqlpp_exception("math function: expression is null");
return unary_mathematical_function_expression_shared_ptr(
new unary_mathematical_function_expression(
expression_,
UnaryMathematicalFunctionCot
)
);
};
unary_mathematical_function_expression_shared_ptr radians(
numeric_expression_shared_ptr expression_
)
{
if (!expression_)
throw exceptions::sqlpp_exception("math function: expression is null");
return unary_mathematical_function_expression_shared_ptr(
new unary_mathematical_function_expression(
expression_,
UnaryMathematicalFunctionRadians
)
);
};
binary_mathematical_function_expression::binary_mathematical_function_expression(
numeric_expression_shared_ptr first_,
numeric_expression_shared_ptr second_,
BinaryMathematicalFunction fcn_
)
:m_first(first_), m_second(second_),m_fcn(fcn_){};
std::ostream& binary_mathematical_function_expression::get_expression(std::ostream& out_
, adaptors::database_adaptor_shared_ptr adaptor_) const
{
if (!m_first)
throw exceptions::sqlpp_exception("math function: expression is null");
if (!m_second)
throw exceptions::sqlpp_exception("math function: expression is null");
out_<<m_fcn<<"( ";
m_first->get_expression(out_, adaptor_);
out_<<" , ";
m_second->get_expression(out_, adaptor_);
out_<<" )";
return out_;
}
binary_mathematical_function_expression_shared_ptr power(
numeric_expression_shared_ptr first_,
numeric_expression_shared_ptr second_
)
{
if (!first_)
throw exceptions::sqlpp_exception("math function: expression is null");
if (!second_)
throw exceptions::sqlpp_exception("math function: expression is null");
return binary_mathematical_function_expression_shared_ptr(
new binary_mathematical_function_expression(
first_,
second_,
BinaryMathematicalFunctionPower
)
);
};
binary_mathematical_function_expression_shared_ptr atn2(
numeric_expression_shared_ptr first_,
numeric_expression_shared_ptr second_
)
{
if (!first_)
throw exceptions::sqlpp_exception("math function: expression is null");
if (!second_)
throw exceptions::sqlpp_exception("math function: expression is null");
return binary_mathematical_function_expression_shared_ptr(
new binary_mathematical_function_expression(
first_,
second_,
BinaryMathematicalFunctionAtn2
)
);
};
}; // expressions
};//sqlpp