Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Apr 2003 14:54:27 +0200
From:      =?iso-8859-1?Q?Stephan_M=F6ck?= <s.moeck@gmx.de>
To:        <freebsd-current@freebsd.org>
Subject:   DB3 problem with put
Message-ID:  <AHEFKCLHAGCACGDEMFLPGELGCBAA.s.moeck@gmx.de>

next in thread | raw e-mail | index | archive | help
I'm using DB3 to store file informationen. The key is the directory name and
the value is the inode number. At runtime I recieve the following error
message frome the database. Can anybody help me with this problem?

key:   /test   value:   16791
DB->put: DB_KEYEXIST: Key/data pair already exists		//should be 	/test/file
DB->put: DB_KEYEXIST: Key/data pair already exists		//should be
/test/textfile
DB->put: DB_KEYEXIST: Key/data pair already exists		// ...
DB->put: DB_KEYEXIST: Key/data pair already exists
DB->put: DB_KEYEXIST: Key/data pair already exists
DB->put: DB_KEYEXIST: Key/data pair already exists


void add_database(char *sub)
{
		memset(&key, 0, sizeof(key));
		memset(&data, 0, sizeof(data));

		key.data = sub;
		key.size = sizeof(sub);
		data.data = statbuf.st_ino;				//inode number from the stat() call
		key.size = sizeof(statbuf.st_ino);

		if ((ret = dbp1->put(dbp1, NULL, &key, &data, DB_NOOVERWRITE)) == 0)
		{
			printf("key:   %s   value:   %d\n", (char *)key.data,data.data);
		}
		else
		{
			dbp1->err(dbp1, ret, "DB->put");
		}
}


The calling function:

char *dir;
...
add_database(dir);
....




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AHEFKCLHAGCACGDEMFLPGELGCBAA.s.moeck>