dbh_update(3)

πŸ“¦ version 5.0.22, in fedora 43, fedora 44

πŸ’Ύ dbh_update(3) β€” straight from the DBHashTables Programmers' Manual, bestie

okay so this is a page from the DBHashTables Programmers' Manual, and it's literally just about pushing your stuff to disk. two functions, both iconic, both doing the "save my work" thing. let's get into it 🫢


✨ NAME ✨

dbh_update, dbh_writeheader β€” write data record or file header to disk

so like, one of them saves a record, the other saves the file header. different jobs, same slay πŸ’…


🌸 SYNOPSIS 🌸

#include <dbh.h>

FILE_POINTER dbh_update (DBHashTable *dbh);
int dbh_writeheader (DBHashTable *dbh);

there she is. include the header, call the function, that's the whole vibe ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so dbh_update will update the current record in memory to the disk based hash. the way that it does this for erased records and unerased records alike?? obsessed. BUT β€” and this is the plot twist πŸŽ€ β€” if an erased record gets updated, it is automatically unerased. like it comes back to life. resurrection era. no cap.

dbh_writeheader will write out the DBHashTable header information. and ngl, it is advisable to call this function immediately after creation of a new DBHashTable to force a buffer flush. like do it right away, don't be out here ghosting your buffer 😭

bestie please call dbh_writeheader right after you make a new DBHashTable. the buffer flush is not gonna happen on its own, fr fr.

⭐ RETURN VALUE ⭐

okay so the return values are giving very different energy:

  • dbh_update β€” returns 0 on error, and the byte offset of loaded record otherwise
  • dbh_writeheader β€” returns 0 if error, 1 otherwise

so for dbh_update, 0 is the bad one (which, yes, is a little chaotic of it πŸ’€), and for dbh_writeheader it's a cute little 0 or 1 situation. know the difference, iykyk.


🌈 SEE ALSO 🌈

go read these next, bestie, they're all part of the family:

  • dbh (0)
  • dbh_set_data (3)
  • dbh_set_key (3)
  • dbh_set_size (3)
  • dbh_set_recordsize (3)
  • dbh_load (3)
  • dbh_sweep (3)

πŸ‘‘ Author πŸ‘‘

Edscott Wilson Garcia <edscott@xfce.org> β€” king behavior, we love to see it πŸ’œ


that's the whole page, and that's on DBHashTables, the DBH manual, dbh_update(3) πŸŽ€βœ¨ thanks for reading, ily, now go flush that buffer πŸ¦‹πŸ’–

πŸ“¦ where this page comes from