You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that with the current state of the go-sqlite3 driver, there's no built-in way to retrieve the data type of each result row dynamically. This becomes an issue when the actual data in a column doesn't match the data type defined by the table schema. For instance, if a column is declared as an integer but contains a string in some rows, attempting to retrieve that row can cause errors.
The problem seems to be related to the use of the sqlite3_column_decltype() function in the DeclTypes() method, which only returns the type declared at the schema level, rather than the actual data type of each individual row.
I've found that gwenn's SQLite driver for Go, while not as widely used anymore (since they’ve shifted focus to Rust), does offer a feature that lets you retrieve the actual type for each row of a result set. You can check it out in the code linked here: gosqlite stmt.go L550-L555.
Given go-sqlite3’s broader usage, I think it would be worth considering adding a similar feature to dynamically retrieve row-level data types in your driver. It would be particularly useful for scenarios where user-generated SQLite databases are involved, such as this one: DB4S download stats.
I also opened an issue a while back with more context on this in gwenn's repository (issue gwenn/gosqlite#5), in case that’s helpful.
What are your thoughts on adding this functionality? 😄
The text was updated successfully, but these errors were encountered:
It seems that with the current state of the
go-sqlite3
driver, there's no built-in way to retrieve the data type of each result row dynamically. This becomes an issue when the actual data in a column doesn't match the data type defined by the table schema. For instance, if a column is declared as an integer but contains a string in some rows, attempting to retrieve that row can cause errors.The problem seems to be related to the use of the
sqlite3_column_decltype()
function in theDeclTypes()
method, which only returns the type declared at the schema level, rather than the actual data type of each individual row.I've found that
gwenn
's SQLite driver for Go, while not as widely used anymore (since they’ve shifted focus to Rust), does offer a feature that lets you retrieve the actual type for each row of a result set. You can check it out in the code linked here: gosqlite stmt.go L550-L555.Given
go-sqlite3
’s broader usage, I think it would be worth considering adding a similar feature to dynamically retrieve row-level data types in your driver. It would be particularly useful for scenarios where user-generated SQLite databases are involved, such as this one: DB4S download stats.I also opened an issue a while back with more context on this in
gwenn's
repository (issue gwenn/gosqlite#5), in case that’s helpful.What are your thoughts on adding this functionality? 😄
The text was updated successfully, but these errors were encountered: