OmniSciDB  b24e664e58
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Parser::CastExpr Class Reference

#include <ParserNode.h>

+ Inheritance diagram for Parser::CastExpr:
+ Collaboration diagram for Parser::CastExpr:

Public Member Functions

 CastExpr (Expr *a, SQLType *t)
 
std::shared_ptr< Analyzer::Expranalyze (const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query, TlistRefType allow_tlist_ref=TLIST_NONE) const override
 
std::string to_string () const override
 
- Public Member Functions inherited from Parser::Node
virtual ~Node ()
 

Private Attributes

std::unique_ptr< Exprarg
 
std::unique_ptr< SQLTypetarget_type
 

Additional Inherited Members

- Public Types inherited from Parser::Expr
enum  TlistRefType { TLIST_NONE, TLIST_REF, TLIST_COPY }
 

Detailed Description

Definition at line 653 of file ParserNode.h.

Constructor & Destructor Documentation

Parser::CastExpr::CastExpr ( Expr a,
SQLType t 
)
inline

Definition at line 655 of file ParserNode.h.

655 : arg(a), target_type(t) {}
std::unique_ptr< SQLType > target_type
Definition: ParserNode.h:666
std::unique_ptr< Expr > arg
Definition: ParserNode.h:665

Member Function Documentation

std::shared_ptr< Analyzer::Expr > Parser::CastExpr::analyze ( const Catalog_Namespace::Catalog catalog,
Analyzer::Query query,
TlistRefType  allow_tlist_ref = TLIST_NONE 
) const
overridevirtual

Implements Parser::Expr.

Definition at line 846 of file ParserNode.cpp.

References kENCODING_NONE.

849  {
850  target_type->check_type();
851  auto arg_expr = arg->analyze(catalog, query, allow_tlist_ref);
852  SQLTypeInfo ti(target_type->get_type(),
853  target_type->get_param1(),
854  target_type->get_param2(),
855  arg_expr->get_type_info().get_notnull());
856  if (arg_expr->get_type_info().get_type() != target_type->get_type() &&
857  arg_expr->get_type_info().get_compression() != kENCODING_NONE) {
858  arg_expr->decompress();
859  }
860  return arg_expr->add_cast(ti);
861 }
std::unique_ptr< SQLType > target_type
Definition: ParserNode.h:666
std::unique_ptr< Expr > arg
Definition: ParserNode.h:665
std::string Parser::CastExpr::to_string ( ) const
inlineoverridevirtual

Implements Parser::Expr.

Definition at line 660 of file ParserNode.h.

References arg, and target_type.

660  {
661  return "CAST(" + arg->to_string() + " AS " + target_type->to_string() + ")";
662  }
std::unique_ptr< SQLType > target_type
Definition: ParserNode.h:666
std::unique_ptr< Expr > arg
Definition: ParserNode.h:665

Member Data Documentation

std::unique_ptr<Expr> Parser::CastExpr::arg
private

Definition at line 665 of file ParserNode.h.

Referenced by to_string().

std::unique_ptr<SQLType> Parser::CastExpr::target_type
private

Definition at line 666 of file ParserNode.h.

Referenced by to_string().


The documentation for this class was generated from the following files: