Logo Search packages:      
Sourcecode: ldb version File versions  Download package

int ldb_add ( struct ldb_context *  ldb,
const struct ldb_message message 
)

Add a record to the database.

This function adds a record to the database. This function will fail if a record with the specified class and key already exists in the database.

Parameters:
ldb the context associated with the database (from ldb_init())
message the message containing the record to add.
Returns:
result code (LDB_SUCCESS if the record was added, otherwise a failure code)

Definition at line 993 of file ldb.c.

References LDB_SUCCESS.

{
      struct ldb_request *req;
      int ret;

      ret = ldb_msg_sanity_check(ldb, message);
      if (ret != LDB_SUCCESS) {
            return ret;
      }

      ret = ldb_build_add_req(&req, ldb, ldb,
                              message,
                              NULL,
                              NULL,
                              NULL);

      if (ret != LDB_SUCCESS) return ret;

      ldb_set_timeout(ldb, req, 0); /* use default timeout */

      /* do request and autostart a transaction */
      ret = ldb_autotransaction_request(ldb, req);

      talloc_free(req);
      return ret;
}


Generated by  Doxygen 1.6.0   Back to index