| 1 | '\" t | 
|---|
| 2 | .\"     Title: ldb | 
|---|
| 3 | .\"    Author: [see the "Author" section] | 
|---|
| 4 | .\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/> | 
|---|
| 5 | .\"      Date: 08/02/2011 | 
|---|
| 6 | .\"    Manual: C Library Functions | 
|---|
| 7 | .\"    Source: Samba 3.5 | 
|---|
| 8 | .\"  Language: English | 
|---|
| 9 | .\" | 
|---|
| 10 | .TH "LDB" "3" "08/02/2011" "Samba 3\&.5" "C Library Functions" | 
|---|
| 11 | .\" ----------------------------------------------------------------- | 
|---|
| 12 | .\" * set default formatting | 
|---|
| 13 | .\" ----------------------------------------------------------------- | 
|---|
| 14 | .\" disable hyphenation | 
|---|
| 15 | .nh | 
|---|
| 16 | .\" disable justification (adjust text to left margin only) | 
|---|
| 17 | .ad l | 
|---|
| 18 | .\" ----------------------------------------------------------------- | 
|---|
| 19 | .\" * MAIN CONTENT STARTS HERE * | 
|---|
| 20 | .\" ----------------------------------------------------------------- | 
|---|
| 21 | .SH "NAME" | 
|---|
| 22 | ldb \- A light\-weight database library | 
|---|
| 23 | .SH "SYNOPSIS" | 
|---|
| 24 | .sp | 
|---|
| 25 | .nf | 
|---|
| 26 | #include <ldb\&.h> | 
|---|
| 27 | .fi | 
|---|
| 28 | .SH "DESCRIPTION" | 
|---|
| 29 | .PP | 
|---|
| 30 | 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\&. | 
|---|
| 31 | .PP | 
|---|
| 32 | When used with the tdb backend ldb does not require any database daemon\&. 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\&. This leads to an API with very low overheads, often resulting in speeds of more than 10x what can be achieved with a more traditional LDAP architecture\&. | 
|---|
| 33 | .PP | 
|---|
| 34 | In a taxonomy of databases ldb would sit half way between key/value pair databases (such as berkley db or tdb) and a full LDAP database\&. 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\&. | 
|---|
| 35 | .PP | 
|---|
| 36 | 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\&. | 
|---|
| 37 | .PP | 
|---|
| 38 | 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\&. 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\&. | 
|---|
| 39 | .PP | 
|---|
| 40 | 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\&. | 
|---|
| 41 | .SH "TOOLS" | 
|---|
| 42 | .sp | 
|---|
| 43 | .RS 4 | 
|---|
| 44 | .ie n \{\ | 
|---|
| 45 | \h'-04'\(bu\h'+03'\c | 
|---|
| 46 | .\} | 
|---|
| 47 | .el \{\ | 
|---|
| 48 | .sp -1 | 
|---|
| 49 | .IP \(bu 2.3 | 
|---|
| 50 | .\} | 
|---|
| 51 |  | 
|---|
| 52 | ldbsearch(1) | 
|---|
| 53 | \- command line ldb search utility | 
|---|
| 54 | .RE | 
|---|
| 55 | .sp | 
|---|
| 56 | .RS 4 | 
|---|
| 57 | .ie n \{\ | 
|---|
| 58 | \h'-04'\(bu\h'+03'\c | 
|---|
| 59 | .\} | 
|---|
| 60 | .el \{\ | 
|---|
| 61 | .sp -1 | 
|---|
| 62 | .IP \(bu 2.3 | 
|---|
| 63 | .\} | 
|---|
| 64 |  | 
|---|
| 65 | ldbedit(1) | 
|---|
| 66 | \- edit all or part of a ldb database using your favourite editor | 
|---|
| 67 | .RE | 
|---|
| 68 | .sp | 
|---|
| 69 | .RS 4 | 
|---|
| 70 | .ie n \{\ | 
|---|
| 71 | \h'-04'\(bu\h'+03'\c | 
|---|
| 72 | .\} | 
|---|
| 73 | .el \{\ | 
|---|
| 74 | .sp -1 | 
|---|
| 75 | .IP \(bu 2.3 | 
|---|
| 76 | .\} | 
|---|
| 77 |  | 
|---|
| 78 | ldbadd(1) | 
|---|
| 79 | \- add records to a ldb database using LDIF formatted input | 
|---|
| 80 | .RE | 
|---|
| 81 | .sp | 
|---|
| 82 | .RS 4 | 
|---|
| 83 | .ie n \{\ | 
|---|
| 84 | \h'-04'\(bu\h'+03'\c | 
|---|
| 85 | .\} | 
|---|
| 86 | .el \{\ | 
|---|
| 87 | .sp -1 | 
|---|
| 88 | .IP \(bu 2.3 | 
|---|
| 89 | .\} | 
|---|
| 90 |  | 
|---|
| 91 | ldbdel(1) | 
|---|
| 92 | \- delete records from a ldb database | 
|---|
| 93 | .RE | 
|---|
| 94 | .sp | 
|---|
| 95 | .RS 4 | 
|---|
| 96 | .ie n \{\ | 
|---|
| 97 | \h'-04'\(bu\h'+03'\c | 
|---|
| 98 | .\} | 
|---|
| 99 | .el \{\ | 
|---|
| 100 | .sp -1 | 
|---|
| 101 | .IP \(bu 2.3 | 
|---|
| 102 | .\} | 
|---|
| 103 |  | 
|---|
| 104 | ldbmodify(1) | 
|---|
| 105 | \- modify records in a ldb database using LDIF formatted input | 
|---|
| 106 | .SH "FUNCTIONS" | 
|---|
| 107 | .sp | 
|---|
| 108 | .RS 4 | 
|---|
| 109 | .ie n \{\ | 
|---|
| 110 | \h'-04'\(bu\h'+03'\c | 
|---|
| 111 | .\} | 
|---|
| 112 | .el \{\ | 
|---|
| 113 | .sp -1 | 
|---|
| 114 | .IP \(bu 2.3 | 
|---|
| 115 | .\} | 
|---|
| 116 |  | 
|---|
| 117 | \fBldb_connect(3)\fR | 
|---|
| 118 | \- connect to a ldb backend | 
|---|
| 119 | .RE | 
|---|
| 120 | .sp | 
|---|
| 121 | .RS 4 | 
|---|
| 122 | .ie n \{\ | 
|---|
| 123 | \h'-04'\(bu\h'+03'\c | 
|---|
| 124 | .\} | 
|---|
| 125 | .el \{\ | 
|---|
| 126 | .sp -1 | 
|---|
| 127 | .IP \(bu 2.3 | 
|---|
| 128 | .\} | 
|---|
| 129 |  | 
|---|
| 130 | \fBldb_search(3)\fR | 
|---|
| 131 | \- perform a database search | 
|---|
| 132 | .RE | 
|---|
| 133 | .sp | 
|---|
| 134 | .RS 4 | 
|---|
| 135 | .ie n \{\ | 
|---|
| 136 | \h'-04'\(bu\h'+03'\c | 
|---|
| 137 | .\} | 
|---|
| 138 | .el \{\ | 
|---|
| 139 | .sp -1 | 
|---|
| 140 | .IP \(bu 2.3 | 
|---|
| 141 | .\} | 
|---|
| 142 |  | 
|---|
| 143 | \fBldb_add(3)\fR | 
|---|
| 144 | \- add a record to the database | 
|---|
| 145 | .RE | 
|---|
| 146 | .sp | 
|---|
| 147 | .RS 4 | 
|---|
| 148 | .ie n \{\ | 
|---|
| 149 | \h'-04'\(bu\h'+03'\c | 
|---|
| 150 | .\} | 
|---|
| 151 | .el \{\ | 
|---|
| 152 | .sp -1 | 
|---|
| 153 | .IP \(bu 2.3 | 
|---|
| 154 | .\} | 
|---|
| 155 |  | 
|---|
| 156 | \fBldb_delete(3)\fR | 
|---|
| 157 | \- delete a record from the database | 
|---|
| 158 | .RE | 
|---|
| 159 | .sp | 
|---|
| 160 | .RS 4 | 
|---|
| 161 | .ie n \{\ | 
|---|
| 162 | \h'-04'\(bu\h'+03'\c | 
|---|
| 163 | .\} | 
|---|
| 164 | .el \{\ | 
|---|
| 165 | .sp -1 | 
|---|
| 166 | .IP \(bu 2.3 | 
|---|
| 167 | .\} | 
|---|
| 168 |  | 
|---|
| 169 | \fBldb_modify(3)\fR | 
|---|
| 170 | \- modify a record in the database | 
|---|
| 171 | .RE | 
|---|
| 172 | .sp | 
|---|
| 173 | .RS 4 | 
|---|
| 174 | .ie n \{\ | 
|---|
| 175 | \h'-04'\(bu\h'+03'\c | 
|---|
| 176 | .\} | 
|---|
| 177 | .el \{\ | 
|---|
| 178 | .sp -1 | 
|---|
| 179 | .IP \(bu 2.3 | 
|---|
| 180 | .\} | 
|---|
| 181 |  | 
|---|
| 182 | \fBldb_errstring(3)\fR | 
|---|
| 183 | \- retrieve extended error information from the last operation | 
|---|
| 184 | .RE | 
|---|
| 185 | .sp | 
|---|
| 186 | .RS 4 | 
|---|
| 187 | .ie n \{\ | 
|---|
| 188 | \h'-04'\(bu\h'+03'\c | 
|---|
| 189 | .\} | 
|---|
| 190 | .el \{\ | 
|---|
| 191 | .sp -1 | 
|---|
| 192 | .IP \(bu 2.3 | 
|---|
| 193 | .\} | 
|---|
| 194 |  | 
|---|
| 195 | \fBldb_ldif_write(3)\fR | 
|---|
| 196 | \- write a LDIF formatted message | 
|---|
| 197 | .RE | 
|---|
| 198 | .sp | 
|---|
| 199 | .RS 4 | 
|---|
| 200 | .ie n \{\ | 
|---|
| 201 | \h'-04'\(bu\h'+03'\c | 
|---|
| 202 | .\} | 
|---|
| 203 | .el \{\ | 
|---|
| 204 | .sp -1 | 
|---|
| 205 | .IP \(bu 2.3 | 
|---|
| 206 | .\} | 
|---|
| 207 |  | 
|---|
| 208 | \fBldb_ldif_write_file(3)\fR | 
|---|
| 209 | \- write a LDIF formatted message to a file | 
|---|
| 210 | .RE | 
|---|
| 211 | .sp | 
|---|
| 212 | .RS 4 | 
|---|
| 213 | .ie n \{\ | 
|---|
| 214 | \h'-04'\(bu\h'+03'\c | 
|---|
| 215 | .\} | 
|---|
| 216 | .el \{\ | 
|---|
| 217 | .sp -1 | 
|---|
| 218 | .IP \(bu 2.3 | 
|---|
| 219 | .\} | 
|---|
| 220 |  | 
|---|
| 221 | \fBldb_ldif_read(3)\fR | 
|---|
| 222 | \- read a LDIF formatted message | 
|---|
| 223 | .RE | 
|---|
| 224 | .sp | 
|---|
| 225 | .RS 4 | 
|---|
| 226 | .ie n \{\ | 
|---|
| 227 | \h'-04'\(bu\h'+03'\c | 
|---|
| 228 | .\} | 
|---|
| 229 | .el \{\ | 
|---|
| 230 | .sp -1 | 
|---|
| 231 | .IP \(bu 2.3 | 
|---|
| 232 | .\} | 
|---|
| 233 |  | 
|---|
| 234 | \fBldb_ldif_read_free(3)\fR | 
|---|
| 235 | \- free the result of a ldb_ldif_read() | 
|---|
| 236 | .RE | 
|---|
| 237 | .sp | 
|---|
| 238 | .RS 4 | 
|---|
| 239 | .ie n \{\ | 
|---|
| 240 | \h'-04'\(bu\h'+03'\c | 
|---|
| 241 | .\} | 
|---|
| 242 | .el \{\ | 
|---|
| 243 | .sp -1 | 
|---|
| 244 | .IP \(bu 2.3 | 
|---|
| 245 | .\} | 
|---|
| 246 |  | 
|---|
| 247 | \fBldb_ldif_read_file(3)\fR | 
|---|
| 248 | \- read a LDIF message from a file | 
|---|
| 249 | .RE | 
|---|
| 250 | .sp | 
|---|
| 251 | .RS 4 | 
|---|
| 252 | .ie n \{\ | 
|---|
| 253 | \h'-04'\(bu\h'+03'\c | 
|---|
| 254 | .\} | 
|---|
| 255 | .el \{\ | 
|---|
| 256 | .sp -1 | 
|---|
| 257 | .IP \(bu 2.3 | 
|---|
| 258 | .\} | 
|---|
| 259 |  | 
|---|
| 260 | \fBldb_ldif_read_string(3)\fR | 
|---|
| 261 | \- read a LDIF message from a string | 
|---|
| 262 | .RE | 
|---|
| 263 | .sp | 
|---|
| 264 | .RS 4 | 
|---|
| 265 | .ie n \{\ | 
|---|
| 266 | \h'-04'\(bu\h'+03'\c | 
|---|
| 267 | .\} | 
|---|
| 268 | .el \{\ | 
|---|
| 269 | .sp -1 | 
|---|
| 270 | .IP \(bu 2.3 | 
|---|
| 271 | .\} | 
|---|
| 272 |  | 
|---|
| 273 | \fBldb_msg_find_element(3)\fR | 
|---|
| 274 | \- find an element in a ldb_message | 
|---|
| 275 | .RE | 
|---|
| 276 | .sp | 
|---|
| 277 | .RS 4 | 
|---|
| 278 | .ie n \{\ | 
|---|
| 279 | \h'-04'\(bu\h'+03'\c | 
|---|
| 280 | .\} | 
|---|
| 281 | .el \{\ | 
|---|
| 282 | .sp -1 | 
|---|
| 283 | .IP \(bu 2.3 | 
|---|
| 284 | .\} | 
|---|
| 285 |  | 
|---|
| 286 | \fBldb_val_equal_exact(3)\fR | 
|---|
| 287 | \- compare two ldb_val structures | 
|---|
| 288 | .RE | 
|---|
| 289 | .sp | 
|---|
| 290 | .RS 4 | 
|---|
| 291 | .ie n \{\ | 
|---|
| 292 | \h'-04'\(bu\h'+03'\c | 
|---|
| 293 | .\} | 
|---|
| 294 | .el \{\ | 
|---|
| 295 | .sp -1 | 
|---|
| 296 | .IP \(bu 2.3 | 
|---|
| 297 | .\} | 
|---|
| 298 |  | 
|---|
| 299 | \fBldb_msg_find_val(3)\fR | 
|---|
| 300 | \- find an element by value | 
|---|
| 301 | .RE | 
|---|
| 302 | .sp | 
|---|
| 303 | .RS 4 | 
|---|
| 304 | .ie n \{\ | 
|---|
| 305 | \h'-04'\(bu\h'+03'\c | 
|---|
| 306 | .\} | 
|---|
| 307 | .el \{\ | 
|---|
| 308 | .sp -1 | 
|---|
| 309 | .IP \(bu 2.3 | 
|---|
| 310 | .\} | 
|---|
| 311 |  | 
|---|
| 312 | \fBldb_msg_add_empty(3)\fR | 
|---|
| 313 | \- add an empty message element to a ldb_message | 
|---|
| 314 | .RE | 
|---|
| 315 | .sp | 
|---|
| 316 | .RS 4 | 
|---|
| 317 | .ie n \{\ | 
|---|
| 318 | \h'-04'\(bu\h'+03'\c | 
|---|
| 319 | .\} | 
|---|
| 320 | .el \{\ | 
|---|
| 321 | .sp -1 | 
|---|
| 322 | .IP \(bu 2.3 | 
|---|
| 323 | .\} | 
|---|
| 324 |  | 
|---|
| 325 | \fBldb_msg_add(3)\fR | 
|---|
| 326 | \- add a non\-empty message element to a ldb_message | 
|---|
| 327 | .RE | 
|---|
| 328 | .sp | 
|---|
| 329 | .RS 4 | 
|---|
| 330 | .ie n \{\ | 
|---|
| 331 | \h'-04'\(bu\h'+03'\c | 
|---|
| 332 | .\} | 
|---|
| 333 | .el \{\ | 
|---|
| 334 | .sp -1 | 
|---|
| 335 | .IP \(bu 2.3 | 
|---|
| 336 | .\} | 
|---|
| 337 |  | 
|---|
| 338 | \fBldb_msg_element_compare(3)\fR | 
|---|
| 339 | \- compare two ldb_message_element structures | 
|---|
| 340 | .RE | 
|---|
| 341 | .sp | 
|---|
| 342 | .RS 4 | 
|---|
| 343 | .ie n \{\ | 
|---|
| 344 | \h'-04'\(bu\h'+03'\c | 
|---|
| 345 | .\} | 
|---|
| 346 | .el \{\ | 
|---|
| 347 | .sp -1 | 
|---|
| 348 | .IP \(bu 2.3 | 
|---|
| 349 | .\} | 
|---|
| 350 |  | 
|---|
| 351 | \fBldb_msg_find_int(3)\fR | 
|---|
| 352 | \- return an integer value from a ldb_message | 
|---|
| 353 | .RE | 
|---|
| 354 | .sp | 
|---|
| 355 | .RS 4 | 
|---|
| 356 | .ie n \{\ | 
|---|
| 357 | \h'-04'\(bu\h'+03'\c | 
|---|
| 358 | .\} | 
|---|
| 359 | .el \{\ | 
|---|
| 360 | .sp -1 | 
|---|
| 361 | .IP \(bu 2.3 | 
|---|
| 362 | .\} | 
|---|
| 363 |  | 
|---|
| 364 | \fBldb_msg_find_uint(3)\fR | 
|---|
| 365 | \- return an unsigned integer value from a ldb_message | 
|---|
| 366 | .RE | 
|---|
| 367 | .sp | 
|---|
| 368 | .RS 4 | 
|---|
| 369 | .ie n \{\ | 
|---|
| 370 | \h'-04'\(bu\h'+03'\c | 
|---|
| 371 | .\} | 
|---|
| 372 | .el \{\ | 
|---|
| 373 | .sp -1 | 
|---|
| 374 | .IP \(bu 2.3 | 
|---|
| 375 | .\} | 
|---|
| 376 |  | 
|---|
| 377 | \fBldb_msg_find_double(3)\fR | 
|---|
| 378 | \- return a double value from a ldb_message | 
|---|
| 379 | .RE | 
|---|
| 380 | .sp | 
|---|
| 381 | .RS 4 | 
|---|
| 382 | .ie n \{\ | 
|---|
| 383 | \h'-04'\(bu\h'+03'\c | 
|---|
| 384 | .\} | 
|---|
| 385 | .el \{\ | 
|---|
| 386 | .sp -1 | 
|---|
| 387 | .IP \(bu 2.3 | 
|---|
| 388 | .\} | 
|---|
| 389 |  | 
|---|
| 390 | \fBldb_msg_find_string(3)\fR | 
|---|
| 391 | \- return a string value from a ldb_message | 
|---|
| 392 | .RE | 
|---|
| 393 | .sp | 
|---|
| 394 | .RS 4 | 
|---|
| 395 | .ie n \{\ | 
|---|
| 396 | \h'-04'\(bu\h'+03'\c | 
|---|
| 397 | .\} | 
|---|
| 398 | .el \{\ | 
|---|
| 399 | .sp -1 | 
|---|
| 400 | .IP \(bu 2.3 | 
|---|
| 401 | .\} | 
|---|
| 402 |  | 
|---|
| 403 | \fBldb_set_alloc(3)\fR | 
|---|
| 404 | \- set the memory allocation function to be used by ldb | 
|---|
| 405 | .RE | 
|---|
| 406 | .sp | 
|---|
| 407 | .RS 4 | 
|---|
| 408 | .ie n \{\ | 
|---|
| 409 | \h'-04'\(bu\h'+03'\c | 
|---|
| 410 | .\} | 
|---|
| 411 | .el \{\ | 
|---|
| 412 | .sp -1 | 
|---|
| 413 | .IP \(bu 2.3 | 
|---|
| 414 | .\} | 
|---|
| 415 |  | 
|---|
| 416 | \fBldb_set_debug(3)\fR | 
|---|
| 417 | \- set a debug handler to be used by ldb | 
|---|
| 418 | .RE | 
|---|
| 419 | .sp | 
|---|
| 420 | .RS 4 | 
|---|
| 421 | .ie n \{\ | 
|---|
| 422 | \h'-04'\(bu\h'+03'\c | 
|---|
| 423 | .\} | 
|---|
| 424 | .el \{\ | 
|---|
| 425 | .sp -1 | 
|---|
| 426 | .IP \(bu 2.3 | 
|---|
| 427 | .\} | 
|---|
| 428 |  | 
|---|
| 429 | \fBldb_set_debug_stderr(3)\fR | 
|---|
| 430 | \- set a debug handler for stderr output | 
|---|
| 431 | .SH "AUTHOR" | 
|---|
| 432 | .PP | 
|---|
| 433 | ldb was written by | 
|---|
| 434 | Andrew Tridgell\&. | 
|---|
| 435 | .PP | 
|---|
| 436 | If you wish to report a problem or make a suggestion then please see the | 
|---|
| 437 | : http://ldb.samba.org/ | 
|---|
| 438 | web site for current contact and maintainer information\&. | 
|---|
| 439 | .PP | 
|---|
| 440 | ldb is released under the GNU Lesser General Public License version 2 or later\&. Please see the file COPYING for license details\&. | 
|---|