[Freeswitch-svn] [commit] r5431 - freeswitch/trunk/src/mod/languages/mod_spidermonkey_odbc

Freeswitch SVN anthm at freeswitch.org
Thu Jun 21 12:30:56 EDT 2007


Author: anthm
Date: Thu Jun 21 12:30:56 2007
New Revision: 5431

Modified:
   freeswitch/trunk/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c

Log:
fix odbc

Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c	(original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c	Thu Jun 21 12:30:56 2007
@@ -424,21 +424,39 @@
 
 
 static JSPropertySpec odbc_props[] = {
-//  {"name", odbc_NAME, JSPROP_READONLY|JSPROP_PERMANENT}, 
+	{"name", odbc_NAME, JSPROP_READONLY|JSPROP_PERMANENT}, 
 	{0}
 };
 
+static JSBool odbc_setProperty(JSContext * cx, JSObject * obj, jsval id, jsval *vp)
+{
+	char *name = JS_GetStringBytes(JS_ValueToString(cx, id));
+
+	if (strcmp(name, "_oDbC_dB_RoW_DaTa_")) {
+		*vp = BOOLEAN_TO_JSVAL(JS_FALSE);
+	}
+	return JS_TRUE;
+}
 
-static JSBool odbc_getProperty(JSContext * cx, JSObject * obj, jsval id, jsval * vp)
+static JSBool odbc_getProperty(JSContext * cx, JSObject * obj, jsval id, jsval *vp)
 {
-	JSBool res = JS_TRUE;
+	int param;
+	char *name = JS_GetStringBytes(JS_ValueToString(cx, id));
+	
+	/* numbers are our props anything else is a method */
+	if (name[0] >= 48 && name[0] <= 57) {
+		param = atoi(name);
+	} else {
+		return JS_TRUE;
+	}
 
-	return res;
+	*vp = BOOLEAN_TO_JSVAL(JS_FALSE);
+	return JS_TRUE;
 }
 
 JSClass odbc_class = {
 	modname, JSCLASS_HAS_PRIVATE,
-	JS_PropertyStub, JS_PropertyStub, odbc_getProperty, DEFAULT_SET_PROPERTY,
+	JS_PropertyStub, JS_PropertyStub, odbc_getProperty, odbc_setProperty,
 	JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, odbc_destroy, NULL, NULL, NULL,
 	odbc_construct
 };



More information about the Freeswitch-svn mailing list