List:MySQL++« Previous MessageNext Message »
From:Craig Snyder Date:August 17 2005 1:00am
Subject:Return a single column
View as plain text  
I am using the SSQLS macros and was wondering how to return a single column?
All of the examples show how to put a result into a row but not how to
handle a singe column.  I attempted to define a macro aql_create_1, but that
failed.

 

Code -

sql_create_4(User,

            1, 4,

            int, UID,

            string, GUID,

            string, AID,

            mysqlpp::DateTime, Date)

 

Query query = m_con->query();

query << "select * from User where GUID = " << quote << GUID;

 

Result res = query.store();

User row = res[0];

return row.UID;

 

I would prefer to do is this -

Query query = m_con->query();

query << "select UID from User where GUID = " << quote << GUID;

 

Result res = query.store();

 

then return just the column value

 

Thanks in advance for your help,

Craig

 

 


Thread
Return a single columnCraig Snyder17 Aug
Re: Return a single columnWarren Young17 Aug