FOGL-7274: Fixed issue in asset tracker with single or double quotes in asset name#970
FOGL-7274: Fixed issue in asset tracker with single or double quotes in asset name#970
Conversation
…ecial characters Signed-off-by: Innovative-ashwin <sinha.ashwini111@gmail.com>
…s in asset name Signed-off-by: nandan <nandan.ghildiyal@gmail.com>
Signed-off-by: nandan <nandan.ghildiyal@gmail.com>
| // Handles - asset_code | ||
| sql.append(",\'"); | ||
| sql.append((*itr)["asset_code"].GetString()); | ||
| std::string escacpedAsset((*itr)["asset_code"].GetString()); |
There was a problem hiding this comment.
Fix the spelling "escacped".
| } | ||
| else | ||
| { | ||
| std::string escacpedAsset(asset_code); |
| + to_string(ref.tableId) + "," | ||
| + to_string(ref.dbId) + "," | ||
| + "\"" + asset_code + "\")"; | ||
| + "\"" + escacpedAsset.c_str() + "\")"; |
There was a problem hiding this comment.
escacped should be escaped
|
Asset name is inserted with single quote escaped twice after updating the branch. Identified the issue , it needs code fix in connection.cpp file of sqlite plugin to stop escaping twice. |
Signed-off-by: nandan <nandan.ghildiyal@gmail.com>
Signed-off-by: nandan <nandan.ghildiyal@gmail.com>
Signed-off-by: nandan <nandan.ghildiyal@gmail.com>
Signed-off-by: nandan <nandan.ghildiyal@gmail.com>
Signed-off-by: nandan <nandan.ghildiyal@gmail.com>
Signed-off-by: nandan <nandan.ghildiyal@gmail.com>
AmandeepArora
left a comment
There was a problem hiding this comment.
Since some basic classes have been changed, it might be good to add some test cases, may be in a separate JIRA.
| sql.append(",\'"); | ||
| sql.append((*itr)["asset_code"].GetString()); | ||
| std::string escapedAsset((*itr)["asset_code"].GetString()); | ||
| escapedAsset = std::regex_replace(escapedAsset, std::regex("\'"), "\'\'"); |
There was a problem hiding this comment.
Regex is a really slow way of doing this. We used to make more use of regex but removed it because of the big impact it had on performance. You are not using any regular expressions here, so there are much simpler and more performant ways to do this.
| sql_cmd = | ||
|
|
||
| std::string escapedAsset(asset_code); | ||
| escapedAsset = std::regex_replace(escapedAsset, std::regex("\""), "\"\""); |
There was a problem hiding this comment.
See comment above about not using regex
| dbName = generateDbName(item.second.second); | ||
| dbReadingsName = generateReadingsName(item.second.second, item.second.first); | ||
|
|
||
| assetCode = std::regex_replace(assetCode, std::regex("\'"), "\'\'"); |
There was a problem hiding this comment.
See comment above about not using regex
Signed-off-by: nandan <nandan.ghildiyal@gmail.com>
| #include <common.h> | ||
| #include "readings_catalogue.h" | ||
| #include <purge_configuration.h> | ||
| #include <regex> |
There was a problem hiding this comment.
This is probably not required?
|
Asset tracker has changed so closing this PR and will work changes into the new mechanism |
No description provided.