Wolframe, 0.0.3

databaseLanguage.hpp
Go to the documentation of this file.
1 /************************************************************************
2 
3  Copyright (C) 2011 - 2014 Project Wolframe.
4  All rights reserved.
5 
6  This file is part of Project Wolframe.
7 
8  Commercial Usage
9  Licensees holding valid Project Wolframe Commercial licenses may
10  use this file in accordance with the Project Wolframe
11  Commercial License Agreement provided with the Software or,
12  alternatively, in accordance with the terms contained
13  in a written agreement between the licensee and Project Wolframe.
14 
15  GNU General Public License Usage
16  Alternatively, you can redistribute this file and/or modify it
17  under the terms of the GNU General Public License as published by
18  the Free Software Foundation, either version 3 of the License, or
19  (at your option) any later version.
20 
21  Wolframe is distributed in the hope that it will be useful,
22  but WITHOUT ANY WARRANTY; without even the implied warranty of
23  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24  GNU General Public License for more details.
25 
26  You should have received a copy of the GNU General Public License
27  along with Wolframe. If not, see <http://www.gnu.org/licenses/>.
28 
29  If you have questions regarding the use of this file, please contact
30  Project Wolframe.
31 
32 ************************************************************************/
35 #ifndef _DATABASE_LANGUAGE_HPP_INCLUDED
36 #define _DATABASE_LANGUAGE_HPP_INCLUDED
37 #include "database/transaction.hpp"
38 #include "types/keymap.hpp"
39 #include <string>
40 
41 namespace _Wolframe {
42 namespace db {
43 
47 {
48 public:
51 
53  virtual const char* eoln_commentopr() const=0;
54 
57  virtual std::string stm_argument_reference( int index) const=0;
58 
60  virtual bool isEmbeddedStatement( std::string::const_iterator si, std::string::const_iterator se) const=0;
61 
63  virtual std::string parseEmbeddedStatement( std::string::const_iterator& si, std::string::const_iterator se) const=0;
64 
68  typedef std::pair<std::string,std::string> TemplateArgumentAssignment;
69  virtual std::string substituteTemplateArguments( const std::string& cmd, const std::vector<TemplateArgumentAssignment>& arg) const=0;
70 
73  virtual bool isCaseSensitive() const=0;
74 };
75 
79  :public LanguageDescription
80 {
81 public:
86 
88  virtual const char* eoln_commentopr() const
89  {
90  return "--";
91  }
92 
94  virtual std::string stm_argument_reference( int index) const;
95 
97  virtual bool isEmbeddedStatement( std::string::const_iterator si, std::string::const_iterator se) const;
98 
100  virtual std::string parseEmbeddedStatement( std::string::const_iterator& si, std::string::const_iterator se) const;
101 
103  typedef std::pair<std::string,std::string> TemplateArgumentAssignment;
104  virtual std::string substituteTemplateArguments( const std::string& cmd, const std::vector<TemplateArgumentAssignment>& arg) const;
105 
107  virtual bool isCaseSensitive() const
108  {
109  return false;
110  }
111 };
112 
113 }} // namespace _Wolframe::db
114 
115 #endif
116 
virtual std::string parseEmbeddedStatement(std::string::const_iterator &si, std::string::const_iterator se) const
Implement LanguageDescription::parseEmbeddedStatement( std::string::const_iterator& si...
virtual const char * eoln_commentopr() const =0
Operator marking the start of an end of line comment.
virtual const char * eoln_commentopr() const
Implement LanguageDescription::eoln_commentopr() const.
Definition: databaseLanguage.hpp:88
virtual std::string stm_argument_reference(int index) const
Implement LanguageDescription::stm_argument_reference( int index) const;.
LanguageDescriptionSQL()
Default constructor.
Definition: databaseLanguage.hpp:83
std::pair< std::string, std::string > TemplateArgumentAssignment
Implement LanguageDescription::substituteTemplateArguments( const std::string&,const std::vector
Definition: databaseLanguage.hpp:103
virtual std::string stm_argument_reference(int index) const =0
String used for declaring a reference to an argument by index (starting with 1). Default is the SQL s...
Interface of a database transaction.
virtual ~LanguageDescriptionSQL()
Destructor.
Definition: databaseLanguage.hpp:85
virtual std::string substituteTemplateArguments(const std::string &cmd, const std::vector< TemplateArgumentAssignment > &arg) const =0
template for map with case insensitive key strings
virtual ~LanguageDescription()
Destructor.
Definition: databaseLanguage.hpp:50
Definition: databaseLanguage.hpp:78
virtual bool isEmbeddedStatement(std::string::const_iterator si, std::string::const_iterator se) const =0
Evaluate if the start of the block specified as argument is forming an embedded statement in the data...
Interface to properties of the database language used.
Definition: databaseLanguage.hpp:46
virtual bool isCaseSensitive() const =0
Define if a database is case-insensitive. This has influence on TDL parsing Default is according SQL ...
std::pair< std::string, std::string > TemplateArgumentAssignment
Substitute all template arguments in the specified embedded database statement.
Definition: databaseLanguage.hpp:68
virtual std::string parseEmbeddedStatement(std::string::const_iterator &si, std::string::const_iterator se) const =0
Parse an embedded statement in the database language.
virtual bool isEmbeddedStatement(std::string::const_iterator si, std::string::const_iterator se) const
Implement LanguageDescription::isEmbeddedStatement( std::string::const_iterator, std::string::const_i...
virtual std::string substituteTemplateArguments(const std::string &cmd, const std::vector< TemplateArgumentAssignment > &arg) const
virtual bool isCaseSensitive() const
Implement LanguageDescription::isCaseSensitive()
Definition: databaseLanguage.hpp:107