Use fully static linkage #364
2 changed files with 17 additions and 10 deletions
|
@ -641,14 +641,21 @@ bool CClaimTrieCacheBase::removeClaim(const CUint160& claimId, const CTxOutPoint
|
||||||
// because it's a parent one and should not be effectively erased
|
// because it's a parent one and should not be effectively erased
|
||||||
// we had a bug in the old code where that situation would force a zero delay on re-add
|
// we had a bug in the old code where that situation would force a zero delay on re-add
|
||||||
if (true) { // TODO: hard fork this out (which we already tried once but failed)
|
if (true) { // TODO: hard fork this out (which we already tried once but failed)
|
||||||
db << "SELECT nodeName FROM claims WHERE nodeName LIKE ?1 "
|
const static std::string charsThatBreakLikeOp("_%\0", 3);
|
||||||
"AND activationHeight < ?2 AND expirationHeight > ?2 ORDER BY nodeName LIMIT 1"
|
bool cantUseLike = nodeName.find_first_of(charsThatBreakLikeOp) != std::string::npos;
|
||||||
<< nodeName + '%' << nNextHeight
|
auto query = cantUseLike ? (db << "SELECT nodeName FROM claims WHERE SUBSTR(nodeName, 1, ?3) = ?1 "
|
||||||
>> [this, &nodeName](const std::string& shortestMatch) {
|
"AND activationHeight < ?2 AND expirationHeight > ?2 ORDER BY nodeName LIMIT 1"
|
||||||
if (shortestMatch != nodeName)
|
<< nodeName << nNextHeight << nodeName.size()) :
|
||||||
// set this when there are no more claims on that name and that node still has children
|
(db << "SELECT nodeName FROM claims WHERE nodeName LIKE ?1 "
|
||||||
removalWorkaround.insert(nodeName);
|
"AND activationHeight < ?2 AND expirationHeight > ?2 ORDER BY nodeName LIMIT 1"
|
||||||
};
|
<< nodeName + '%' << nNextHeight);
|
||||||
|
for (auto&& row: query) {
|
||||||
|
std::string shortestMatch;
|
||||||
|
row >> shortestMatch;
|
||||||
|
if (shortestMatch != nodeName)
|
||||||
|
// set this when there are no more claims on that name and that node still has children
|
||||||
|
removalWorkaround.insert(nodeName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,8 @@ namespace sqlite {
|
||||||
|
|
||||||
class sqlite_exception: public std::runtime_error {
|
class sqlite_exception: public std::runtime_error {
|
||||||
public:
|
public:
|
||||||
sqlite_exception(const char* msg, str_ref sql, int code = -1): runtime_error(sql + ':' + msg), code(code), sql(sql) {}
|
sqlite_exception(const char* msg, str_ref sql, int code = -1): runtime_error(msg + std::string(": ") + sql), code(code), sql(sql) {}
|
||||||
sqlite_exception(int code, str_ref sql, const char *msg = nullptr): runtime_error(sql + ':' + (msg ? msg : sqlite3_errstr(code))), code(code), sql(sql) {}
|
sqlite_exception(int code, str_ref sql, const char *msg = nullptr): runtime_error((msg ? msg : sqlite3_errstr(code)) + std::string(": ") + sql), code(code), sql(sql) {}
|
||||||
int get_code() const {return code & 0xFF;}
|
int get_code() const {return code & 0xFF;}
|
||||||
int get_extended_code() const {return code;}
|
int get_extended_code() const {return code;}
|
||||||
std::string get_sql() const {return sql;}
|
std::string get_sql() const {return sql;}
|
||||||
|
|
Loading…
Reference in a new issue