MCPcopy Create free account
hub / github.com/apache/arrow / ReadAllKeys

Function ReadAllKeys

cpp/src/arrow/flight/sql/odbc/odbc_impl/config/configuration.cc:84–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82}
83
84std::vector<std::string> ReadAllKeys(const std::string& dsn) {
85 CONVERT_SQLWCHAR_STR(wdsn, dsn);
86
87 std::vector<SQLWCHAR> buf(BUFFER_SIZE);
88
89 int ret = SQLGetPrivateProfileString(reinterpret_cast<LPCWSTR>(wdsn.c_str()), NULL,
90 reinterpret_cast<LPCWSTR>(L""), buf.data(),
91 static_cast<int>(buf.size()), ODBC_INI);
92
93 if (ret > BUFFER_SIZE) {
94 // If there wasn't enough space, try again with the right size buffer.
95 buf.resize(ret + 1);
96 ret = SQLGetPrivateProfileString(reinterpret_cast<LPCWSTR>(wdsn.c_str()), NULL,
97 reinterpret_cast<LPCWSTR>(L""), buf.data(),
98 static_cast<int>(buf.size()), ODBC_INI);
99 }
100
101 // When you pass NULL to SQLGetPrivateProfileString it gives back a \0 delimited list of
102 // all the keys. The below loop simply tokenizes all the keys and places them into a
103 // vector.
104 std::vector<std::string> keys;
105 SQLWCHAR* begin = buf.data();
106 while (begin && *begin != '\0') {
107 SQLWCHAR* cur;
108 for (cur = begin; *cur != '\0'; ++cur) {
109 }
110
111 std::string key("");
112 SQLINTEGER key_len = static_cast<SQLINTEGER>(cur - begin);
113 SetAttributeSQLWCHAR(begin, key_len * GetSqlWCharSize(), key);
114 keys.emplace_back(key);
115 begin = ++cur;
116 }
117 return keys;
118}
119} // namespace
120
121Configuration::Configuration() {

Callers 1

LoadDsnMethod · 0.85

Calls 6

SetAttributeSQLWCHARFunction · 0.85
GetSqlWCharSizeFunction · 0.85
resizeMethod · 0.80
emplace_backMethod · 0.80
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected