OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Parser::StringLiteral Class Reference

#include <ParserNode.h>

+ Inheritance diagram for Parser::StringLiteral:
+ Collaboration diagram for Parser::StringLiteral:

Public Member Functions

 StringLiteral (std::string *s)
 
const std::string * get_stringval () 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 std::string &stringval, const bool is_null)
 

Private Attributes

std::unique_ptr< std::string > stringval_
 

Additional Inherited Members

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

Detailed Description

Definition at line 133 of file ParserNode.h.

Constructor & Destructor Documentation

Parser::StringLiteral::StringLiteral ( std::string *  s)
inlineexplicit

Definition at line 135 of file ParserNode.h.

135 : stringval_(s) {}
std::unique_ptr< std::string > stringval_
Definition: ParserNode.h:146

Member Function Documentation

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

Implements Parser::Literal.

Definition at line 140 of file ParserNode.cpp.

143  {
144  return analyzeValue(*stringval_, false);
145 }
std::unique_ptr< std::string > stringval_
Definition: ParserNode.h:146
static std::shared_ptr< Analyzer::Expr > analyzeValue(const std::string &stringval, const bool is_null)
Definition: ParserNode.cpp:147
std::shared_ptr< Analyzer::Expr > Parser::StringLiteral::analyzeValue ( const std::string &  stringval,
const bool  is_null 
)
static

Definition at line 147 of file ParserNode.cpp.

References kVARCHAR, and Datum::stringval.

Referenced by RelAlgTranslator::translateLiteral(), and anonymous_namespace{ExpressionRewrite.cpp}::ConstantFoldingVisitor::visitStringOper().

148  {
149  if (!is_null) {
150  const SQLTypeInfo ti(kVARCHAR, stringval.length(), 0, true);
151  Datum d;
152  d.stringval = new std::string(stringval);
153  return makeExpr<Analyzer::Constant>(ti, false, d);
154  }
155  // Null value
156  return makeExpr<Analyzer::Constant>(kVARCHAR, true);
157 }
CONSTEXPR DEVICE bool is_null(const T &value)
std::string * stringval
Definition: Datum.h:81
Definition: Datum.h:71

+ Here is the caller graph for this function:

const std::string* Parser::StringLiteral::get_stringval ( ) const
inline

Definition at line 136 of file ParserNode.h.

References stringval_.

Referenced by Parser::anonymous_namespace{ParserNode.cpp}::bool_from_string_literal(), Parser::CreateTableAsSelectStmt::execute(), Parser::anonymous_namespace{ParserNode.cpp}::parse_copy_params(), Parser::CreateModelStmt::parse_model_options(), Parser::ExportQueryStmt::parseOptions(), and Parser::set_column_descriptor().

136 { return stringval_.get(); }
std::unique_ptr< std::string > stringval_
Definition: ParserNode.h:146

+ Here is the caller graph for this function:

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

Implements Parser::Literal.

Definition at line 143 of file ParserNode.h.

References stringval_.

143 { return "'" + *stringval_ + "'"; }
std::unique_ptr< std::string > stringval_
Definition: ParserNode.h:146

Member Data Documentation

std::unique_ptr<std::string> Parser::StringLiteral::stringval_
private

Definition at line 146 of file ParserNode.h.

Referenced by get_stringval(), and to_string().


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