-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Important: No Error being thrown while trying to insert when select is active #145
Comments
Yes, see docs. |
No error is displayed because you are ignoring the error returned by the Commit. |
@gwenn Yes that works. I followed a sample program in go-sqlite3. Should have known to catch the commit error. I would update the examples in go-sqlite3 to show it for errors when doing a Commit(). Thanks |
You're welcome. |
SQLITE VERSION: 3.7.13
GO VERSION: 1.3.1
Latest go-sqlite3 as of 9/5/14
No error is being thrown while trying to insert when select is active. Should be getting some type of database is locked error. This issue is highly related to #39. The only difference is here we use transactions.
Here is some sample code. Every time code is run, there should be addition of 1 new record. However we are seeing a maximum of 2 rows, with the second row continuously being replaced with the newer record.
We can correct the code either by
changing
rows, err := db.Query("SELECT name FROM sqlite_master WHERE type='table' AND name='TEMP';")
to
rows, err := tx.Query("SELECT name FROM sqlite_master WHERE type='table' AND name='TEMP';")
Or applying the fix to #39 which is to change
db, err := sql.Open("sqlite3", "locked.sqlite")
to
db, err := sql.Open("sqlite3", "file:locked.sqlite?cache=shared&mode=rwc")
Or we can manually close the row. However some type of error should be displayed.
The text was updated successfully, but these errors were encountered: