Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

instant-sql-formatter

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

instant-sql-formatter

SQL Formatter With Customizing Options(HTML, DBMS, etc...)

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Instant SQL Formatter

format your query with options
Reference : https://www.dpriver.com/pp/sqlformat.htm

How to Use

const formatter = require("instant-sql-formatter")

function basicFunction() {
	let vQuery = "select * from dual"

	formatter.format(vQuery).then(res=>{
		console.log(res)
	})
}

async function asyncFunction() {
	let vQuery = "select * from dual"
	let vConvQuery = await formatter.format(vQuery)
	console.log(vConvQuery)
}
  • Input
select * from dual
  • Output
 SELECT *
  FROM DUAL 

Variable Options

let options = {
	dbvendor      : "oracle",          // endor, access, db2, mssql, mysql, oracle, mdx, generic
	outputfmt     : "SQL",             // htmlkeeplayout, htmlkeeplayout2, htmlkeeplayoutmodifycase, htmlkeeplayout2modifycase, txtmodifycase, C#, C# String Builder, Delphi, Java, Java String Buffer, PHP, VB, VBSBD, VC, dbobject, proc, procobol, xml
	keywordcs     : "Uppercase",       // Uppercase,Lowercase,InitCap,Unchanged,initcapeachword
	tablenamecs   : "Uppercase",       // Uppercase,Lowercase,InitCap,Unchanged,initcapeachword
	columnnamecs  : "Uppercase",       // Uppercase,Lowercase,InitCap,Unchanged,initcapeachword
	functioncs    : "Uppercase",       // Uppercase,Lowercase,InitCap,Unchanged,initcapeachword
	datatypecs    : "Uppercase",       // Uppercase,Lowercase,InitCap,Unchanged,initcapeachword
	variablecs    : "Uppercase",       // Uppercase,Lowercase,InitCap,Unchanged,initcapeachword
	aliascs       : "Uppercase",       // Uppercase,Lowercase,InitCap,Unchanged,initcapeachword
	quotedidentifiercs : "Uppercase",  // Uppercase,Lowercase,InitCap,Unchanged,initcapeachword
	identifiercs  : "Uppercase",       // Uppercase,Lowercase,InitCap,Unchanged,initcapeachword     
	lnbrwithcomma : "beforewithspace", // after,before,beforewithspace
	liststyle     : "stack",           // stack,nostack
	salign        : "sright",          // sleft,sright
	quotechar     : "\"",
	maxlenincm    : "80"
} -- default setting

Sample(TEXT)

let vQuery = "select * from dual"
let vConvQuery = await formatter.format(vQuery, { dbvendor:"oracle", lnbrwithcomma:"after", salign:"sright"} )
  • Input
select * from dual
  • Output
 SELECT *
  FROM DUAL 

Sample(HTML Tag Options)

let vQuery = "select * from dual"
let vConvQuery = await formatter.format(vQuery, { outputfmt:"htmlkeeplayout"} )
  • Input
select * from dual
  • Output
<div><span style="font-family: Courier New; font-size: 10pt;">
<span style="color: blue; ">SELECT</span>&nbsp;<span style="color: silver; ">*</span>
<br/>&nbsp;&nbsp;<span style="color: blue; ">FROM</span>&nbsp;<span style="color: maroon; ">DUAL</span>&nbsp;
</span></div>

TIP! Easily create options

  1. Visit the Website(https://www.dpriver.com/pp/sqlformat.htm) and select options what you want
  2. Analyze transactions using developer tools.
  3. Edit appropriately.

ex

Keywords

FAQs

Package last updated on 25 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc