MCPcopy Create free account
hub / github.com/MiniZinc/MiniZincIDE / save_nodes

Function save_nodes

cp-profiler/src/cpprofiler/db_handler.cpp:182–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180}
181
182static void save_nodes(QSqlDatabase *db, const Execution *ex)
183{
184 const char *insert_query = "INSERT INTO Nodes \
185 (NodeID, ParentID, Alternative, NKids, Status, Label) \
186 VALUES (?,?,?,?,?,?);";
187
188 QSqlQuery insert_bm(*db);
189 insert_bm.prepare(insert_query);
190
191 const auto &tree = ex->tree();
192 const auto order = utils::pre_order(tree);
193
194 constexpr static int TRANSACTION_SIZE = 50000;
195
196 db->transaction();
197 for (auto i = 0u; i < order.size(); ++i)
198 {
199 const auto nid = order[i];
200 const auto pid = tree.getParent(nid);
201 const auto alt = tree.getAlternative(nid);
202 const auto kids = tree.childrenCount(nid);
203 const auto status = tree.getStatus(nid);
204 const auto label = tree.getLabel(nid);
205
206 insert_node(&insert_bm, {nid, pid, alt, kids, status, label});
207
208 if (i % TRANSACTION_SIZE == TRANSACTION_SIZE - 1)
209 {
210 db->commit();
211 db->transaction();
212 }
213 }
214 db->commit();
215}
216
217static void insert_bookmark(QSqlQuery *stmt, BookmarkItem bi)
218{

Callers 1

save_executionFunction · 0.85

Calls 9

pre_orderFunction · 0.85
insert_nodeFunction · 0.85
getLabelMethod · 0.80
commitMethod · 0.80
sizeMethod · 0.45
getParentMethod · 0.45
getAlternativeMethod · 0.45
childrenCountMethod · 0.45
getStatusMethod · 0.45

Tested by

no test coverage detected