mirror of
https://gitee.com/openharmony/distributeddatamgr_relational_store
synced 2025-02-17 00:39:02 +00:00
SQL语句匿名化
Signed-off-by: bjd <baijidong@huawei.com>
This commit is contained in:
parent
cd94e76d48
commit
fe6a3f5467
@ -481,7 +481,7 @@ std::string SqliteUtils::AnonySql(const std::string &sql)
|
||||
std::string replaceSql = ReplaceMultipleSpaces(sql);
|
||||
std::string sqlType;
|
||||
if (replaceSql.size() > SQL_TYPE_SIZE) {
|
||||
sqlType = SqliteUtils::StrToUpper(replaceSql.substr(0, 3));
|
||||
sqlType = SqliteUtils::StrToUpper(replaceSql.substr(START_SIZE, SQL_TYPE_SIZE));
|
||||
} else {
|
||||
return replaceSql;
|
||||
}
|
||||
|
@ -256,10 +256,10 @@ HWTEST_F(SqliteUtilsTest, SqliteUtils_Test_0039, TestSize.Level1)
|
||||
|
||||
HWTEST_F(SqliteUtilsTest, SqliteUtils_Test_0040, TestSize.Level1)
|
||||
{
|
||||
EXPECT_EQ(
|
||||
SqliteUtils::AnonySql(
|
||||
"CREATE TABLE TEST (id INT PRIMARY KEY, name TEXT, extend BLOB, code REAL, years UNLIMITED INT, ment ASSET, ments ASSETS)."),
|
||||
"CREATE TABLE *EST (*d INT PRIMARY KEY, *ame TEXT, ***end BLOB, *ode REAL, **ars UNLIMITED INT, *ent ASSET, **nts ASSETS)");
|
||||
EXPECT_EQ(SqliteUtils::AnonySql("CREATE TABLE TEST (id INT PRIMARY KEY, name TEXT, "
|
||||
"extend BLOB, code REAL, years UNLIMITED INT, ment ASSET, ments ASSETS)."),
|
||||
"CREATE TABLE *EST (*d INT PRIMARY KEY, *ame TEXT, "
|
||||
"***end BLOB, *ode REAL, **ars UNLIMITED INT, *ent ASSET, **nts ASSETS)");
|
||||
}
|
||||
|
||||
HWTEST_F(SqliteUtilsTest, SqliteUtils_Test_0041, TestSize.Level1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user