Innov-AI
    Documentation | MentDB Weak Server
Read a SQL Database and write a JSON Object file

  • try {
    
    	sql connect "session1" {cm get "demo_cm_mysql";};
    
    	json load "keyIdObject" "{}";
    	-> "[index]" 0;
    	sql parse "session1" "T" (concat "select id, name, quantity from products") {
    
    		json load "row" "{}";
    		json iobject "row" / "id" [T_id] NUM;
    		json iobject "row" / "name" [T_name] STR;
    		json iobject "row" / "quantity" [T_quantity] STR;
    
    		json iobject "keyIdObject" / (concat "key_" [index]) (json doc "row") OBJ;
    
    		++ "[index]";
    	
    	};
    
    	sql disconnect "session1";
    
    	json doc "keyIdObject";
    
    } {
    
    	try {sql disconnect "session1";} {} "[err]";
    
    } "[err]";
Services     Supporters     Contact     About     Legal notice © 2024