OmniSciDB  d2f719934e
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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::Expr
analyzeValue (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 152 of file ParserNode.h.

Constructor & Destructor Documentation

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

Definition at line 154 of file ParserNode.h.

154 : intval_(i) {}

Member Function Documentation

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

136  {
137  return analyzeValue(intval_);
138 }
static std::shared_ptr< Analyzer::Expr > analyzeValue(const int64_t intval)
Definition: ParserNode.cpp:140
std::shared_ptr< Analyzer::Expr > Parser::IntLiteral::analyzeValue ( const int64_t  intval)
static

Definition at line 140 of file ParserNode.cpp.

References Datum::bigintval, INT16_MAX, INT16_MIN, INT32_MAX, INT32_MIN, Datum::intval, kBIGINT, kINT, kSMALLINT, Datum::smallintval, and t.

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

140  {
141  SQLTypes t;
142  Datum d;
143  if (intval >= INT16_MIN && intval <= INT16_MAX) {
144  t = kSMALLINT;
145  d.smallintval = (int16_t)intval;
146  } else if (intval >= INT32_MIN && intval <= INT32_MAX) {
147  t = kINT;
148  d.intval = (int32_t)intval;
149  } else {
150  t = kBIGINT;
151  d.bigintval = intval;
152  }
153  return makeExpr<Analyzer::Constant>(t, false, d);
154 }
#define INT16_MAX
SQLTypes
Definition: sqltypes.h:38
#define INT32_MAX
int32_t intval
Definition: sqltypes.h:214
#define INT32_MIN
int64_t bigintval
Definition: sqltypes.h:215
int16_t smallintval
Definition: sqltypes.h:213
char * t
Definition: sqltypes.h:45
#define INT16_MIN

+ Here is the caller graph for this function:

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

Definition at line 155 of file ParserNode.h.

References intval_.

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

155 { return intval_; }

+ Here is the caller graph for this function:

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

Implements Parser::Literal.

Definition at line 161 of file ParserNode.h.

References intval_.

161  {
162  return boost::lexical_cast<std::string>(intval_);
163  }

Member Data Documentation

int64_t Parser::IntLiteral::intval_
private

Definition at line 166 of file ParserNode.h.

Referenced by get_intval(), and to_string().


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