00001 #pragma once 00002 00003 #include <boost/shared_ptr.hpp> 00004 00005 namespace AppSecInc 00006 { 00007 namespace Databases 00008 { 00009 namespace ODBC 00010 { 00011 class OdbcParserImpl; 00012 00013 class Command { 00014 public: 00015 Command(const std::wstring& name, bool params, bool insert, bool terminator); 00016 virtual ~Command(); 00017 std::wstring getName() const { return name; } 00018 bool hasParams() const { return params; } 00019 bool isInsert() const { return insert; } 00020 bool isBatchTerminator() const { return batchTerminator; } 00021 virtual void process(const std::wstring& line, OdbcParserImpl& parser); 00022 protected: 00023 std::wstring name; 00024 bool params; 00025 bool insert; 00026 bool batchTerminator; 00027 }; 00028 00029 typedef boost::shared_ptr<Command> CommandPtr; 00030 00031 // class that provides generic insert command processing 00032 class InsertCommand: public Command { 00033 public: 00034 InsertCommand(const std::wstring& name); 00035 virtual void process(const std::wstring& line, OdbcParserImpl& parser); 00036 }; 00037 00038 // class that provides generic processing for 'on error' command 00039 // with the following format: 00040 // <on-error-command> {<exit-param>|<continue-param>} [other params] 00041 // e.g. for sqlcmd: :ON ERROR EXIT, :ON ERROR IGNORE 00042 class OnErrorCommand: public Command { 00043 public: 00044 OnErrorCommand( 00045 const std::wstring& name, 00046 const std::wstring& exitParam, 00047 const std::wstring& continueParam); 00048 virtual void process(const std::wstring& line, OdbcParserImpl& parser); 00049 private: 00050 std::wstring exitParam; 00051 std::wstring continueParam; 00052 }; 00053 } 00054 } 00055 }
© Application Security Inc. - All Rights Reserved | http://msiext.codeplex.com |