dbTalk Databases Forums  

Data types - especially strings

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


Discuss Data types - especially strings in the mailing.database.mysql-plusplus forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Joachim Person
 
Posts: n/a

Default Data types - especially strings - 03-14-2005 , 01:11 PM






------=_NextPart_000_0006_01C528D1.F63C9AD0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit

Having the following code



std::vector<CString> retV;

Result::iterator iter;

Row row;

for (iter = result.begin(); iter != result.end(); ++iter) {

row = *iter;


retV.push_back(CString(row[TABLE_NAME_SERVICE_COL_NAME_NAME]));

}





only gives me one letter as result. So this seems wrong. How do I get the
full string?




------=_NextPart_000_0006_01C528D1.F63C9AD0--



Reply With Quote
  #2  
Old   
Chris Frey
 
Posts: n/a

Default Re: Data types - especially strings - 03-14-2005 , 02:36 PM






On Mon, Mar 14, 2005 at 08:11:09PM +0100, Joachim Person wrote:
Quote:
Having the following code



std::vector<CString> retV;

Result::iterator iter;
iter needs to be set to something. :-)

- Chris


--
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
  #3  
Old   
Chris Frey
 
Posts: n/a

Default Re: Data types - especially strings - 03-14-2005 , 02:40 PM



On Mon, Mar 14, 2005 at 08:11:09PM +0100, Joachim Person wrote:
Quote:
Having the following code



std::vector<CString> retV;

Result::iterator iter;

Row row;

for (iter = result.begin(); iter != result.end(); ++iter) {

row = *iter;


retV.push_back(CString(row[TABLE_NAME_SERVICE_COL_NAME_NAME]));

}
Oops, my dumb mistake, it is set to something. I should wake up completely
before I post advice. :-)

My first thought would be to check what type the inner
"row[TABLE_NAME...]" is returning. If it is not returning what you think
it is, you may need to force it with a cast.

- Chris


--
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
  #4  
Old   
Earl Miles
 
Posts: n/a

Default Re: Data types - especially strings - 03-14-2005 , 02:48 PM



Chris Frey wrote:
Quote:
On Mon, Mar 14, 2005 at 08:11:09PM +0100, Joachim Person wrote:

Having the following code



std::vector<CString> retV;

Result::iterator iter;

Row row;

for (iter = result.begin(); iter != result.end(); ++iter) {

row = *iter;


retV.push_back(CString(row[TABLE_NAME_SERVICE_COL_NAME_NAME]));

}


Oops, my dumb mistake, it is set to something. I should wake up completely
before I post advice. :-)

My first thought would be to check what type the inner
"row[TABLE_NAME...]" is returning. If it is not returning what you think
it is, you may need to force it with a cast.
Having run into issues like this, it's almost certainly the problem. Try casting it to const char* which CString will more likely interpret as a string; it's probably somehow coming out as just a char (though the compiler *should* complain because it shouldn't be able to figure out which CString constructor to use in that situation since row has a lot of different operators).

--
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.