[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql-plusplus
Subject:    Re: Simple query problem
From:       Ibrahim Mubarak <ibmub80 () yahoo ! com>
Date:       2005-01-15 17:25:38
Message-ID: 20050115172539.45511.qmail () web50901 ! mail ! yahoo ! com
[Download RAW message or body]


--- Zahroof Mohamed <zahroofm@gmail.com> wrote:

> I'd like to access a row in a table. The primary key column is named
> "id". I'd like to use a query which passes the specific id as a
> variable. It appears that I can do this:
> 
> int iID = 1000;
> query << "SELECT * FROM table WHERE id = " << iID;
> 
> By executing this query could I get the row corresponding to id = 1000?

You answered your own question! By executing this query, you will get the row(s) where id = 1000.
Check example complic1.cpp. It shows how to use the store method of the Query object (= executing
the query) that puts the results in a Result object. It also shows how to use a Row object to get
the info from the Result object.

> Can anyone point me to where I can find information about how I would
> pass other types of variables - such as a double, string or a date
> etc. Didn't find anything in the examples or in the manual.

Strings, doubles, floats, chars, and the like are straight forward. Just do it like the int
example you brought up. However, for more complicated types such as dates I am not sure how to go
about it. Maybe someone with greater experience in this than me can help you out.

HTH,
ib


		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - 250MB free storage. Do more. Manage less. 
http://info.mail.yahoo.com/mail_250

-- 
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe:    http://lists.mysql.com/plusplus?unsub=mysql-plusplus@progressive-comp.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic