Skip to content
This repository was archived by the owner on Oct 18, 2023. It is now read-only.

Commit 7b55732

Browse files
committed
sqld: use StatementStatus::RowsRead and RowsWritten
Now that they are available in the rusqlite branch, let's use the metrics in a proper way instead of hacking it with std::mem::transmute.
1 parent 1303236 commit 7b55732

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

sqld/src/database/libsql.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -314,16 +314,10 @@ impl Connection {
314314
}
315315

316316
fn update_stats(&self, stmt: &rusqlite::Statement) {
317-
const STMT_ROWS_READ: i32 = 1024 + 1;
318-
const STMT_ROWS_WRITTEN: i32 = 1024 + 2;
319-
320-
let rows_read: StatementStatus = unsafe { std::mem::transmute(STMT_ROWS_READ) };
321-
let rows_written: StatementStatus = unsafe { std::mem::transmute(STMT_ROWS_WRITTEN) };
322-
323317
self.stats
324-
.inc_rows_read(stmt.get_status(rows_read) as usize);
318+
.inc_rows_read(stmt.get_status(StatementStatus::RowsRead) as usize);
325319
self.stats
326-
.inc_rows_written(stmt.get_status(rows_written) as usize);
320+
.inc_rows_written(stmt.get_status(StatementStatus::RowsWritten) as usize);
327321
}
328322
}
329323

0 commit comments

Comments
 (0)