TDB_FETCH(3)

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

πŸ’– TDB_FETCH(3) πŸ’–

okay bestie, welcome to tdb_fetch β€” it's a section 3 manual page from the Linux Programmer's Manual, and it's literally the "grab me that one record" function for a tdb database. no cap.


✨ NAME ✨

tdb_fetch β€” fetch a record from a tdb database πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <tdb.h>

TDB_DATA tdb_fetch(TDB_CONTEXT *tdb, TDB_DATA key);

🌸 DESCRIPTION 🌸

So the whole vibe here: you want a record out of the tdb database, and you find it by its key. That key is just a lump of data, and it's what the database uses as the index β€” like a little name tag so it knows which record you're talking about. 🫢

The TDB_DATA structure gets used for both the key and the return value, and it is defined as:

typedef struct {
     char *dptr;
     size_t dsize;
} TDB_DATA;

that's it, that's the whole struct. iconic. πŸ‘‘


⭐ RETURN VALUE ⭐

If the call succeeds, you get a TDB_DATA structure back with the dptr structure filled in. πŸŽ‰

If the call fails, dptr gets set to NULL. πŸ’€

NOTE: the caller is responsible for freeing the data pointed to by dptr. no really β€” that memory is yours now, bestie. free it. don't just leave it there. 😭

πŸ‘‘ AUTHORS πŸ‘‘

  • Software: Andrew Tridgell <tridge@linuxcare.com> and Luke Kenneth Casson Leighton
  • Man page: Ben Woodard <ben@valinux.com>

🌈 SEE ALSO 🌈


and that's the whole page, fr fr πŸ’… this one came from Samba, dated Aug 16, 2000, and it lives at TDB_FETCH(3). mwah, go free your dptr. πŸ¦‹βœ¨