1 #ifndef DBAPI_DRIVER_SAMPLE_BASE_HPP 2 #define DBAPI_DRIVER_SAMPLE_BASE_HPP 3 4 /* $Id: dbapi_driver_sample_base.hpp 103491 2007-05-04 17:18:18Z kazimird $ 5 * =========================================================================== 6 * 7 * PUBLIC DOMAIN NOTICE 8 * National Center for Biotechnology Information 9 * 10 * This software/database is a "United States Government Work" under the 11 * terms of the United States Copyright Act. It was written as part of 12 * the author's official duties as a United States Government employee and 13 * thus cannot be copyrighted. This software/database is freely available 14 * to the public for use. The National Library of Medicine and the U.S. 15 * Government have not placed any restriction on its use or reproduction. 16 * 17 * Although all reasonable efforts have been taken to ensure the accuracy 18 * and reliability of the software and data, the NLM and the U.S. 19 * Government do not and cannot warrant the performance or results that 20 * may be obtained by using this software or data. The NLM and the U.S. 21 * Government disclaim all warranties, express or implied, including 22 * warranties of performance, merchantability or fitness for any particular 23 * purpose. 24 * 25 * Please cite the author in any work or product based on this material. 26 * 27 * =========================================================================== 28 * 29 * Author: Sergey Sikorskiy 30 * 31 * File Description: 32 * 33 */ 34 35 36 #include <corelib/ncbiapp.hpp> 37 38 39 BEGIN_NCBI_SCOPE 40 41 42 ///////////////////////////////////////////////////////////////////////////// 43 // CDbapiSampleApp:: 44 // 45 46 class CDbapiDriverSampleApp : public CNcbiApplication 47 { 48 public: 49 CDbapiDriverSampleApp(const string& server_name, 50 int tds_version = 0); 51 virtual ~CDbapiDriverSampleApp(void); 52 53 protected: 54 virtual int RunSample(void) = 0; 55 56 protected: 57 enum EServerType { 58 eUnknown, //< Server type is not known 59 eSybase, //< Sybase server 60 eMsSql //< Microsoft SQL server 61 }; 62 63 protected: 64 /// Return current server name GetServerName(void) const65 const string& GetServerName(void) const 66 { 67 _ASSERT(!m_ServerName.empty()); 68 return m_ServerName; 69 } 70 /// Return current server type 71 EServerType GetServerType(void) const; 72 /// Return current user name GetUserName(void) const73 const string& GetUserName(void) const 74 { 75 _ASSERT(!m_UserName.empty()); 76 return m_UserName; 77 } 78 /// Return current password GetPassword(void) const79 const string& GetPassword(void) const 80 { 81 _ASSERT(!m_Password.empty()); 82 return m_Password; 83 } 84 /// Return TDS version. GetTDSVersion(void) const85 int GetTDSVersion(void) const 86 { 87 return m_TDSVersion; 88 } 89 90 private: 91 virtual void Init(); 92 virtual int Run(); 93 94 private: 95 const string m_DefaultServerName; 96 const int m_DefaultTDSVersion; 97 98 string m_ServerName; 99 string m_UserName; 100 string m_Password; 101 int m_TDSVersion; 102 }; 103 104 105 END_NCBI_SCOPE 106 107 108 #endif // DBAPI_DRIVER_SAMPLE_BASE_HPP 109