Overview
Features
Download
Documentation
Community
Add-Ons & Services

POCO compiler compatibility

Please post support and help requests here.

POCO compiler compatibility

Postby CodeHugger » 14 Jul 2014, 23:33

PROBLEM:
When I compile my application using GCC 4.1.2 (2007) it works fine. When I compile using the more recent 4.9.0 (2014), it also compiles but will not function properly. Both compilers will compile and link the program without error. The application hangs when it attempts to execute the long SQL statement listed at the bottom of this post. The exact line of code that hangs-up is the following POCO command:

Code: Select all
select->execute( );


And the entire POCO function containing this command....

Code: Select all
std::auto_ptr<RecordSet> queryDatabase(std::string sql)
{
    // Local variable   
    Statement* select;

    try
    {
        // Registers the ODBC connector     
        initConnector();

        // Debug output
        dout << "Database in use: " << DATABASE << std::endl;

        // Connection string
        std::string con;
        Poco::format(con, "DRIVER=freeTDS;SERVER=%s;Port=1433;DATABASE=%s;TDS_Version=8.0;Uid=CRA_user;Pwd=#########", DB_HOST, DATABASE);

        // Establish session with connection string       
        Session ses("ODBC", con);     

        // RecordSet destructor requires this be dynamically allocated     
        select = new Statement(ses);       

        // load SQL string     
        select->operator <<(sql);       

        // execute query     
        select->execute();      //  Execution hangs here..         
    }

    catch (Poco::Exception& exc)
    {
        // DEBUG output 
        dout << exc.displayText() << std::endl; 

        // caught in main()   
        throw std::runtime_error("*** POCO ERROR *** from queryDatabase(sql)");
    }

    // Place data into a record set and assign to a smart pointer
    std::auto_ptr<RecordSet> rsp(new Poco::Data::RecordSet(*select));

    // Unregisters the ODBC connector
    shutdownConnector();

    return rsp;
 
} // end queryDatabase(std::string sql)

By 'hang-up' I mean that it does not throw an error or crash my program, it simply and silently stops execution at this point. The application runs as a Linux daemon and Linux reports the daemon as still running. The only change to my Makefile is that I add -std=c++98 when using the newer compiler. My other (unchanged) compiler flags are as follows:
CPFLAGS: -c -Wall -Wno-unused
LDFLAGS: -L/usr/local/lib -Wl,-Bstatic -lPocoDataODBC -lPocoData -lPocoFoundation -Wl,-Bdynamic -lodbc

Here is the long SQL statement:
SELECT CraServices.bit_value, CraServices.ip_addr_int_v4, CraServices.ip_addr_int_CRA, CraServices.ip_addr_str_v4, CraServices.ip_addr_str_CRA, CraServices.blocked, CraServices.portRange, CraServices.udp, CONVERT(float, CraServices.statusDTG), CraServices.status, CraStatusMaster.Services FROM CraServices INNER JOIN CraStatusMaster ON CraServices.ip_addr_int_CRA=CraStatusMaster.CraIP_int WHERE CraServices.ip_addr_str_CRA = '555.55.55.5'

Your thoughts would be greatly appreciated. I would like to solve this so that I don't have to keep two versions of GCC on my box.

Thank you,
CodeHugger
 
Posts: 3
Joined: 20 Oct 2013, 04:47

Return to Support

Who is online

Users browsing this forum: No registered users and 2 guests

cron