OmniSciDB  ba1bac9284
 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 641 of file ParserNode.h.

Constructor & Destructor Documentation

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

Definition at line 643 of file ParserNode.h.

643 : arg(a), target_type(t) {}
std::unique_ptr< SQLType > target_type
Definition: ParserNode.h:654
std::unique_ptr< Expr > arg
Definition: ParserNode.h:653
char * t

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 875 of file ParserNode.cpp.

References kENCODING_NONE.

878  {
879  target_type->check_type();
880  auto arg_expr = arg->analyze(catalog, query, allow_tlist_ref);
881  SQLTypeInfo ti(target_type->get_type(),
882  target_type->get_param1(),
883  target_type->get_param2(),
884  arg_expr->get_type_info().get_notnull());
885  if (arg_expr->get_type_info().get_type() != target_type->get_type() &&
886  arg_expr->get_type_info().get_compression() != kENCODING_NONE) {
887  arg_expr->decompress();
888  }
889  return arg_expr->add_cast(ti);
890 }
std::unique_ptr< SQLType > target_type
Definition: ParserNode.h:654
std::unique_ptr< Expr > arg
Definition: ParserNode.h:653
std::string Parser::CastExpr::to_string ( ) const
inlineoverridevirtual

Implements Parser::Expr.

Definition at line 648 of file ParserNode.h.

References arg, and target_type.

648  {
649  return "CAST(" + arg->to_string() + " AS " + target_type->to_string() + ")";
650  }
std::unique_ptr< SQLType > target_type
Definition: ParserNode.h:654
std::unique_ptr< Expr > arg
Definition: ParserNode.h:653

Member Data Documentation

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

Definition at line 653 of file ParserNode.h.

Referenced by to_string().

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

Definition at line 654 of file ParserNode.h.

Referenced by to_string().


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