Skip to content

Commit d6e3db9

Browse files
committed
Implemented fetch_row for transaction
1 parent c71a7cb commit d6e3db9

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/query_result.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,13 @@ impl PSQLDriverSinglePyQueryResult {
7272
/// postgres type to python or set new key-value pair
7373
/// in python dict.
7474
pub fn result(&self, py: Python<'_>) -> RustPSQLDriverPyResult<Py<PyAny>> {
75+
let python_dict = PyDict::new(py);
7576
if let Some(row) = self.inner.first() {
76-
let python_dict = PyDict::new(py);
7777
for (column_idx, column) in row.columns().iter().enumerate() {
7878
let python_type = postgres_to_py(py, row, column, column_idx)?;
7979
python_dict.set_item(column.name().to_object(py), python_type)?;
8080
}
81-
return Ok(python_dict.to_object(py));
8281
}
83-
return Ok(PyDict::new(py).to_object(py));
82+
Ok(python_dict.to_object(py))
8483
}
8584
}

0 commit comments

Comments
 (0)