-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Expose column information on row #292
Conversation
This is my attempt to fix launchbadge#181 . I am not sure if you have the same implementation in mind so let me know if I am on the right track. I was not sure how to verify the column type in tests as I couldn't construct `MySqlTypeInfo` due to `TypeId` being crate-private.
883d763
to
08cca83
Compare
This is a good start. We may want to change internals enough that we can produce a reference to the columns list or perhaps produce an iterator over the column. Sorry for it not being clear but as that issue was marked proposal, I'd also like to talk more on the design space there. Currently we have a few different I'd like to settle on a unification of those and making It's probably a good idea to let each driver define it's column type and associate them to the Thinking through this, SQLite column meta data isn't a normal ask so we probably wouldn't be able to have a generic interface return I would assume someone wanting a descriptive list of columns likely isn't in a performance sensitive scenario. |
Thanks for taking a look at this pr! I am a building a hobby MySQL client so my use case involves getting columns names for each executed query. Can't speak about other use cases. I understand that there might not be a well defined interface we want to implement. How about I will try to expose column information for other databases first using the proposed interface (if possible)? Then (in the same pr) we can better evaluate whether implementation and interface make sense by looking at all database at the same time. |
Now I see what you meant. SQlite doesn't look trivial and I didn't manage to figure out how to get type info for each column. What are the next steps? Do we want to rethink Let me know what you think and whether you need more time to think about it. |
@zaynetro Sorry for not getting back to you. v0.4 (should be out soon) should have the internals moved around enough where this an be trivial to add. |
No problem. This issue is not blocking me. Plus I have also limited time to focus on this. |
Thank you for starting this. I've got an implementation in https://github.com/launchbadge/sqlx/blob/master/sqlx-core/src/row.rs#L83-L108 https://github.com/launchbadge/sqlx/blob/master/sqlx-core/src/column.rs#L4 |
Great! Thanks! |
This is my attempt to fix #181 .
I am not sure if you have the same implementation in mind so let me know if I am
on the right track.
I was not sure how to verify the column type in tests as I couldn't construct
Figured it out...MySqlTypeInfo
due toTypeId
being crate-private.