Command.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <boost/shared_ptr.hpp>
4 
5 namespace AppSecInc
6 {
7  namespace Databases
8  {
9  namespace ODBC
10  {
11  class OdbcParserImpl;
12 
13  class Command {
14  public:
15  Command(const std::wstring& name, bool params, bool insert, bool terminator);
16  virtual ~Command();
17  std::wstring getName() const { return name; }
18  bool hasParams() const { return params; }
19  bool isInsert() const { return insert; }
20  bool isBatchTerminator() const { return batchTerminator; }
21  virtual void process(const std::wstring& line, OdbcParserImpl& parser);
22  protected:
23  std::wstring name;
24  bool params;
25  bool insert;
27  };
28 
29  typedef boost::shared_ptr<Command> CommandPtr;
30 
31  // class that provides generic insert command processing
32  class InsertCommand: public Command {
33  public:
34  InsertCommand(const std::wstring& name);
35  virtual void process(const std::wstring& line, OdbcParserImpl& parser);
36  };
37 
38  // class that provides generic processing for 'on error' command
39  // with the following format:
40  // <on-error-command> {<exit-param>|<continue-param>} [other params]
41  // e.g. for sqlcmd: :ON ERROR EXIT, :ON ERROR IGNORE
42  class OnErrorCommand: public Command {
43  public:
45  const std::wstring& name,
46  const std::wstring& exitParam,
47  const std::wstring& continueParam);
48  virtual void process(const std::wstring& line, OdbcParserImpl& parser);
49  private:
50  std::wstring exitParam;
51  std::wstring continueParam;
52  };
53  }
54  }
55 }
boost::shared_ptr< Command > CommandPtr
Definition: Command.h:29
virtual ~Command()
Definition: Command.cpp:16
bool hasParams() const
Definition: Command.h:18
Command(const std::wstring &name, bool params, bool insert, bool terminator)
Definition: Command.cpp:7
bool batchTerminator
Definition: Command.h:26
bool insert
Definition: Command.h:25
virtual void process(const std::wstring &line, OdbcParserImpl &parser)
Definition: Command.cpp:31
bool params
Definition: Command.h:24
OnErrorCommand(const std::wstring &name, const std::wstring &exitParam, const std::wstring &continueParam)
Definition: Command.cpp:38
Definition: OdbcParserImpl.h:13
Definition: Command.h:13
std::wstring name
Definition: Command.h:23
std::wstring getName() const
Definition: Command.h:17
InsertCommand(const std::wstring &name)
Definition: Command.cpp:25
bool isInsert() const
Definition: Command.h:19
virtual void process(const std::wstring &line, OdbcParserImpl &parser)
Definition: Command.cpp:20
bool isBatchTerminator() const
Definition: Command.h:20
virtual void process(const std::wstring &line, OdbcParserImpl &parser)
Definition: Command.cpp:49


© Application Security Inc. - All Rights Reserved http://msiext.codeplex.com