Use javascript + SQL to write SQL client tools tabris and sqltabris
I wish you a happy new year 2018, not long ago found a creative script JtSQL (java written) Open Source Address: https://github.com/noear/JtSQLJtSQL features:
*. Integrates JS, SQL, and template concepts;
*. The syntax highlighting of JS and SQL is maintained (for DBA review );
*. Convenient unified management, deployment, and Operation
*. Supports the current context and variables like stored procedures;
*. Like an SQL client tool, you can instantly compile and run the program;
* Provides process and logic control capabilities like custom statistical programs;
*. The server runs (Don't get me confused about running the client.. Combining JavaScript with SQL is really awesome. Solve the problem that has been plagued. Take this as an innovation. I also developed a tool named tabris script tool.Open Source Address: https://github.com/yuzd/ClearScript.Manager(Ps: You have suggestions)Features:1 contains all JtSQL features2 use Microsoft ClearScript V8 engine details please refer to: https://microsoft.github.io/ClearScript/Tutorial/FAQtorial.html? From = timeline & isappinstalled = 0ClearScript is very powerful. It can be used to connect c # With JavaScript. 3. modularized functions. Currently, three important modules have been implemented. 1. execute http Request Processing Module 2. log Output Processing Module 3. execute the SQL processing module. 4. js Code intelligently reminds the tabris module that other functions can be used to expand other modules in the future. codeMirror is used for coding, and js Code is written. The following figure shows how to use the following scenario as an example.
The encapsulated SQL log http three major components can be intelligently prompted by code in the editor.
// DB processor var db = this. tabris. create ('SQL', {name: 'testorm ', type: 'mysql'}); // http processor var http = this. tabris. create ('http', {method: 'get'}); // log processor var log = this. tabris. create ('log', {trace: true}); db. delete ('delete from child_district '); // obtain the Codevar get_district_ SQL = "select Code from district" from all cities from the district table; var district_code_list = db. query (get_district_ SQL); for (var index = 0; index <district_code_list.length; index ++) {getChildDistrictAndInsertToDb (district_code_list [index]. code);} // remotely obtain the function getChildDistrictAndInsertToDb (parentCode) {log.info (parentCode); var re = http. getJson ({url :' https://fuwu.sf-express.com/service/address/newAddr/getNewSubAddress?parentCode= '+ ParentCode}); if (! Re. subAddressList |! Re. subAddressList. length) return; for (var index = 0; index <re. subAddressList. length; index ++) {var child = re. subAddressList [index]; var insertSql = "insert into child_district (Name, Code, DataChange_LastTime) VALUES ('" + child. distCnName + "','" + child. distCode + "', now ()"; var insertResult = db. insert (insertSql) if (insertResult! = 1) {log. error (child. distCnName + 'failed to insert db! ');} Else {log.info (child. distCnName +' the database is successfully inserted! ')}}}
Client download