--- xmlhelp/source/cxxhelp/provider/db.hxx.orig	2006-02-01 18:01:10.000000000 +0100
+++ xmlhelp/source/cxxhelp/provider/db.hxx	2006-02-01 18:01:49.000000000 +0100
@@ -100,6 +100,9 @@
 				  db_malloc_fcn_type app_malloc, 
 				  db_realloc_fcn_type app_realloc,
 				  db_free_fcn_type app_free);
+	    int set_cachesize(u_int32_t gbytes, u_int32_t bytes, int ncache);
+	    int set_flags(u_int32_t flags, int onoff);
+	    int set_lg_bsize(u_int32_t lg_bsize);
     };
   
     class Db : db_internal::Noncopyable 
--- xmlhelp/source/cxxhelp/provider/db.cxx.orig	2006-02-01 18:01:19.000000000 +0100
+++ xmlhelp/source/cxxhelp/provider/db.cxx	2006-02-01 18:01:49.000000000 +0100
@@ -90,6 +90,24 @@
     int err = m_pDBENV->set_alloc(m_pDBENV,app_malloc,app_realloc,app_free);
     return db_internal::check_error(err,"Db::set_alloc");
 }
+
+int DbEnv::set_cachesize(u_int32_t gbytes, u_int32_t bytes, int ncache)
+{
+    int err = m_pDBENV->set_cachesize(m_pDBENV,gbytes,bytes,ncache);
+    return db_internal::check_error(err,"DbEnv::set_cachesize");
+}
+
+int DbEnv::set_flags(u_int32_t flags, int onoff)
+{
+    int err = m_pDBENV->set_flags(m_pDBENV,flags,onoff);
+    return db_internal::check_error(err,"DbEnv::set_flags");
+}
+
+int DbEnv::set_lg_bsize(u_int32_t lg_bsize)
+{
+    int err = m_pDBENV->set_lg_bsize(m_pDBENV,lg_bsize);
+    return db_internal::check_error(err,"DbEnv::set_lg_bsize");
+}
 //----------------------------------------------------------------------------
 
 int Db::set_alloc(   db_malloc_fcn_type app_malloc, 
--- xmlhelp/source/cxxhelp/provider/urlparameter.cxx.orig	2006-02-01 18:01:31.000000000 +0100
+++ xmlhelp/source/cxxhelp/provider/urlparameter.cxx	2006-02-01 18:03:59.000000000 +0100
@@ -370,6 +370,10 @@
 	Dbt key( static_cast< void* >( const_cast< sal_Char* >( keyStr.getStr() ) ),
 			 keyStr.getLength() );
 	Dbt data;
+#if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 3
+	key.set_flags( DB_DBT_MALLOC );
+	data.set_flags( DB_DBT_MALLOC );
+#endif
 	
 	int err = db->get( 0,&key,&data,0 );
 	
--- xmlhelp/source/cxxhelp/provider/databases.cxx.orig	2006-02-01 18:01:40.000000000 +0100
+++ xmlhelp/source/cxxhelp/provider/databases.cxx	2006-02-01 18:55:42.000000000 +0100
@@ -568,18 +568,60 @@
 	
 	if( aPair.second && ! it->second )
 	{
+#if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 3
+		u_int32_t envFlags =
+			DB_CREATE     |  // Create the environment if it does not exist
+			DB_RECOVER    |  // Run normal recovery.
+			DB_INIT_LOCK  |  // Initialize the locking subsystem
+			DB_INIT_LOG   |  // Initialize the logging subsystem
+			DB_INIT_TXN   |  // Initialize the transactional subsystem. This
+			                 // also turns on logging.
+			DB_INIT_MPOOL |  // Initialize the memory pool (in-memory cache)
+			DB_PRIVATE    |  // Region files are not backed by the filesystem.
+			                 // Instead, they are backed by heap memory.
+			DB_THREAD;       // Cause the environment to be free-threaded
+
+		DbEnv* env = new DbEnv( 0 );
+
+		// Specify in-memory logging
+		env->set_flags(DB_LOG_INMEMORY, 1);
+		// Specify the size of the in-memory log buffer.
+		env->set_lg_bsize(512 * 1024);
+		// Specify the size of the in-memory cache
+		env->set_cachesize(0,1024 * 1024,1);
 
+		env->open( NULL,envFlags,0 );
+
+		Db* table = new Db( env,0 );
+#else
 		Db* table = new Db( 0,DB_CXX_NO_EXCEPTIONS );
+#endif
 		
 		rtl::OUString fileNameOU = 
 			getInstallPathAsSystemPath() +
 			key;
 		
 		rtl::OString fileName( fileNameOU.getStr(),fileNameOU.getLength(),osl_getThreadTextEncoding() );
-		
+#if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 3
+		u_int32_t openFlags =
+			DB_THREAD           |
+#ifdef DB_READ_UNCOMMITTED
+			DB_READ_UNCOMMITTED |
+#elif defined(DB_DIRTY_READ)
+			DB_DIRTY_READ       |
+#endif
+			DB_RDONLY           |
+			DB_AUTO_COMMIT;        // Allow auto commit
+
+		if( table->open( 0,fileName.getStr(),0,DB_BTREE,openFlags,0644 ) )
+#else
 		if( table->open( 0,fileName.getStr(),0,DB_BTREE,DB_RDONLY,0644 ) )
+#endif
 		{
 			table->close( 0 );
+#if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 3
+			env->close( 0 );
+#endif
 			delete table;
 			table = 0;
 		}
@@ -727,15 +765,26 @@
 	listId.realloc( id.size() );
 	listAnchor.realloc( id.size() );
 	listTitle.realloc( id.size() );
+#if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 3
+	bool first = true;
+	Dbt key_,data;
+	key_.set_flags( DB_DBT_MALLOC );
+	data.set_flags( DB_DBT_MALLOC );
+#endif
 	for( sal_uInt32 i = 0; i < id.size(); ++i )
 	{
 		listId[i] = id[i];
 		listAnchor[i] = anchor[i];
 
 		rtl::OString idi( id[i].getStr(),id[i].getLength(),RTL_TEXTENCODING_UTF8 );		
+#if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 3
+		key_.set_data( static_cast< void* >( const_cast< sal_Char* >( idi.getStr() ) ) );
+		key_.set_size( idi.getLength() );
+#else
 		Dbt key_( static_cast< void* >( const_cast< sal_Char* >( idi.getStr() ) ),
 				 idi.getLength() );
 		Dbt data;
+#endif
 		if( pDb )
 			pDb->get( 0,&key_,&data,0 );
 		
@@ -745,6 +794,14 @@
 		rtl::OUString title = converter.getTitle();
 		pDatabases->replaceName( title );
 		listTitle[i] = title;
+#if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 3
+		if ( first )
+		{
+			first = false;
+			key_.set_flags( DB_DBT_REALLOC );
+			data.set_flags( DB_DBT_REALLOC );
+		}
+#endif
 	}
 }
 
@@ -789,9 +846,46 @@
 		rtl::OString fileName( fileNameOU.getStr(),
                                fileNameOU.getLength(),
                                osl_getThreadTextEncoding() );
-		
+#if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 3
+		u_int32_t envFlags =
+			DB_CREATE     |  // Create the environment if it does not exist
+			DB_RECOVER    |  // Run normal recovery.
+			DB_INIT_LOCK  |  // Initialize the locking subsystem
+			DB_INIT_LOG   |  // Initialize the logging subsystem
+			DB_INIT_TXN   |  // Initialize the transactional subsystem. This
+			                 // also turns on logging.
+			DB_INIT_MPOOL |  // Initialize the memory pool (in-memory cache)
+			DB_PRIVATE    |  // Region files are not backed by the filesystem.
+			                 // Instead, they are backed by heap memory.
+			DB_THREAD;       // Cause the environment to be free-threaded
+
+		DbEnv* env = new DbEnv( 0 );
+
+		// Specify in-memory logging
+		env->set_flags(DB_LOG_INMEMORY, 1);
+		// Specify the size of the in-memory log buffer.
+		env->set_lg_bsize(512 * 1024);
+		// Specify the size of the in-memory cache
+		env->set_cachesize(0,1024 * 1024,1);
+
+		env->open( NULL,envFlags,0 );
+
+		u_int32_t openFlags =
+			DB_THREAD           |
+#ifdef DB_READ_UNCOMMITTED
+			DB_READ_UNCOMMITTED |
+#elif defined(DB_DIRTY_READ)
+			DB_DIRTY_READ       |
+#endif
+			DB_RDONLY           |
+			DB_AUTO_COMMIT;        // Allow auto commit
+
+		Db table( env,0 );
+		if( 0 == table.open( 0,fileName.getStr(),0,DB_BTREE,openFlags,0644 ) )
+#else
 		Db table(0,DB_CXX_NO_EXCEPTIONS);
 		if( 0 == table.open( 0,fileName.getStr(),0,DB_BTREE,DB_RDONLY,0644 ) )
+#endif
 		{   
 			std::vector<KeywordInfo::KeywordElement> aVector;
 			Db* idmap = getBerkeley( Database,Language );
@@ -834,6 +924,9 @@
             KeywordInfo* info = it->second = new KeywordInfo( aVector );
 		}
 		table.close( 0 );
+#if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 3
+		env->close( 0 );
+#endif
 	}
 	
 	return it->second;
@@ -1077,6 +1170,10 @@
 		rtl::OString id( Id.getStr(),Id.getLength(),RTL_TEXTENCODING_UTF8 );
 		Dbt key( static_cast< void* >( const_cast< sal_Char* >( id.getStr() ) ),id.getLength() );
 		Dbt data;
+#if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 3
+		key.set_flags( DB_DBT_MALLOC );
+		data.set_flags( DB_DBT_MALLOC );
+#endif
 		db->get( 0,&key,&data,0 );
 		int len = data.get_size();
 		const sal_Char* ptr = static_cast<sal_Char*>( data.get_data() );
