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

MCOL-4323: use vlarray.h

This commit is contained in:
benthompson15
2020-12-02 14:11:41 -06:00
parent 464b02c1ba
commit 4900559545
2 changed files with 13 additions and 10 deletions

View File

@ -5,6 +5,7 @@ using namespace std;
#include "functor_str.h" #include "functor_str.h"
#include "funchelpers.h" #include "funchelpers.h"
#include "functioncolumn.h" #include "functioncolumn.h"
#include "vlarray.h"
using namespace execplan; using namespace execplan;
namespace funcexp namespace funcexp
@ -51,8 +52,8 @@ string Func_decode::getStrVal(rowgroup::Row& row,
int nStrLen = str.length(); int nStrLen = str.length();
int nPassLen = password.length(); int nPassLen = password.length();
char res[nStrLen+1]; utils::VLArray<char> res(nStrLen + 1);
memset(res,0,nStrLen+1); memset(res.data(),0,nStrLen+1);
if (!fSeeded) if (!fSeeded)
{ {
@ -61,11 +62,11 @@ string Func_decode::getStrVal(rowgroup::Row& row,
fSeeded = true; fSeeded = true;
} }
memcpy(res,str.c_str(),nStrLen); memcpy(res.data(),str.c_str(),nStrLen);
sql_crypt.decode(res,nStrLen); sql_crypt.decode(res.data(),nStrLen);
sql_crypt.reinit(); sql_crypt.reinit();
return res; return res.data();
} }
} }

View File

@ -5,6 +5,7 @@ using namespace std;
#include "functor_str.h" #include "functor_str.h"
#include "funchelpers.h" #include "funchelpers.h"
#include "functioncolumn.h" #include "functioncolumn.h"
#include "vlarray.h"
using namespace execplan; using namespace execplan;
namespace funcexp namespace funcexp
@ -53,8 +54,9 @@ string Func_encode::getStrVal(rowgroup::Row& row,
int nStrLen = str.length(); int nStrLen = str.length();
int nPassLen = password.length(); int nPassLen = password.length();
char res[nStrLen+1]; utils::VLArray<char> res(nStrLen + 1);
memset(res,0,nStrLen+1); memset(res.data(),0,nStrLen+1);
if (!fSeeded) if (!fSeeded)
{ {
@ -63,11 +65,11 @@ string Func_encode::getStrVal(rowgroup::Row& row,
fSeeded = true; fSeeded = true;
} }
memcpy(res,str.c_str(),nStrLen); memcpy(res.data(),str.c_str(),nStrLen);
sql_crypt.encode(res,nStrLen); sql_crypt.encode(res.data(),nStrLen);
sql_crypt.reinit(); sql_crypt.reinit();
return res; return res.data();
} }
} }