denisboyun asked on IRC for more info on the project idea to extend JS plugin.
Background: See current state at http://docs.drizzle.org/plugins/js/index.html The idea of the project would essentially be to solve things mentioned in the "Limitations" section in the docs. There's a little, but just a little, basic plumbing to do: Currently there is only one instance of the v8 engine running in a single thread. v8 now supports using an "Isolate" class to run multiple instances of v8 for more scalability. Anyway, this isn't even important, we can stick with the single thread for now and develop more features. The next steps for JS plugin would be twofold: 1) Add capability to store JavaScript code in a Drizzle database and call it somehow. Currently this is possible even if not supported in any way. Just do: INSERT INTO sometable (name, language, code) VALUES ("myfunction", "javascript", "retval = 'Hello World'; retval;"); SELECT JS(code) FROM sometable WHERE name="myfunction"; Should return "Hello World" So a naive implementation of "stored procedures" could simply be that if you create a table myschema._sys_procedures and do the above kind of INSERT statement we could create a function CALL() (or JS_CALL()) that would look for a table called _sys_procedures and execute the code that matches the "name" value. Example: SELECT CALL("myfunction", arg1, arg2, ...); This would again return "Hello World"; The final step in this thread would be to add a "CALL" keyword to the parser that would do the same. So we could now do: CALL myfunction(arg1, arg2, ...); Note that I don't really see a need to implement CREATE PROCEDURE functionality. For me the above is quite enough. 2) Extend functionality of JS. Currently a JS() call runs JavaScript, but it can't interact with Drizzle other than receive parameters and provide return value. To really make this a useful stored procedure language we should bind some API into the JavaScript environment. Examples: var results = DB.execute("SELECT * FROM sometable;"); for(var i = 0; i < results.length; i++) { DB.execute("INSERT INTO anothertable (col1) VALUES (" + results[i][0] + ") WHERE col2='" + results[i][1] + ";"); } I don't know if anything else is needed. One could of course do methods like DB.getGlobalVariable("...") but this is just the same as calling DB.execute("SHOW VARIABLES LIKE '...';") so I don't really know is anything more is needed. Maybe DB.begin() and DB.commit() and DB.rollback()? So this is pretty much the idea behind the GSoC project. henrik -- henrik.i...@avoinelama.fi +358-40-8211286 skype: henrik.ingo irc: hingo www.openlife.cc My LinkedIn profile: http://www.linkedin.com/profile/view?id=9522559 _______________________________________________ Mailing list: https://launchpad.net/~drizzle-discuss Post to : drizzle-discuss@lists.launchpad.net Unsubscribe : https://launchpad.net/~drizzle-discuss More help : https://help.launchpad.net/ListHelp