src/DriverManager.cpp
branchv_0
changeset 41 4b2d46989f44
parent 40 0d67e271abb7
child 42 7f668a5a435b
equal deleted inserted replaced
40:0d67e271abb7 41:4b2d46989f44
    77 	SQLSMALLINT completeConnectionStringLength = -1;
    77 	SQLSMALLINT completeConnectionStringLength = -1;
    78 	SQLRETURN result = SQLDriverConnect(connection, nullptr,
    78 	SQLRETURN result = SQLDriverConnect(connection, nullptr,
    79 			(SQLCHAR*) convertor.to_bytes(connectionString).c_str(), SQL_NTS,
    79 			(SQLCHAR*) convertor.to_bytes(connectionString).c_str(), SQL_NTS,
    80 			(SQLCHAR*) completeConnectionString, sizeof (completeConnectionString), &completeConnectionStringLength,
    80 			(SQLCHAR*) completeConnectionString, sizeof (completeConnectionString), &completeConnectionStringLength,
    81 			SQL_DRIVER_NOPROMPT);
    81 			SQL_DRIVER_NOPROMPT);
    82 	if (OdbcCommon::isNotSuccessful(result)) {
    82 	if (OdbcCommon::isNotSuccessful(result)) throw SqlException(L"Unable to connect to URL: " + connectionString, result, SQL_HANDLE_DBC, connection, true);
    83 		OdbcCommon::freeHandle(SQL_HANDLE_DBC, connection);
       
    84 		throw SqlException(L"Unable to connect to URL: " + connectionString, result, SQL_HANDLE_ENV, environment);
       
    85 	}
       
    86 	return new Connection(connection);
    83 	return new Connection(connection);
    87 }
    84 }
    88 
    85 
    89 }
    86 }
    90 }
    87 }