TDB_STORE(3)

πŸ“¦
version 1.4.15+samba4.24.7 Β· 2 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– 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:

  • 0 means success. πŸŽ‰
  • -1 means 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!! πŸŽ€πŸŒˆπŸ’