diff -r cd9db43db120 -r 91cb012d779a src/DriverManager.h --- a/src/DriverManager.h Mon May 25 21:11:17 2020 +0200 +++ b/src/DriverManager.h Sun May 31 16:56:07 2020 +0200 @@ -17,17 +17,26 @@ #pragma once #include +#include #include #include #include #include "SqlException.h" +#include "Connection.h" namespace relpipe { namespace tr { namespace sql { +/** + * Common principles in this SQL layer: + * - Numbering starts with 1, not 0. First parameter or column = 1. + * - If you got a pointer returned from a method or function, you are then responsible for given object. + * Wrapping it immediatelly in a smart pointer is a convenient way to manage its lifecycle. + * Statements should be destroyed before the Connection. And Connection should be destroyed before DriverManager. + */ class DriverManager { private: void* env; @@ -44,6 +53,9 @@ DriverManager(); virtual ~DriverManager(); std::vector getDataSources(); + Connection* getConnectionByDSN(relpipe::reader::string_t dataSourceName, relpipe::reader::string_t userName = L"", relpipe::reader::string_t password = L""); + Connection* getConnectionByString(relpipe::reader::string_t connectionString); + relpipe::reader::string_t buildDSN(const std::map& parameters); }; }