virtual void init() { TiXmlDocument xml = xml::open( getSourceFile() ); const TiXmlElement& root = *xml.RootElement(); const std::string element = getElementType(); const TiXmlNode * it = nullptr; while ( ( it = root.IterateChildren( element.c_str(), it ) ) ) { const TiXmlElement& elem = static_cast< const TiXmlElement & >( *it ); std::string id = xml::attribute( elem, "id" ); try { std::unique_ptr< T > entry( new T() ); load( elem, *entry ); m_data.insert( std::make_pair( id, std::move( entry ) ) ); } catch ( std::exception & err ) { Console::singleton() << con::setcerr << "Error loading \"" << id << "\" to " << getDatabaseName() << ": " << err.what() << con::endl; } } }
void cQTMySQLConnection::setDatabaseName( const QString &p_qsDB ) throw() /* This function sets the Database Name for the MySQL database access. * If the database is already open, it will be closed first. */ { if( getDatabaseName() != p_qsDB ) { close(); m_poDB->setDatabaseName( p_qsDB ); } }
/* public native void enableSqlProfiling(); */ static void enableSqlProfiling(JNIEnv* env, jobject object, jstring databaseName, jshort connType) { sqlite3 * handle = (sqlite3 *)env->GetIntField(object, offset_db_handle); sqlite3_profile(handle, &sqlProfile, (void *)getDatabaseName(env, handle, databaseName, connType)); }
/* public native void enableSqlTracing(); */ static void enableSqlTracing(JNIEnv* env, jobject object, jstring databaseName) { sqlite3 * handle = (sqlite3 *)env->GetIntField(object, offset_db_handle); sqlite3_trace(handle, &sqlTrace, (void *)getDatabaseName(env, handle, databaseName)); }
void DbSQLiteWidget::saveData(){ DatabaseSQLite *db = dynamic_cast<DatabaseSQLite*>(dialog->db.data()); if(db){ db->setDatabaseName(getDatabaseName()); } }