if (database_.open()) { if (!database_.driver()->subscribeToNotification("TEST")) { } else { } connect(database_.driver(), SIGNAL(notification(QString)), SLOT(_onNotification(QString))); }
C++ (Qt)IBPP::Database m_db; void connectDB(){ try { m_db = IBPP::DatabaseFactory(m_host.toStdString(), m_name.toStdString(), m_user.toStdString(), m_password.toStdString()); m_db->Connect(); } catch (IBPP::Exception &e) { }} bool executeQuery(QString *query){ try { IBPP::Transaction tr = IBPP::TransactionFactory(m_db); tr->Start(); IBPP::Statement st = IBPP::StatementFactory(m_db, tr); try { st->Prepare(query->toStdString()); st->Execute(); tr->Commit(); return true; } catch(IBPP::Exception &e) { tr->Rollback(); throw; } } catch(IBPP::Exception &e) { return false; }}