digitalmars.D.learn - Function and variable assignment
- Jeremy Cowgar (20/20) Apr 13 2005 I have the database api all setup and functioning, but now I would like
- Chris Sauls (12/40) Apr 13 2005 Hmm... maybe something like this:
I have the database api all setup and functioning, but now I would like
to do something like:
Results res = db.query("SELECT * FROM people");
Row row;
char[] name, city, state, zip;
row.bind("name", name);
row.bind("city", city);
row.bind("state", state);
row.bind("zip", zip);
while((row = res.fetchRow()) != null) {
printf("Name = %.*s, city = %.*s, state = %.*s, zip = %.*s", name,
city, state, zip);
}
----
the row.bind function is what I do not know how to develop, or if it's
even possible. Can someone give me a simple example? Not of how the
database api works, but simply how I would store a reference to the char
array for later assigning and repeat assigning in my Row class.
Thanks!
Jeremy
Apr 13 2005
Hmm... maybe something like this:
Where Row.bind is defined as:
Then keep a map of variables locally, something like:
Just a 20-seconds-of-thought suggestion.
-- Chris Sauls
Jeremy Cowgar wrote:
I have the database api all setup and functioning, but now I would like
to do something like:
Results res = db.query("SELECT * FROM people");
Row row;
char[] name, city, state, zip;
row.bind("name", name);
row.bind("city", city);
row.bind("state", state);
row.bind("zip", zip);
while((row = res.fetchRow()) != null) {
printf("Name = %.*s, city = %.*s, state = %.*s, zip = %.*s", name,
city, state, zip);
}
----
the row.bind function is what I do not know how to develop, or if it's
even possible. Can someone give me a simple example? Not of how the
database api works, but simply how I would store a reference to the char
array for later assigning and repeat assigning in my Row class.
Thanks!
Jeremy
Apr 13 2005








Chris Sauls <ibisbasenji gmail.com>