wolftousen
Joined: 28 Jan 2008 Posts: 10
|
Posted: Sun Apr 26, 2009 8:35 pm Post subject: new to ddbi - quick question |
|
|
Ok, used dsss net install ddbi and it went fine (except it kept asking me for a file name and I had no clue what to give it so skipped all that...)
I have my program running, i'm just wondering if there is a simpler way to get the data out of result.
Here is all my dbi code:
Code: | //create and connect to my database
...
//username and password are defined as char[] elsewhere
auto result = db.query("select status from accounts where username='" ~ username ~ "' and password='" ~ password ~ "';");
...
//this is where i would like something simplier to type and easier to read
status = toInt(result.rows.next.stringAt(0)); |
This is what I want, but when I do this it fails to give me the proper value:
Code: |
//create and connect to my database
...
//username and password are defined as char[] elsewhere
auto result = db.query("select * from accounts where username='" ~ username ~ "' and password='" ~ password ~ "';");
...
status = toInt(result.rows.next.stringAt("status")); |
Anyone have any insight?
Btw, having Docs and a small tutorial for each database type that covers both querying and fetching would be very helpful.
And, i haven't used MySQL in PHP in a while, but i seem to remember the query giving a result and then result had a fetch function which gave you a char[][], this would be very nice here... |
|