mirror of
https://github.com/isar/rusqlite.git
synced 2025-10-26 03:08:57 +08:00
Modify Rows::next to tie its lifetime to the returned Row.
This means Rows no longer implements Iterator, but it is no longer possible to misuse it by accessing a stale Row handle.
This commit is contained in:
@@ -40,10 +40,6 @@ pub enum Error {
|
||||
/// did not return any.
|
||||
QueryReturnedNoRows,
|
||||
|
||||
/// Error when trying to access a `Row` after stepping past it. See the discussion on
|
||||
/// the `Rows` type for more details.
|
||||
GetFromStaleRow,
|
||||
|
||||
/// Error when the value of a particular column is requested, but the index is out of range
|
||||
/// for the statement.
|
||||
InvalidColumnIndex(c_int),
|
||||
@@ -105,7 +101,6 @@ impl fmt::Display for Error {
|
||||
write!(f, "Execute returned results - did you mean to call query?")
|
||||
}
|
||||
Error::QueryReturnedNoRows => write!(f, "Query returned no rows"),
|
||||
Error::GetFromStaleRow => write!(f, "Attempted to get a value from a stale row"),
|
||||
Error::InvalidColumnIndex(i) => write!(f, "Invalid column index: {}", i),
|
||||
Error::InvalidColumnName(ref name) => write!(f, "Invalid column name: {}", name),
|
||||
Error::InvalidColumnType => write!(f, "Invalid column type"),
|
||||
@@ -137,7 +132,6 @@ impl error::Error for Error {
|
||||
"execute returned results - did you mean to call query?"
|
||||
}
|
||||
Error::QueryReturnedNoRows => "query returned no rows",
|
||||
Error::GetFromStaleRow => "attempted to get a value from a stale row",
|
||||
Error::InvalidColumnIndex(_) => "invalid column index",
|
||||
Error::InvalidColumnName(_) => "invalid column name",
|
||||
Error::InvalidColumnType => "invalid column type",
|
||||
@@ -163,7 +157,6 @@ impl error::Error for Error {
|
||||
Error::InvalidParameterName(_) |
|
||||
Error::ExecuteReturnedResults |
|
||||
Error::QueryReturnedNoRows |
|
||||
Error::GetFromStaleRow |
|
||||
Error::InvalidColumnIndex(_) |
|
||||
Error::InvalidColumnName(_) |
|
||||
Error::InvalidColumnType |
|
||||
|
||||
Reference in New Issue
Block a user