dbTalk Databases Forums  

Return a single column

mailing.database.mysql-plusplus mailing.database.mysql-plusplus


Discuss Return a single column in the mailing.database.mysql-plusplus forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Craig Snyder
 
Posts: n/a

Default Return a single column - 08-16-2005 , 08:07 PM






------=_NextPart_000_0015_01C5A28C.67AA91C0
Content-Type: text/plain;
charset="US-ASCII"
Content-Transfer-Encoding: 7bit

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:ateTime, 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






------=_NextPart_000_0015_01C5A28C.67AA91C0--


Reply With Quote
  #2  
Old   
Warren Young
 
Posts: n/a

Default Re: Return a single column - 08-17-2005 , 12:53 PM






Craig Snyder wrote:
Quote:
I attempted to define a macro aql_create_1, but that failed.
The problem has to do with constructor overloads. All SSQLSes have a
few constructors that are always defined, so when the number of fields
gets low, the chances increase that the initialization ctor will
conflict with one of these. The solution is to make the third parameter
of the sql_create_x macro 0.

I am going to add an example to illustrate this (custom6) and possibly a
second one to show a different way to do it, without SSQLS (simple3, if
I do it). I'll then make this issue clearer in the user manual.

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.