OmniSciDB  dfae7c3b14
Parser::IntLiteral Class Reference

#include <ParserNode.h>

+ Inheritance diagram for Parser::IntLiteral:
+ Collaboration diagram for Parser::IntLiteral:

Public Member Functions

 IntLiteral (int64_t i)
 
int64_t get_intval () const
 
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 ()
 

Static Public Member Functions

static std::shared_ptr< Analyzer::ExpranalyzeValue (const int64_t intval)
 

Private Attributes

int64_t intval
 

Additional Inherited Members

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

Detailed Description

Definition at line 148 of file ParserNode.h.

Constructor & Destructor Documentation

◆ IntLiteral()

Parser::IntLiteral::IntLiteral ( int64_t  i)
inlineexplicit

Definition at line 150 of file ParserNode.h.

150 : intval(i) {}

Member Function Documentation

◆ analyze()

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

Implements Parser::Literal.

Definition at line 108 of file ParserNode.cpp.

111  {
112  return analyzeValue(intval);
113 }
static std::shared_ptr< Analyzer::Expr > analyzeValue(const int64_t intval)
Definition: ParserNode.cpp:115

◆ analyzeValue()

std::shared_ptr< Analyzer::Expr > Parser::IntLiteral::analyzeValue ( const int64_t  intval)
static

Definition at line 115 of file ParserNode.cpp.

References Datum::bigintval, Datum::intval, kBIGINT, kINT, kSMALLINT, and Datum::smallintval.

Referenced by InValuesBitmap::codegen(), CodeGenerator::codegenDeciDiv(), and RelAlgTranslator::translateLiteral().

115  {
116  SQLTypes t;
117  Datum d;
118  if (intval >= INT16_MIN && intval <= INT16_MAX) {
119  t = kSMALLINT;
120  d.smallintval = (int16_t)intval;
121  } else if (intval >= INT32_MIN && intval <= INT32_MAX) {
122  t = kINT;
123  d.intval = (int32_t)intval;
124  } else {
125  t = kBIGINT;
126  d.bigintval = intval;
127  }
128  return makeExpr<Analyzer::Constant>(t, false, d);
129 }
SQLTypes
Definition: sqltypes.h:40
int32_t intval
Definition: sqltypes.h:137
int64_t bigintval
Definition: sqltypes.h:138
int16_t smallintval
Definition: sqltypes.h:136
Definition: sqltypes.h:47
+ Here is the caller graph for this function:

◆ get_intval()

int64_t Parser::IntLiteral::get_intval ( ) const
inline

Definition at line 151 of file ParserNode.h.

Referenced by Parser::QuerySpec::analyze_group_by(), and Parser::CopyTableStmt::execute().

151 { return intval; }
+ Here is the caller graph for this function:

◆ to_string()

std::string Parser::IntLiteral::to_string ( ) const
inlineoverridevirtual

Implements Parser::Literal.

Definition at line 157 of file ParserNode.h.

157  {
158  return boost::lexical_cast<std::string>(intval);
159  }

Member Data Documentation

◆ intval

int64_t Parser::IntLiteral::intval
private

Definition at line 162 of file ParserNode.h.


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