[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    [Patch] Kbabel dbsearchengine support for db 4.1
From:       Piotr Szymanski <djurban () redfox ! pl>
Date:       2003-05-13 23:17:44
[Download RAW message or body]

Hi,
Im attaching a diff adding support for db 4.1 in 
kdesdk/kbabel/kbabeldict/modules/dbsearchengine for HEAD. 
Ok to commit?
-- 
Piotr Szymanski
djurban@redfox.pl

["db-4_1.diff" (text/x-diff)]

Index: configure.in.in
===================================================================
RCS file: /home/kde/kdesdk/kbabel/kbabeldict/modules/dbsearchengine/configure.in.in,v
retrieving revision 1.10
diff -u -r1.10 configure.in.in
--- configure.in.in	12 Mar 2003 17:14:37 -0000	1.10
+++ configure.in.in	13 May 2003 23:10:54 -0000
@@ -29,9 +29,12 @@
 #include <db.h>
 ],
 [
-#if DB_VERSION_MAJOR == 4
+#if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR==0
 DB *db;
 db->open( db, "test.db", NULL, DB_BTREE, DB_CREATE, 0644 );
+#elif DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR==1
+DB *db;
+db->open( db, NULL, "test.db", NULL, DB_BTREE, DB_CREATE, 0644 );
 #else
 error
 #endif
@@ -43,12 +46,15 @@
      #include <db4/db.h>
      ],
      [
-     #if     DB_VERSION_MAJOR == 4
+     #if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR==0
+     DB *db;
+	db->open( db, "test.db", NULL, DB_BTREE, DB_CREATE, 0644 );
+     #elif DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR==1
      DB *db;
-	  db->open( db, "test.db", NULL, DB_BTREE, DB_CREATE, 0644 );
+	db->open( db, NULL, "test.db", NULL, DB_BTREE, DB_CREATE, 0644 );
      #else
      error
-     #endif 
+     #endif
      ],
     kde_cv_berk_database=db4,
     [
@@ -57,13 +63,17 @@
          #include <db.h>
          ],
          [
-         #if     DB_VERSION_MAJOR == 4
-	 DB *db;
+         #if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR==0
+         DB *db;
+         DBC *cursor;
+            db->open( db, "test.db", NULL, DB_BTREE, DB_CREATE, 0644 );
+         #elif DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR==1
+         DB *db;
          DBC *cursor;
-			db->open( db, "test.db", NULL, DB_BTREE, DB_CREATE, 0644 );
+            db->open( db, NULL, "test.db", NULL, DB_BTREE, DB_CREATE, 0644 );
          #else
          error
-         #endif 
+         #endif
          ],
         kde_cv_berk_database=db4-db,        
     kde_cv_berk_database=NO
Index: database.cpp
===================================================================
RCS file: /home/kde/kdesdk/kbabel/kbabeldict/modules/dbsearchengine/database.cpp,v
retrieving revision 1.42
diff -u -r1.42 database.cpp
--- database.cpp	6 May 2003 14:28:51 -0000	1.42
+++ database.cpp	13 May 2003 23:10:56 -0000
@@ -310,8 +310,11 @@
  db_create(&infoDb, 0, 0);
  db_create(&wordDb, 0, 0);
  db_create(&indexDb,0, 0);
