mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-24 13:05:53 +00:00
Significant optimizations.
This commit is contained in:
@@ -181,15 +181,21 @@ X'53514C697465'
|
|||||||
*/
|
*/
|
||||||
void SqliteDatabase::escape(const unsigned char* start, int size, std::string& retStr)
|
void SqliteDatabase::escape(const unsigned char* start, int size, std::string& retStr)
|
||||||
{
|
{
|
||||||
retStr="X'";
|
static const char toHex[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||||
|
'A', 'B', 'C', 'D', 'E', 'F' };
|
||||||
|
|
||||||
char buf[3];
|
retStr.resize(3 + (size * 2));
|
||||||
for(int n=0; n<size; n++)
|
|
||||||
|
int pos = 0;
|
||||||
|
retStr[pos++] = 'X';
|
||||||
|
retStr[pos++] = '\'';
|
||||||
|
|
||||||
|
for (int n = 0; n < size; ++n)
|
||||||
{
|
{
|
||||||
sprintf(buf, "%02X", start[n]);
|
retStr[pos++] = toHex[start[n] >> 4];
|
||||||
retStr.append(buf);
|
retStr[pos++] = toHex[start[n] & 0x0f];
|
||||||
|
}
|
||||||
|
retStr[pos] = '\'';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
retStr.push_back('\'');
|
|
||||||
}
|
|
||||||
// vim:ts=4
|
// vim:ts=4
|
||||||
|
|||||||
Reference in New Issue
Block a user