Skip to content

Commit

Permalink
Merge pull request #258 from kennethshackleton/remove-stray-reset
Browse files Browse the repository at this point in the history
Remove extraneous prepared statement reset when retrying for busy.
  • Loading branch information
kennethshackleton authored Oct 3, 2021
2 parents d5c3c42 + f3ac07f commit 136b70c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,19 @@ internal class SQLiteTest {
}
}

@Test
fun resetPreparedStatement() {
assertEquals(SQL_OK, SQLite.exec(db, "CREATE TABLE 'Foo' (bar TEXT)"))
assertEquals(SQL_OK, SQLite.exec(db, "INSERT INTO 'Foo' VALUES ('abc')"))
assertEquals(SQL_OK, SQLite.exec(db, "INSERT INTO 'Foo' VALUES ('123')"))
prepareStatement(db, "SELECT * FROM 'Foo'").usePreparedStatement {
assertEquals(SQL_ROW, SQLite.step(it))
assertEquals(SQL_OK, SQLite.reset(it))
assertEquals(SQL_ROW, SQLite.step(it))
assertEquals("abc", SQLite.columnText(it, 0))
}
}

@Test
fun columnTypeBlob() {
assertEquals(SQL_OK, SQLite.exec(db, "CREATE TABLE 'Foo' (bar BLOB)"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ internal class SQLPreparedStatement(
SQL_DONE -> SQL_DONE
SQL_BUSY -> {
pauseElseExpire(expireAtMillis)
sqlite.reset(pointer)
stepUntil(expireAtMillis)
}
else -> sqlite.throwSQLException(sqlite.databaseHandle(pointer))
Expand Down

0 comments on commit 136b70c

Please sign in to comment.