MCPcopy Create free account
hub / github.com/alliedmodders/sourcemod / RunThinkPart

Method RunThinkPart

core/logic/smn_database.cpp:1718–1757  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1716
1717public:
1718 void RunThinkPart()
1719 {
1720 if (!success_ && !failure_)
1721 return;
1722
1723 if (Succeeded() && success_)
1724 {
1725 if (CallSuccess())
1726 return;
1727 }
1728
1729 if (!Succeeded() && failure_)
1730 {
1731 HandleSecurity sec(ident_, g_pCoreIdent);
1732
1733 std::unique_ptr<cell_t[]> data = std::make_unique<cell_t[]>(txn_->entries.size());
1734 for (size_t i = 0; i < txn_->entries.size(); i++)
1735 data[i] = txn_->entries[i].data;
1736
1737 Handle_t dbh = CreateLocalHandle(g_DBMan.GetDatabaseType(), db_, &sec);
1738 if (dbh != BAD_HANDLE)
1739 {
1740 // Add an extra refcount for the handle.
1741 db_->AddRef();
1742 }
1743
1744 if (failure_->IsRunnable())
1745 {
1746 failure_->PushCell(dbh);
1747 failure_->PushCell(data_);
1748 failure_->PushCell(txn_->entries.size());
1749 failure_->PushString(error_.c_str());
1750 failure_->PushCell(failIndex_);
1751 failure_->PushArray(data.get(), txn_->entries.size());
1752 failure_->Execute(NULL);
1753 }
1754
1755 handlesys->FreeHandle(dbh, &sec);
1756 }
1757 }
1758
1759private:
1760 ke::RefPtr<IDatabase> db_;

Callers

nothing calls this directly

Calls 11

CreateLocalHandleFunction · 0.85
GetDatabaseTypeMethod · 0.80
IsRunnableMethod · 0.80
PushCellMethod · 0.80
PushStringMethod · 0.80
PushArrayMethod · 0.80
FreeHandleMethod · 0.80
sizeMethod · 0.45
AddRefMethod · 0.45
c_strMethod · 0.45
ExecuteMethod · 0.45

Tested by

no test coverage detected