Innov-AI
    Documentation | MentDB Weak Server
Generate Web-Service to SELECT on table

  • To generate Web-Service to SELECT on table:
  • Right click on the table 'apps' and select 'GEN WS > SELECT'
  • script create get "MENTDB.apps.select" false 1
      (param
      )
      "Return rows from the table 'apps' in JSON."
    {
    	
    	try {
    		
    		#Connection ...;
    		sql connect "session1" {cm get "MENTDB"};
    		
    		-> "[json_result]" (sql to json "session1" "products" (concat 
    			"SELECT  
    				app_id,
    				title
    			 FROM public.apps
    			 LIMIT 0, 100;"
    		));
    		
    		#Disconnection ...;
    		sql disconnect "session1";
    		
    		# Return the json;
    		[json_result]
    		
    	} {
    
    		#Close the connection;
    		try {sql disconnect "session1"} {} "[sub_err]";
    
    		#Generate an error;
    		exception (1) ([err]);
    		
    	} "[err]";
    	
    } "Return a JSON Object";
  • Update the script and save:
  • Execute buttons
Services     Supporters     Contact     About     Legal notice © 2024