getColType fails
Brought to you by:
rupper
Hello there,
you did a great job developing the ocicpp api
and I would really like to use it.
Unfortunately one thing prevents me from doing so.
You used a map which has a member find
to retrieve an entry.
Find does return the last element of all in the map
if there is none matching.
So if only one entry is there the one found is the
last and I get no result for getColType :
if(iter!=cols_map.end()) {
By the way this is not the only thing.
You do a loop with comparing to the last element :
while(ci!=binds.end()) {
So you never process the last element, as you
stop bevor !!
So there are several places to look for if you are
continuing usíng maps .
Regards
Bernd Hoehl
bhoehl@linotype.com
Logged In: YES
user_id=755230
I tracked the code and tested the following code on linux and windows
:
#include <iostream>
#include <string>
#include
<map>
using namespace std;
map<string,int>
cols_map; /* For get<Type>("colName") methods */
void
main()
{
cols_map["hugo"]=2;
map<string,int>::const_iterator
iter=cols_map.find("hugo2");
printf("iter:%d\n", iter-
>second) ;
}
On Windows this runs ok ( iter-
>seond is undefined - end() ) .
On Linux it fails, showing that it found it (
iter->second = 0 as result - this is wrong )
There seams to be a problem
with the STL::map library on linux when using strings as key.
The
trouble is using int as key works.
Which version of the libstdc++ are
you using and does this
problem occur too
?
Regards
Bernd
Logged In: NO
Sorry for the trouble,
I used lowercases instead of uppercase for
retrieving column types.
Now it seams to work.
Please close this message
Regards
Bernd