summaryrefslogtreecommitdiff
path: root/source4/scripting/ejs/mprutil.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-07-15 11:10:38 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:23:08 -0500
commit94d99612b9093ca83da3b6b66f875915eeabb389 (patch)
tree17aad583cb4a7bfc7f2ee384f680b7264e035120 /source4/scripting/ejs/mprutil.c
parent2bb9fa28754b8575c5926646c1a6221475d24dcc (diff)
downloadsamba-94d99612b9093ca83da3b6b66f875915eeabb389.tar.gz
samba-94d99612b9093ca83da3b6b66f875915eeabb389.tar.bz2
samba-94d99612b9093ca83da3b6b66f875915eeabb389.zip
r8488: after discussions with simo, moved to a full OO interface, so you don't need to keep
a 'db' variable around. The ldb object knows what it is connected to. Added a simple ldb testsuite in testprogs/ldb.js (This used to be commit cf35818648b5b649d0cd25f115a04b7b5b5311aa)
Diffstat (limited to 'source4/scripting/ejs/mprutil.c')
-rw-r--r--source4/scripting/ejs/mprutil.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/source4/scripting/ejs/mprutil.c b/source4/scripting/ejs/mprutil.c
index 247cea0b06..f25064f245 100644
--- a/source4/scripting/ejs/mprutil.c
+++ b/source4/scripting/ejs/mprutil.c
@@ -202,6 +202,9 @@ struct MprVar mprLdbArray(struct ldb_message **msg, int count, const char *name)
for (i=0;i<count;i++) {
mprAddArray(&res, i, mprLdbMessage(msg[i]));
}
+ if (i==0) {
+ mprSetVar(&res, "length", mprCreateIntegerVar(0));
+ }
return res;
}
@@ -372,7 +375,7 @@ void mpr_ReturnString(int eid, const char *s)
*/
void mprSetCFunction(struct MprVar *obj, const char *name, MprCFunction fn)
{
- mprSetVar(obj, name, mprCreateCFunctionVar(fn, NULL, MPR_VAR_SCRIPT_HANDLE));
+ mprSetVar(obj, name, mprCreateCFunctionVar(fn, obj, MPR_VAR_SCRIPT_HANDLE));
}
/*
@@ -380,5 +383,5 @@ void mpr_ReturnString(int eid, const char *s)
*/
void mprSetStringCFunction(struct MprVar *obj, const char *name, MprStringCFunction fn)
{
- mprSetVar(obj, name, mprCreateStringCFunctionVar(fn, NULL, MPR_VAR_SCRIPT_HANDLE));
+ mprSetVar(obj, name, mprCreateStringCFunctionVar(fn, obj, MPR_VAR_SCRIPT_HANDLE));
}