-
Notifications
You must be signed in to change notification settings - Fork 13
SQL FaaS
There are 2 components in SQL Formatter as a Service(SQL FaaS).
SQL formatter widget can be easily embedded to your site within 3 minutes by copy the short code I give you into your website's HTML. After that, a Format SQL label will be appeared at the left/right side:
After click this label, you can format SQL in this panel:
Here is an online demo.
If you prefer, you can even use a simple text link to launch sql formatter.
This SQL formatter widget is based on our widely acclaimed tool: Instant sql formatter which had been online 5 years and tidy more than 1 million SQLs worldwide.
Contact us to request a free code to use this SQL formatter widget.
2. API
You can integrate this service into your application and web site by using sql formatter API.
URL: http://www.gudusoft.com/format.php
METHOD: POST
Content-Type: application/x-www-form-urlencoded.
Simple request sent to server:
rqst_input_sql=select+*+from+dual
And you will get formatted sql in json format like this:
{
"rspn_http_status" : 200,
"rspn_capacity" : 0,
"rspn_db_vendor" : "generic",
"rspn_output_fmt" : "",
"rspn_parse_sql_status" : 0,
"rspn_parse_sql_message" : "success",
"rspn_formatted_sql" : "SELECT *\nFROM DUAL \n"
}
Check API manual.
curl --data-urlencode "rqst_input_sql=select 1+2 from dual" http://www.gudusoft.com/format.php
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.gudusoft.com/format.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, urlencode('rqst_input_sql=select 1+2 from dual'));
$response = curl_exec($ch);
echo $response;
?>
Here is a Java demo illustrates how to send POST to FaaS and get formatted SQL.
When you format SQL using this service, your SQL will be sent to our server, and analzyed by our back-end program. If you would prefer to avoid transmitting your SQL across the network, please download sql formatter desktop version or add-in for SSMS and VS.
[2014-08-29, v1.0.3] Update java demo to illustrate how to POST format options in json format.
[2014-08-29, v1.0.3] Fix a bug in ISFP to receive format options correctly.
[2014-08-29, v1.0.2] + and % character in POST request can't be handled correctly.
[2014-08-29, v1.0.1] Fixed a bug can't handle %0A character in GET request.
[2014-08-26, v1.0.0] Version 1.0 release