0

Hi Folks

If one of you gurus out there can resolve this issue, I promise to have your babies. I am lost right now. So here is the problem:

The std::map in VC98 seems to be playing up. Below is the test code used to verify my Sql class:

I call test05(), create an instance of IntTypeAnyMap ( typedef std::map<int,ICSCommonUtils::TypeAny> IntTypeAnyMap; )

.. stick some values inside it, then call test06(), passing in the structure and where the values are streamed out. This works fine. However when I then call another method ( Sql::testing ) passing in the SAME structure, the map entries seems to get corrupted ( missing values etc ). The only difference between passing in the structure from test05 -> test06 ( where the contents of the map are correctly streamed ) AND test06->Sql::testing ( where the values are corrupted ) is that Sql is in another library.

Bizarre - Would anyone out there have the answer? After all the 'Answer is out there'

Thanks in advance.

//*************************************************************
    // Method Name      : test05
    // Description      : see header for details
    //*************************************************************
    void Sql_UnitTest::test05()
    {
        string txt="To verify the 'execute' interface for procedure calls";
        
        IntTypeAnyMap inParams;
                
        // Set up the input params
        TypeAny any1((long)100);
        inParams.insert(std::make_pair(4,any1));
                
        // Set up the output params
        IntTypeAnyMap outParams;
        TypeAny any2(string("any"));
        TypeAny any3(string("any"));
        TypeAny any4((int)0);
            
        outParams.insert(std::make_pair((int)1, any2));
        outParams.insert(std::make_pair((int)2, any3));
        outParams.insert(std::make_pair((int)3, any4));                
             
        Sql sql("");
        //sql.execute("dbms_alert.waitany",4,inParams,outParams);        
        test06(outParams);
        report("");
    }        
    
    //*************************************************************
    // Method Name      : test06
    // Description      : see header for details
    //*************************************************************    
    void Sql_UnitTest::test06(const IntTypeAnyMap& params)
    {
        IntTypeAnyMap::const_iterator itr;        

        ICSCommonUtils::Logger::getInfoLogger()  << "size of params=" 
                                                 << params.size() 
                                                 << ENDL;
        
        //  Values stream correctly :-)
        for(itr=params.begin(); itr != params.end(); ++itr)
        {
            int index = itr->first;                
            TypeAny any = itr->second;
            ICSCommonUtils::Logger::getCriticalLogger()<< "index="<<index<< ENDL;
            ICSCommonUtils::Logger::getCriticalLogger()<< any << ENDL;
        }  
        
        Sql sql("");
        sql.testing(params);
    } 

    //*************************************************************
    // Method Name      : testing
    // Description      : see header for details
    //*************************************************************
    void Sql::testing(const IntTypeAnyMap& params)
    {
        ICSCommonUtils::Logger::getInfoLogger()  
                        <<ENT<<"Sql::testing"<< ENDL;
        
        IntTypeAnyMap::const_iterator itr;        

        ICSCommonUtils::Logger::getInfoLogger()  << "size of params=" 
                                                 << params.size() 
                                                 << ENDL;

        // Hmmm.....values seems to be corrupted !!! :-(
        for(itr=params.begin(); itr != params.end(); ++itr)
        {
            int index = itr->first;                
            TypeAny any = itr->second;
            ICSCommonUtils::Logger::getCriticalLogger()<< "index="<<index<< ENDL;
            ICSCommonUtils::Logger::getCriticalLogger()<< any << ENDL;
        }        
    }
2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by Ancient Dragon
0

>> promise to have your babies
OMG you are desperate aren't you :)

>>The std::map in VC98 seems to be playing up
Have you tried compiling and running with more recent compiler? That compiler is extremely old. Download VC++ 2008 Express and test your program.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.