| 332 | } |
| 333 | |
| 334 | Status SaveGraph(int64 run_id) { |
| 335 | const char* sql = R"sql( |
| 336 | INSERT OR REPLACE INTO Graphs ( |
| 337 | run_id, |
| 338 | graph_id, |
| 339 | inserted_time, |
| 340 | graph_def |
| 341 | ) VALUES (?, ?, ?, ?) |
| 342 | )sql"; |
| 343 | SqliteStatement insert; |
| 344 | TF_RETURN_IF_ERROR(db_->Prepare(sql, &insert)); |
| 345 | if (run_id != kAbsent) insert.BindInt(1, run_id); |
| 346 | insert.BindInt(2, graph_id_); |
| 347 | insert.BindDouble(3, DoubleTime(now_)); |
| 348 | graph_->clear_node(); |
| 349 | string graph_def; |
| 350 | if (graph_->SerializeToString(&graph_def)) { |
| 351 | insert.BindBlobUnsafe(4, graph_def); |
| 352 | } |
| 353 | return insert.StepAndReset(); |
| 354 | } |
| 355 | |
| 356 | Status MaybeFlush() { |
| 357 | if (unflushed_bytes_ >= kFlushBytes) { |
no test coverage detected