From owner-freebsd-database Mon Aug 10 04:45:11 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id EAA27160 for freebsd-database-outgoing; Mon, 10 Aug 1998 04:45:11 -0700 (PDT) (envelope-from owner-freebsd-database@FreeBSD.ORG) Received: from teel.info-noire.com (XP11-1-3-02.interlinx.qc.ca [207.253.79.62]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id EAA27155 for ; Mon, 10 Aug 1998 04:45:07 -0700 (PDT) (envelope-from alex@gel.usherb.ca) Received: from localhost (alex@localhost) by teel.info-noire.com (8.8.8/8.8.8) with SMTP id BAA12487; Mon, 10 Aug 1998 01:07:37 -0400 (EDT) (envelope-from alex@teel.info-noire.com) Date: Mon, 10 Aug 1998 01:07:37 -0400 (EDT) From: Alex Boisvert Reply-To: boia01@gel.usherb.ca To: Marc Tardif cc: freebsd-database@FreeBSD.ORG Subject: Re: db(3) help In-Reply-To: <35CB3BAE.6C24C0FD@cam.org> Message-ID: MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-1258050431-902725657=:11653" Sender: owner-freebsd-database@FreeBSD.ORG Precedence: bulk This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. --0-1258050431-902725657=:11653 Content-Type: TEXT/PLAIN; charset=US-ASCII On Fri, 7 Aug 1998, Marc Tardif wrote: > I'm struggling to understand the db(3) function. I am trying to create a > btree with a key and data, yet btreeop(1) only shows data for the > following program. I'd appreciate any help... really. Salut Marc, The program you supplied is correct. It does create a new entry in the database having the key "key" and data "dat". When you run btreeop(1) without any action argument, it displays only the data portions of the entries in the database. You probably think/expect btreeop(1) to display both the key and data portions. This is (probably) because the database format created/used by btreeop(1) is "mis-documented". Say you create a database with btreeop, something like: % btreeop -C key1 data1 key2 data2 ^D You'll get entries in the database looking like: Entry# Key Data ====== ===== ======= 1 key1 key1 data1 2 key2 key2 data2 As you can see, with btreeop(1) the key part is repeated in the data portion of the entry. I have attached to this email a program which displays both the key and the data portions of a database. Regards, Alex Boisvert --- FreeBSD: Decouvrez la puissance de votre PC! www.freebsd.org --0-1258050431-902725657=:11653 Content-Type: TEXT/PLAIN; charset=US-ASCII; name="dbread.c" Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: I2luY2x1ZGUgPHN5cy9zdGF0Lmg+DQojaW5jbHVkZSA8ZGIuaD4NCiNpbmNs dWRlIDxmY250bC5oPg0KI2luY2x1ZGUgPHN0ZGlvLmg+DQojaW5jbHVkZSA8 c3RkbGliLmg+DQoNCg0KaW50IG1haW4oaW50IGFyZ2MsIGNoYXIqIGFyZ3Zb XSkNCnsNCglEQiAqZGI7DQoJREJUIGRhdGEsIGtleTsNCglpbnQgcmV0Ow0K DQoJaWYgKGFyZ2MgIT0gMikgew0KCQlwcmludGYoIlVzYWdlOiAgZGJyZWFk IDxmaWxlbmFtZT5cbiIpOw0KCX0NCglpZighKGRiID0gZGJvcGVuKGFyZ3Zb MV0sIE9fQ1JFQVR8T19FWExPQ0t8T19SRFdSLA0KCQkJCQkJCQkJIDAsIERC X0JUUkVFLCBOVUxMKSkpIHsNCgkJZXJyKDEsICIlcyIsIGFyZ3ZbMV0pOw0K CX0NCg0KCWtleS5zaXplID0gZGF0YS5zaXplID0gMDsNCglrZXkuZGF0YSA9 IGRhdGEuZGF0YSA9IE5VTEw7DQoNCgl3aGlsZSAoMSkgew0KCQlpZiAoZGIt PnNlcShkYiwgJmtleSwgJmRhdGEsIFJfTkVYVCkgIT0gMCkgew0KCQkJYnJl YWs7DQoJCX0NCgkJcHJpbnRmKCJLZXk6ICVzXG4iLCBrZXkuZGF0YSk7DQoJ ICBwcmludGYoIkRhdGE6ICVzXG4iLCBkYXRhLmRhdGEpOw0KCX0NCg0KCSh2 b2lkKShkYi0+Y2xvc2UpKGRiKTsNCn0NCg== --0-1258050431-902725657=:11653-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-database" in the body of the message