-
- ret=db->open(db, transfilename.local8Bit(), 0, DB_BTREE, 0,0644);
+#if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR==0
+  ret=db->open(db,transfilename.local8Bit(), 0, DB_BTREE, 0,0644);
+#elif DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR==1
+  ret=db->open(db, NULL,transfilename.local8Bit(), 0, DB_BTREE, 0,0644);
+#endif
 
  if( ret == DB_OLD_VERSION ) {
     kdDebug(KBABEL_SEARCH) << "Trying upgrade" << endl;
@@ -404,8 +407,12 @@
 	KIO::NetAccess::del( keysfilename );
 	copy_hack( *keysFile.file(), keysfilenameFile );
 	keysFile.unlink();
-
-	ret = db->open(db, transfilename.local8Bit(), 0, DB_BTREE, 0,0644);
+#if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR==0
+        ret = db->open(db,transfilename.local8Bit(), 0, DB_BTREE, 0,0644);
+#elif DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR==1
+        ret = db->open(db, NULL,transfilename.local8Bit(), 0, DB_BTREE, 0,0644);
+#endif
+			
 	if( ret != 0 ) {
 	    kdWarning(KBABEL_SEARCH) << "transFilename database can't be opened." << endl;
 	    kdWarning(KBABEL_SEARCH) << "Please, report this incident and how to reproduce \
it to kbabel@kde.org." << endl; @@ -421,8 +428,12 @@
 // Open catalogs information database
 
 
-
+#if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR==0
 ret=infoDb->open(infoDb, infofilename.local8Bit(), 0, DB_RECNO, 0,0644);
+#elif DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR==1
+ret=infoDb->open(infoDb, NULL, infofilename.local8Bit(), 0, DB_RECNO, 0,0644);
+#endif
+
 if(ret!=0)
  {
   iAmOk=false;
@@ -434,8 +445,11 @@
 
 
 // Words index database
-
-ret=wordDb->open(wordDb, wordsfilename.local8Bit(), 0, DB_BTREE, 0,0644);
+#if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR==0
+  ret=wordDb->open(wordDb, wordsfilename.local8Bit(), 0, DB_BTREE, 0,0644);
+#elif DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR==1
+  ret=wordDb->open(wordDb, NULL,wordsfilename.local8Bit(), 0, DB_BTREE, 0,0644);
+#endif
 if(ret!=0)
  {
   iAmOk=false;
@@ -444,8 +458,12 @@
  }
 
 //Index of keys.
-
+#if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR==0
 ret=indexDb->open(indexDb, keysfilename.local8Bit(), 0, DB_RECNO,0,0644);
+#elif DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR==1
+ret=indexDb->open(indexDb, NULL,keysfilename.local8Bit(), 0, DB_RECNO,0,0644);
+#endif
+
 if(ret!=0)
  {
    iAmOk=false;
@@ -701,7 +719,12 @@
  }
 
 db->set_flags(db, DB_RECNUM);
+#if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR==0
 ret=db->open(db, filename.local8Bit(),0, DB_BTREE, DB_CREATE|DB_EXCL, mode);
+#elif DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR==1
+ret=db->open(db, NULL, filename.local8Bit(),0, DB_BTREE, DB_CREATE|DB_EXCL, mode);
+#endif
+
  if(ret!=0) {
      qDebug("db->open %s %d failed", filename.latin1(), mode);
      iAmOk=false;
@@ -713,7 +736,12 @@
 rename(filename.local8Bit(),filename.local8Bit()+",old");
 
  db_create( &infoDb, 0, 0);
-ret=infoDb->open(infoDb, filename.local8Bit(),0, DB_RECNO, DB_CREATE,mode);
+#if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR==0
+ ret=infoDb->open(infoDb, filename.local8Bit(),0, DB_RECNO, DB_CREATE,mode);
+#elif DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR==1
+ ret=infoDb->open(infoDb, NULL, filename.local8Bit(),0, DB_RECNO, DB_CREATE,mode);
+#endif
+
 if(ret!=0)
  iAmOk=false;
 
@@ -724,7 +752,12 @@
 rename(filename.local8Bit(),filename.local8Bit()+",old");
 
  db_create( &wordDb, 0, 0);
-ret=wordDb->open(wordDb, filename.local8Bit(), 0, DB_BTREE, DB_CREATE,mode);
+#if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR==0
+ ret=wordDb->open(wordDb, filename.local8Bit(), 0, DB_BTREE, DB_CREATE,mode);
+#elif DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR==1
+ ret=wordDb->open(wordDb, NULL,filename.local8Bit(), 0, DB_BTREE, DB_CREATE,mode);
+#endif
+
 if(ret!=0)
  iAmOk=false;
 
@@ -735,7 +768,12 @@
 rename(filename.local8Bit(),filename.local8Bit()+",old");
  
 db_create( &indexDb, 0, 0);
+#if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR==0
 ret=indexDb->open(indexDb, filename.local8Bit(),0, DB_RECNO, DB_CREATE, mode);
+#elif DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR==1
+ret=indexDb->open(indexDb, NULL, filename.local8Bit(),0, DB_RECNO, DB_CREATE, mode);
+#endif
+
 if(ret!=0)
  iAmOk=false;
  



>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic