Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » S_type and ValueMap
S_type and ValueMap [message #52517] Tue, 15 October 2019 11:40 Go to previous message
Giorgio is currently offline  Giorgio
Messages: 218
Registered: August 2015
Experienced Member
Hi there,
I have the following code: the idea is to get data from db, put them in a vector of ValueMap and then put them in a S_type structure.

std::vector<ValueMap> * results=this->dao->QueryTable(table, vmfields); //ValueMap(s) here represent lines from db
for(auto it = results->begin(); it != results->end(); ++it)

  S_FILLER s(*it); //S_FILLER is defined in a .sch file
  //Do something with s
}


S_FILLER is defined as follows:

TABLE_ (FILLER)
  STRING   (KMP,8) PRIMARY_KEY REFERENCES(ITEM.KMP)
  STRING_  (DESCRIPTION,50)
  STRING   (STATUS,8)
  INT_     (NOELEMENTS)
  DOUBLE_  (DENSITY)
END_TABLE


The problem is that the code crashes if in the S_type structure there are numerical types, if they are just strings the code runs perfectly.
Is there a way to force some kind of "automatic" conversion from String to the correct type?
Thanks,
gio
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Doubt about container
Next Topic: [SOLVED] Vector Bug
Goto Forum:
  


Current Time: Sat Apr 20 15:24:14 CEST 2024

Total time taken to generate the page: 0.01824 seconds