Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Aug 1998 01:07:37 -0400 (EDT)
From:      Alex Boisvert <alex@gel.usherb.ca>
To:        Marc Tardif <intmktg@cam.org>
Cc:        freebsd-database@FreeBSD.ORG
Subject:   Re: db(3) help
Message-ID:  <Pine.BSF.3.95q.980810004918.11653A-200000@teel.info-noire.com>
In-Reply-To: <35CB3BAE.6C24C0FD@cam.org>

next in thread | previous in thread | raw e-mail | index | archive | help
  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: <Pine.BSF.3.95q.980810010737.11653B@teel.info-noire.com>
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.95q.980810004918.11653A-200000>