LDB(3)

✨ NAME ✨

ldb β€” a light-weight database library πŸ’…

okay bestie, buckle up, because this one is literally the moment a whole database library gets introduced to you and honestly? she's iconic.


🌈 SYNOPSIS 🌈

#include <ldb.h>

that's it. that's the whole vibe. one include and you're in 🫢


πŸ’– DESCRIPTION πŸ’–

ldb is a light weight embedded database library and API. With a programming interface that is very similar to LDAP, ldb can store its data either in a tdb(3) database or in a real LDAP database. two options, zero drama ✨

when you're using it with the tdb backend, ldb does not require any database daemon. nope, none, she's independent πŸ’… instead, ldb function calls are processed immediately by the ldb library, which does IO directly on the database, while allowing multiple readers/writers using operating system byte range locks. and the way that gives you an API with very low overheads β€” often resulting in speeds of more than 10x what can be achieved with a more traditional LDAP architecture. ten times. TEN. that's not a glow-up, that's a glow-up 🌟

in a taxonomy of databases, ldb would sit half way between key/value pair databases (such as berkeley db or tdb) and a full LDAP database. like, she's in her in-between era and she's thriving. with a structured attribute oriented API like LDAP and good indexing capabilities, ldb can be used for quite sophisticated applications that need a light weight database, without the administrative overhead of a full LDAP installation. sophisticated and low-maintenance, the dream fr fr 😌

included with ldb are a number of useful command line tools for manipulating a ldb database. these tools are similar in style to the equivalent ldap command line tools πŸ‘‘

in its default mode of operation with a tdb backend, ldb can also be seen as a "schema-less LDAP". by default ldb does not require a schema, which greatly reduces the complexity of getting started with ldb databases. no schema, no stress, no 47-page config file, we love to see it πŸŽ€ as the complexity of you application grows you can take advantage of some of the optional schema-like attributes that ldb offers, or you can migrate to using the full LDAP api while keeping your exiting ldb code. (yes, "exiting" β€” that's the original's typo, not mine, and I will not be correcting her, she's doing great πŸ₯°) so you can level up whenever, and your existing code comes with you. no cap.

if you are new to ldb, then I suggest starting with the manual pages for ldbsearch(1) and ldbedit(1), and experimenting with a local database. then I suggest you look at the ldb_connect(3) and ldb_search(3) manual pages. that's the starter pack bestie, go play 🌸


πŸ› οΈ TOOLS πŸ› οΈ

the little command-line besties that come with her:

  • ldbsearch(1) β€” command line ldb search utility πŸ”
  • ldbedit(1) β€” edit all or part of a ldb database using your favourite editor ✏️
  • ldbadd(1) β€” add records to a ldb database using LDIF formatted input βž•
  • ldbdel(1) β€” delete records from a ldb database πŸ—‘οΈ
  • ldbmodify(1) β€” modify records in a ldb database using LDIF formatted input πŸ”§

πŸ’… FUNCTIONS πŸ’…

the whole function family, and yes, every single one of them is here, I'm not skipping a single cousin at this reunion:

  • ldb_connect(3) β€” connect to a ldb backend πŸ”Œ
  • ldb_search(3) β€” perform a database search πŸ”
  • ldb_add(3) β€” add a record to the database βž•
  • ldb_delete(3) β€” delete a record from the database πŸ—‘οΈ
  • ldb_modify(3) β€” modify a record in the database πŸ”§
  • ldb_errstring(3) β€” retrieve extended error information from the last operation 🚨
  • ldb_ldif_write(3) β€” write a LDIF formatted message πŸ“
  • ldb_ldif_write_file(3) β€” write a LDIF formatted message to a file πŸ“
  • ldb_ldif_read(3) β€” read a LDIF formatted message πŸ“–
  • ldb_ldif_read_free(3) β€” free the result of a ldb_ldif_read() 🧹
  • ldb_ldif_read_file(3) β€” read a LDIF message from a file πŸ“‚
  • ldb_ldif_read_string(3) β€” read a LDIF message from a string 🧡
  • ldb_msg_find_element(3) β€” find an element in a ldb_message πŸ”Ž
  • ldb_val_equal_exact(3) β€” compare two ldb_val structures βš–οΈ
  • ldb_msg_find_val(3) β€” find an element by value πŸ’Ž
  • ldb_msg_add_empty(3) β€” add an empty message element to a ldb_message πŸ«™
  • ldb_msg_add(3) β€” add a non-empty message element to a ldb_message πŸ“¦
  • ldb_msg_element_compare(3) β€” compare two ldb_message_element structures πŸ†š
  • ldb_msg_find_int(3) β€” return an integer value from a ldb_message πŸ”’
  • ldb_msg_find_uint(3) β€” return an unsigned integer value from a ldb_message πŸ”’
  • ldb_msg_find_double(3) β€” return a double value from a ldb_message πŸ”’
  • ldb_msg_find_string(3) β€” return a string value from a ldb_message πŸ”€
  • ldb_set_alloc(3) β€” set the memory allocation function to be used by ldb 🧠
  • ldb_set_debug(3) β€” set a debug handler to be used by ldb πŸ›
  • ldb_set_debug_stderr(3) β€” set a debug handler for stderr output πŸ–₯️

🌿 ENVIRONMENT VARIABLES 🌿

the ones that change her behaviour behind the scenes:

  • LDB_URL β€” connect to the provided URL (cmdline tools only)
  • LDB_MODULES_PATH β€” path where to load ldb modules from
  • LDB_MODULES_ENABLE_DEEPBIND β€” enable RTLD_DEEPBIND when loading ldb modules

πŸ‘‘ AUTHOR πŸ‘‘

ldb was written by Andrew Tridgell[1]. absolute legend behaviour, we stan πŸ’œ

if you wish to report a problem or make a suggestion then please see the http://ldb.samba.org/ web site for current contact and maintainer information. they want to hear from you, fr fr 🫢

ldb is released under the GNU Lesser General Public License version 2 or later. please see the file COPYING for license details. legal but make it slay πŸ“œβœ¨


πŸ¦‹ NOTES πŸ¦‹

  1. Andrew Tridgell https://www.samba.org/~tridge/

and that's the whole page bestie!! this was LDB 1.1, dated 09/09/2026, from the System Administration tools section of the manual β€” mwah, go forth and query something πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from