MSSQLConnectionInfo.h
Go to the documentation of this file.
1 #pragma once
2 
3 namespace AppSecInc
4 {
5  namespace Databases
6  {
7  namespace MSSQL
8  {
11  {
12  protected:
14  std::wstring _ipaddress;
16  int _port;
20  std::wstring _instancename;
24  std::wstring _username;
26  std::wstring _password;
28  std::wstring _database;
30  std::wstring _appname;
32  std::wstring _namedpipe;
33  public:
35  static LPCWSTR DEFAULT_IPADDRESS;
37  static const int INVALID_PORT = -1;
39  static const int DEFAULT_PORT = 1433;
41  static LPCWSTR DefaultInstanceName;
43  inline const std::wstring& GetIPAddress() const { return _ipaddress; }
45  inline void SetIPAddress(const std::wstring& ipaddress) { _ipaddress = ipaddress; }
47  inline int GetPort() const { return _port; }
49  inline void SetPort(int port) { _port = port; }
55  inline bool GetTrustedAuth() const { return _trusted_auth; }
57  inline void SetTrustedAuth(bool value) { _trusted_auth = value; }
59  inline const std::wstring& GetUsername() const { return _username; }
61  inline void SetUsername(const std::wstring& username) { _username = username; }
63  inline const std::wstring& GetPassword() const { return _password; }
65  inline void SetPassword(const std::wstring& password) { _password = password; }
67  inline const std::wstring& GetDatabase() const { return _database; }
69  inline void SetDatabase(const std::wstring& database) { _database = database; }
71  inline const std::wstring& GetAppName() const { return _appname; }
73  inline void SetAppName(const std::wstring& value) { _appname = value; }
75  inline const std::wstring& GetInstanceName() const { return _instancename; }
77  inline void SetInstanceName(const std::wstring& instancename) { _instancename = instancename; }
79  inline const std::wstring& GetNamedPipeValue() const { return _namedpipe; }
81  inline void SetNamedPipeValue(const std::wstring& namedpipe) { _namedpipe = namedpipe; }
85  const std::wstring& ipaddress = DEFAULT_IPADDRESS,
86  int port = DEFAULT_PORT);
88  void operator=(const MSSQLConnectionInfo&);
90  std::wstring GetConnectionString() const;
91  };
92  }
93  }
94 }
static LPCWSTR DEFAULT_IPADDRESS
the default ip address
Definition: MSSQLConnectionInfo.h:35
static const int DEFAULT_PORT
the default port
Definition: MSSQLConnectionInfo.h:39
std::wstring _password
password
Definition: MSSQLConnectionInfo.h:26
void SetTrustedAuth(bool value)
set whether to use trusted auth
Definition: MSSQLConnectionInfo.h:57
int GetPort() const
get the database port number
Definition: MSSQLConnectionInfo.h:47
bool _trusted_auth
use trusted auth (windows auth)
Definition: MSSQLConnectionInfo.h:22
An authenticated Microsoft SQL Server connection info.
Definition: MSSQLConnectionInfo.h:10
const std::wstring & GetInstanceName() const
get the database instance name
Definition: MSSQLConnectionInfo.h:75
void SetInstanceName(const std::wstring &instancename)
set the database instance name
Definition: MSSQLConnectionInfo.h:77
std::wstring _ipaddress
the database ip address
Definition: MSSQLConnectionInfo.h:14
void SetNamedPipeValue(const std::wstring &namedpipe)
set the instance named pipe value
Definition: MSSQLConnectionInfo.h:81
void SetUsername(const std::wstring &username)
set username
Definition: MSSQLConnectionInfo.h:61
AppSecInc::Databases::ODBC::ODBCConnectionProtocol GetProtocol() const
get the connection protocol: TCP/IP or named pipes
Definition: MSSQLConnectionInfo.h:51
A generic connection info.
Definition: ConnectionInfo.h:10
std::wstring _database
database name
Definition: MSSQLConnectionInfo.h:28
void SetIPAddress(const std::wstring &ipaddress)
set the database ip address or host name
Definition: MSSQLConnectionInfo.h:45
const std::wstring & GetAppName() const
get application name
Definition: MSSQLConnectionInfo.h:71
~MSSQLConnectionInfo()
Definition: MSSQLConnectionInfo.cpp:122
AppSecInc::Databases::ODBC::ODBCConnectionProtocol _protocol
the connection protocol to use; default is unspecified
Definition: MSSQLConnectionInfo.h:18
std::wstring _namedpipe
named pipe for the database instance
Definition: MSSQLConnectionInfo.h:32
const std::wstring & GetNamedPipeValue() const
get the instance named pipe value
Definition: MSSQLConnectionInfo.h:79
std::wstring GetConnectionString() const
get the connection string
Definition: MSSQLConnectionInfo.cpp:40
void SetDatabase(const std::wstring &database)
set default database name
Definition: MSSQLConnectionInfo.h:69
void operator=(const MSSQLConnectionInfo &)
Definition: MSSQLConnectionInfo.cpp:26
void SetPort(int port)
set the database port number
Definition: MSSQLConnectionInfo.h:49
void SetProtocol(AppSecInc::Databases::ODBC::ODBCConnectionProtocol protocol)
set the connection protocol
Definition: MSSQLConnectionInfo.h:53
const std::wstring & GetIPAddress() const
get the database ip address or host name
Definition: MSSQLConnectionInfo.h:43
static LPCWSTR DefaultInstanceName
the default instance name; MSSQLSERVER
Definition: MSSQLConnectionInfo.h:41
void SetAppName(const std::wstring &value)
set application name
Definition: MSSQLConnectionInfo.h:73
static const int INVALID_PORT
an invalid port
Definition: MSSQLConnectionInfo.h:37
const std::wstring & GetUsername() const
get username
Definition: MSSQLConnectionInfo.h:59
int _port
the database port
Definition: MSSQLConnectionInfo.h:16
MSSQLConnectionInfo(const MSSQLConnectionInfo &)
constructors/destructors
Definition: MSSQLConnectionInfo.cpp:21
std::wstring _username
username
Definition: MSSQLConnectionInfo.h:24
std::wstring _appname
application name connecting to the remote database
Definition: MSSQLConnectionInfo.h:30
std::wstring _instancename
the name of the database instance
Definition: MSSQLConnectionInfo.h:20
bool GetTrustedAuth() const
get whether to use trusted auth
Definition: MSSQLConnectionInfo.h:55
const std::wstring & GetDatabase() const
get default database name
Definition: MSSQLConnectionInfo.h:67
ODBCConnectionProtocol
Definition: Connection.h:9
void SetPassword(const std::wstring &password)
set password
Definition: MSSQLConnectionInfo.h:65
const std::wstring & GetPassword() const
get password
Definition: MSSQLConnectionInfo.h:63


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