Skip to content

Commit

Permalink
implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-ext-simba-hx committed Nov 13, 2024
1 parent 43a3e04 commit b8664ca
Show file tree
Hide file tree
Showing 14 changed files with 1,496 additions and 852 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ set(SOURCE_FILES_CPP_WRAPPER
include/snowflake/SFURL.hpp
include/snowflake/CurlDesc.hpp
include/snowflake/CurlDescPool.hpp
include/snowflake/BindUploader.hpp
cpp/lib/Exceptions.cpp
cpp/lib/Connection.cpp
cpp/lib/Statement.cpp
Expand All @@ -235,6 +236,9 @@ set(SOURCE_FILES_CPP_WRAPPER
cpp/lib/ResultSetJson.hpp
cpp/lib/Authenticator.cpp
cpp/lib/Authenticator.hpp
cpp/lib/BindUploader.cpp
cpp/lib/ClientBindUploader.hpp
cpp/lib/ClientBindUploader.cpp
cpp/jwt/jwtWrapper.cpp
cpp/util/SnowflakeCommon.cpp
cpp/util/SFURL.cpp
Expand Down
34 changes: 9 additions & 25 deletions cpp/FileTransferAgent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "crypto/Cryptor.hpp"
#include "util/CompressionUtil.hpp"
#include "util/ThreadPool.hpp"
#include "util/SnowflakeCommon.hpp"
#include "EncryptionProvider.hpp"
#include "logger/SFLogger.hpp"
#include "error.h"
Expand All @@ -31,35 +32,11 @@
using ::std::string;
using ::std::vector;
using ::Snowflake::Client::RemoteStorageRequestOutcome;
using namespace Snowflake::Client::Util;

namespace
{
const std::string FILE_PROTOCOL = "file://";

void replaceStrAll(std::string& stringToReplace,
std::string const& oldValue,
std::string const& newValue)
{
size_t oldValueLen = oldValue.length();
size_t newValueLen = newValue.length();
if (0 == oldValueLen)
{
return;
}

size_t index = 0;
while (true) {
/* Locate the substring to replace. */
index = stringToReplace.find(oldValue, index);
if (index == std::string::npos) break;

/* Make the replacement. */
stringToReplace.replace(index, oldValueLen, newValue);

/* Advance index forward so the next iteration doesn't pick it up as well. */
index += newValueLen;
}
}
}

Snowflake::Client::FileTransferAgent::FileTransferAgent(
Expand Down Expand Up @@ -968,6 +945,8 @@ using namespace Snowflake::Client;
extern "C" {
SF_STATUS STDCALL _snowflake_execute_put_get_native(
SF_STMT* sfstmt,
void* upload_stream,
size_t stream_size,
struct SF_QUERY_RESULT_CAPTURE* result_capture)
{
if (!sfstmt)
Expand Down Expand Up @@ -996,6 +975,11 @@ extern "C" {
agent.setGetMaxRetries(sfconn->get_maxretries);
agent.setRandomDeviceAsUrand(sfconn->put_use_urand_dev);

if (upload_stream)
{
agent.setUploadStream((std::basic_iostream<char>*)upload_stream, stream_size);
}

ITransferResult* result;
try
{
Expand Down
Loading

0 comments on commit b8664ca

Please sign in to comment.