Hello,

I habve problems switching databases inside a program This small example gives 
an segmentation fault when switching from en existing connection tom SQLite3:


#include <iostream>
#include <string.h>

#include <tntdb/connection.h>
#include <tntdb/connect.h>
#include <tntdb/statement.h>

int main( int argc, char **argv) {
   std::string line;
   const char* cp;
   tntdb::Connection conn;
   tntdb::Statement st;

   for( int i = 1;; i++) {
      cp = ( i % 2) ?  "sqlite:testdb_2.db" : "postgresql:dbname=test2";
      std::cout << "connecting to " << cp << std::endl;
      conn = tntdb::connect( cp);

      std::cout << "going to prepare statement" << std::endl;
      st = conn.prepare( "UPDATE y SET x = x + 1");
      std::cout << "going to execute statement" << std::endl;
      st.execute();
      std::cout << "FINISHED" << std::endl;

      std::getline( std::cin, line);
      if( line[ 0] == 'q')
         break;
   }
}

Output:
========================
connecting to sqlite:testdb_2.db
going to prepare statement
going to execute statement
FINISHED

connecting to postgresql:dbname=test2
going to prepare statement
going to execute statement
FINISHED

connecting to sqlite:testdb_2.db
going to prepare statement
/bin/bash: Zeile 1: 20902 Speicherzugriffsfehler  xx


Thanks for any help

        Michael


-- 
Dipl. Ing. Michael Tomuschat

Ing.-Büro Tomuschat       Tel.      : 07071-943866
Steinbößstr. 23                Fax     : 07071-943867 (wenn Büro besetzt ist)
72074 Tübingen              E-mail : michael.tomuschat AT t-online.de
------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general

Reply via email to