• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Query object seg. faults on destruction...(ignore earlier posts please)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Query object seg. faults on destruction...(ignore earlier posts please)


  • Subject: Query object seg. faults on destruction...(ignore earlier posts please)
  • From: Graham Reitz <email@hidden>
  • Date: Sun, 25 Nov 2007 13:33:21 -0600

With the code (below) the Query object segmentation faults on its destructor call.  Any help would be greatly appreciated.  I am quite stuck.  The same code appears to compile and run and a Windows XP machine using VS2005.  I am pretty sure it worked on Mac OS X 10.4.x (Tiger) but not certain.

kindly,
graham


OS:  
Mac OS X 10.5.1 (Leopard)


Linker flags : 
-lz /usr/local/mysql/lib/mysql/libmysqlclient_r.a -lmysqlpp


Other notes:
mysql_client was built from scratch, although I get the same error with the prebuilt libraries.


Output:
Attempting to connect to the database...connected to the database
Query created: select client_id from clients where client_user_name ='tacadmin' and client_password ='tacadmin123'
Segmentation fault


Backtrace:
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0xfffffffc
0x92b7f6e1 in __gnu_cxx::__exchange_and_add ()
(gdb) backtrace
#0  0x92b7f6e1 in __gnu_cxx::__exchange_and_add ()
#1  0x92b6f070 in std::string::_Rep::_M_dispose ()
#2  0x92b704ab in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string ()
#3  0x00002ca8 in std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::~basic_stringbuf (this=0xbffff794) at iosfwd:71
#4  0x00002d13 in std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::~basic_stringbuf (this=0xbffff794) at iosfwd:71
#5  0x00004351 in mysqlpp::Query::~Query (this=0xbffff6f8) at query.h:131
#6  0x00001c2f in main (argc=1, argv=0xbffff8d4) at /Users/grahamreitz/Development/mysqlpp_test/main.cpp:54


Code:
#include <iostream>
#include <string>
#include <mysql++.h>

using namespace std;
using namespace mysqlpp;

int main (int argc, char * const argv[]) 
{
    string database_name = "db_rev_4";
    string ip_address = "x.x.x.x";
    string username = "username";
    string password = "password";
    string error_msg;

    

    try

    {

        Result client_id_result;

        

        cout << "Attempting to connect to the database...";
        Connection m_connection(database_name.c_str(),
                                ip_address.c_str(),
                                username.c_str(),
                                password.c_str(),
                                3306,
                                false,
                                15);

        

        cout << "connected to the database" << endl;

        

        Query client_id_query = m_connection.query();

        

        client_id_query << 
            "select client_id from clients where client_user_name =" 
            << quote_only << username << " and client_password ="
            << quote_only << password;

        

        cout << "Query created: ";
        cout << client_id_query.preview() << endl;

        

        m_connection.close();
    }
    catch (exception &e)
    {
        cout << "exception occurred..." << endl;
        error_msg = e.what();
        cout << error_msg;
    }
    catch (...)
    {
        error_msg = "Unknown exception";
        cout << error_msg << endl;
    }

    

    return 0;
}

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Query object seg. faults on destruction...(wrong forum, sorry)
      • From: Graham Reitz <email@hidden>
  • Prev by Date: Re: Is XCode 3 SCM more dysfunctional than ever or am I doing something wrong?
  • Next by Date: Re: Interface Builder - Classes query
  • Previous by thread: Re: Recover files deleted by Xcode
  • Next by thread: Re: Query object seg. faults on destruction...(wrong forum, sorry)
  • Index(es):
    • Date
    • Thread