-
Notifications
You must be signed in to change notification settings - Fork 28
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
Readme examples improvements #169
Comments
Can you please give an example of how to use asAA? Similar to: I found a solution hint here: https://forum.dlang.org/post/[email protected] But some examples with loops are missing! |
That was not the point, I was wondering how I can do: So I ended up with: So I want to ask you to put a foreach and/or while loop example(s) for handling the result range in your documentation, too. |
Ahh, I see, I misunderstood.
It predates D's ranges, too, so that probably explains the weirdness of it being a method of ResultRange (and whatever the predecessor of ResultRange was called - ResultSequence, IIRC) instead of Row. Also, Row doesn't currently have access to the column names - yet. I agree this is very awkward. I'll see what I can do about documenting this with an example. But, FWIW, I do intend to augment Row with the ability to lookup columns by name. Aside from being a feature that's been on my personal wishlist for far too long, that should also reduce (maybe even eliminate?) the need for ResultRange.asAA. Though I might still add a Row.toAA as well, if there's still desire for it. |
foreach(row; db.query("SELECT id, name FROM people ORDER BY name LIMIT 10")) Might be useful to make it similar? Just saw this at the bottom: Authors: Adam D. Ruppe, with contributions from Nick Sabalausky :-) |
Interesting. I guess he must've borrowed some stuff from either this or one of my other libs. And yes, that's basically the syntax I had in mind for looking up a column by name. The implementation should be pretty straightforward, the hardest part is just finding the time for it and everything else :/ |
Should split up the example in the readme into separate parts, and add new front-page examples to illustrate other key aspects of mysql-native.
The text was updated successfully, but these errors were encountered: