1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

MCOL-5 fill the vector before taking the addresses of the strings.

This commit is contained in:
David Hall
2016-08-08 16:36:01 -05:00
parent 7598e8bc75
commit 8de8666046
3 changed files with 10 additions and 8 deletions

View File

@ -3456,11 +3456,12 @@ void ha_calpont_impl_start_bulk_insert(ha_rows rows, TABLE* table)
std::istringstream ss(aCmdLine); std::istringstream ss(aCmdLine);
std::string arg; std::string arg;
std::vector<std::string> v2(20, ""); std::vector<std::string> v2(20, "");
unsigned int i = 0;
while (ss >> arg) while (ss >> arg)
{ {
v2.push_back(arg); v2[i++] = arg;
} }
for (unsigned int i = 0; i < v2.size(); ++i) for (i = 0; i < v2.size(); ++i)
{ {
Cmds.push_back(const_cast<char*>(v2[i].c_str())); Cmds.push_back(const_cast<char*>(v2[i].c_str()));
} }

View File

@ -248,11 +248,12 @@ bool WEDataLoader::setupCpimport() // fork the cpimport
std::istringstream ss(aCmdLine); std::istringstream ss(aCmdLine);
std::string arg; std::string arg;
std::vector<std::string> v2(20, ""); std::vector<std::string> v2(20, "");
unsigned int i = 0;
while (ss >> arg) while (ss >> arg)
{ {
v2.push_back(arg); v2[i++] = arg;
} }
for (unsigned int i = 0; i < v2.size(); ++i) for (i = 0; i < v2.size(); ++i)
{ {
Cmds.push_back(const_cast<char*>(v2[i].c_str())); Cmds.push_back(const_cast<char*>(v2[i].c_str()));
} }

View File

@ -453,16 +453,16 @@ void WESplitterApp::invokeCpimport()
std::istringstream ss(aCmdLineStr); std::istringstream ss(aCmdLineStr);
std::string arg; std::string arg;
std::vector<std::string> v2(20, ""); std::vector<std::string> v2(20, "");
unsigned int i = 0;
while(ss >> arg) while(ss >> arg)
{ {
//we need something that works on Windows as well as linux //we need something that works on Windows as well as linux
v2.push_back(arg); v2[i++] = arg;
} }
for (unsigned int i = 0; i < v2.size(); ++i) for (i = 0; i < v2.size(); ++i)
{ {
//we're going to exec() below, so don't worry about freeing //we're going to exec() below, so don't worry about freeing
ptr = strdup(v2.back().c_str()); Cmds.push_back(const_cast<char*>(v2[i].c_str()));
Cmds.push_back(ptr);
} }
Cmds.push_back(0); //null terminate Cmds.push_back(0); //null terminate