1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-08 04:58:40 +03:00

r8557: expose ldb_errstring() in ldb ejs code

(This used to be commit 21ca972d06bbf4694569855f39a1649d799c05c7)
This commit is contained in:
Andrew Tridgell 2005-07-18 23:57:37 +00:00 committed by Gerald (Jerry) Carter
parent 7ef904e9e1
commit 0752efe055

View File

@ -215,6 +215,24 @@ static int ejs_ldbRename(MprVarHandle eid, int argc, struct MprVar **argv)
return 0;
}
/*
get last error message
usage:
ok = ldb.errstring();
*/
static int ejs_ldbErrstring(MprVarHandle eid, int argc, struct MprVar **argv)
{
struct ldb_context *ldb;
ldb = ejs_get_ldb_context(eid);
if (ldb == NULL) {
return -1;
}
mpr_Return(eid, mprString(ldb_errstring(ldb)));
return 0;
}
/*
perform an ldb modify
@ -281,6 +299,7 @@ static int ejs_ldb_init(MprVarHandle eid, int argc, struct MprVar **argv)
mprSetCFunction(ldb, "modify", ejs_ldbModify);
mprSetCFunction(ldb, "delete", ejs_ldbDelete);
mprSetCFunction(ldb, "rename", ejs_ldbRename);
mprSetCFunction(ldb, "errstring", ejs_ldbErrstring);
mprSetVar(ldb, "SCOPE_BASE", mprCreateNumberVar(LDB_SCOPE_BASE));
mprSetVar(ldb, "SCOPE_ONE", mprCreateNumberVar(LDB_SCOPE_ONELEVEL));
mprSetVar(ldb, "SCOPE_SUBTREE", mprCreateNumberVar(LDB_SCOPE_SUBTREE));