spidermonkey for APE! anyone got a fully working one that supports mysql?

72 views
Skip to first unread message

Lloyd Adler

unread,
Aug 28, 2012, 11:34:11 AM8/28/12
to ape-p...@googlegroups.com
As the subject goes,

I'm wondering if there's anybody here who has a working spidermonkey library for APE that supports mysql without any troubles.

Also what MySQL class are you using?

Peter Reijnders

unread,
Dec 9, 2012, 5:24:25 AM12/9/12
to ape-p...@googlegroups.com
Hai

This morning, I build a small script to see what commit version is the 'latest' one with a working mysql connection.
here are my findings so far:

1) commits
'41ed0439e9409dfebc1053fe16a057b7889927ae' ok (ssjs: mysql : fix a crash when field is NULL)
'b89de0ed149aa4a5e2b539ff516da165ba607b26' fails (port to jsapi 1.8.5)
'fa5311f90ed21f3ff538b9578a9d5d31fb5a1fb3'  ok (SSJS: add stop event)
'8f8166cd1dcb4971a9a5aec2dfbfbf3f513f8fb1' fails (merge branche ...)

I also tried to find the causes in the source code, but my C superpowers have deteriorated

2)I manage to get a connection entry in the mysql logs if I skip the chost, clogin, cpass and cdb variables (in APE_JS_NATIVE(ape_sm_mysql_constructor))
   mysac_setup(my, JS_EncodeString(cx, host), JS_EncodeString(cx, login), JS_EncodeString(cx, pass), JS_EncodeString(cx, db), 0);
   ..
  myhandle->db = xstrdup(JS_EncodeString(cx, db));

3) I believe that there are 4 parameters that should pass to the constructor (in static void ape_sm_define_ape(ape_sm_compiled *asc, JSContext *gcx, acetables *g_ape))
jsmysql = JS_InitClass(asc->cx, obj, NULL, &mysql_class, ape_sm_mysql_constructor, 4, NULL, NULL, NULL, apemysql_funcs_static);
   

For the time being I will use fa5311f90ed21f3ff538b9578a9d5d31fb5a1fb3 2012-06-23 14:01:12

That is as far as my research came, I hope that this is usefull to get a step closer to a working mysql connection.


Peter

Peter Reijnders

unread,
Dec 29, 2012, 5:48:25 AM12/29/12
to ape-p...@googlegroups.com
I am still trying to get mysql working. Here is a update of my research.

1) I used meld to get a overview of the changes in libape_spidermonkey.c between:
  fa5311f90ed21f3ff538b9578a9d5d31fb5a1fb3 2012-06-23 14:01:12  (the last commit with mysql working)
and
 abe51a039712e67643c655b6abfa7a0e751f8014 2012-06-25 12:49:39 (the first one after the 1.8.2 update that immed compiles with out problems)

2) As mentioned in my earlier post, the mysac_setup makes a good connection (I can see that in mysql.log)

3) From there I sprayed lots of printf's in both versions and it appears to go wrong in mysac_setdb_success;
JS_CallFunctionName(myhandle->cx, myhandle->jsmysql, "onConnect", 0, NULL, &rval);
fa3211 returns JS_TRUE, rval looks ok
abe51 returns JS_TRUE, rval is rubish

4) if I replace "onConnect" with "getInsertId", then in both cases apemysql_sm_insert_id is called, so it seems that myhandle has a valid context and a valid object instance.
it seems that onConnect is not defined for that object, but the "JS_FS("onConnect", ape_sm_stub, 0, 0)," in  apemysql_funcs looks ok.

Does any body have some clues to share?


Peter


Reply all
Reply to author
Forward
0 new messages