TDB_STORE(3)
π TDB_STORE β okay bestie, let's file this away π
This is the tdb_store(3) page, straight out of the Linux Programmer's Manual πΈ and she is so ready to teach you how to stash a record in a tdb database. No cap. Let's go. β¨
π NAME π
tdb_store β store a record in a tdb database. That's it, that's the whole job, and she does it flawlessly. π
β¨ SYNOPSIS β¨
#include <tdb.h>
int tdb_store(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA record, int flag);
Yes queen, four arguments, one function, zero drama. π«Ά
π DESCRIPTION π
So the vibe is this: you've got a lump of data, and it's pointed to by record, and you want it living inside the tdb database under the index pointed to by key. That's the whole plot. π¦
And the TDB_DATA structure β the one that both key and record are made of β is literally defined as:
typedef struct {
char *dptr;
size_t dsize;
} TDB_DATA;
A pointer and a size. Minimal. Iconic. She ate. π
Now here's the part you actually need to pay attention to, bestie: that flag argument? It's the whole personality of the call. It changes how tdb_store behaves, and it can be any one of these three values. Pick carefully, fr fr. π
TDB_REPLACEβ insert a record, creating a new one or overwriting an existing one. She's flexible like that. Whatever's already there? Gone. Replaced. Slay. πTDB_INSERTβ insert a new entry, but she refuses to overwrite an existing entry. New only. No touchy the old stuff. πTDB_MODIFYβ replace an existing record with a new one. And this one will fail if a record does not already exist. So like, she needs something to modify. Don't come to her empty-handed. π
β RETURN VALUE β
Super simple, super clean:
0means success. π-1means failure. π
That's it. Binary. No in-between. Main character energy only. π
π AUTHORS π
Give credit where credit is due, always:
- Software: Andrew Tridgell
<tridge@linuxcare.com>and Luke Kenneth Casson Leighton - Man page: Ben Woodard
<ben@valinux.com>
Legends, honestly. We thank them for their service. π«Ά
πΈ SEE ALSO πΈ
Go read those too, bestie, knowledge is free and it's giving β¨
And that's the whole page!! This one came from Samba, dated Aug 16, 2000 β so like, vintage, but the girlies still run it. π Byeee, go store something responsibly!! πππ
π¦ where this page comes from
- debian trixie: libtdb-dev 2:1.4.13+samba4.22.10+dfsg-0+deb13u2 Β· GPL-3.0-or-later
- debian trixie: libtdb-dev 2:1.4.13+samba4.22.11+dfsg-0+deb13u1 Β· GPL-3.0-or-later
- ubuntu questing: libtdb-dev 2:1.4.13+samba4.22.3+dfsg-4ubuntu2
- ubuntu questing: libtdb-dev 2:1.4.13+samba4.22.3+dfsg-4ubuntu2.4
- ubuntu resolute: libtdb-dev 2:1.4.14+samba4.23.6+dfsg-1ubuntu2 Β· GPL-3.0-or-later
- ubuntu resolute: libtdb-dev 2:1.4.14+samba4.23.6+dfsg-1ubuntu2.2 Β· GPL-3.0-or-later
- ubuntu stonking: libtdb-dev 2:1.4.15+samba4.24.7+dfsg-1ubuntu1 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms