Skip to content
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

Fix datetime field scan error into dummy with "parseTime=true" (Scan pai... #218

Closed
wants to merge 7 commits into from

Conversation

d-g-laptev
Copy link

"sql: Scan error on column index 13: unsupported driver -> Scan pair: time.Time -> *sql.RawBytes"" occurs when datetime fields doesn't exists in struct, but exists in DB-table and i have "?loc=Local&parseTime=true" additional connection params.
So i add custom struct for dummy fields, that implements Scanner interface

@GeertJohan
Copy link
Member

I think you shouldn't select a field if it's not going to be scanned into your struct.
Can you give an example of a case where this problem happens, or maybe provide PR with a failing test case?

@d-g-laptev
Copy link
Author

Sometimes easier to SELECT * (if we must select a lot of fields, except several)
And if one of skipped fields will be DATETIME and parseTime is true, it will cause an error, because sql.RawBytes doesn't implemet Scanner interface

@GeertJohan
Copy link
Member

I'm adding tests about time, also added a parseTime=true run in the automated testing for mysql. #226
Could you provide a failing test case for this with parseTime=true?

@GeertJohan
Copy link
Member

I'm not sure we should ignore unused values. There is an issue about generating a select statement with just the fields you need. See #133. Using select * is bad practice, especially when not reading all fields.. Furthermore, this PR now also contains SelectMapCollection() and other stuff, I guess that is because you used the master branch and added more commits to it for personal use. Do you think a solution for #133 would be sufficient for your use-case?

@GeertJohan GeertJohan force-pushed the master branch 2 times, most recently from a9f5c20 to 361a068 Compare July 2, 2015 07:32
GeertJohan pushed a commit that referenced this pull request Jul 10, 2015
@GeertJohan
Copy link
Member

Merged through #277

@GeertJohan GeertJohan closed this Jul 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants