Skip to content

Helper Methods

Pamblam edited this page Jan 8, 2017 · 2 revisions

jSQL has a few helper methods that may also be helpful to you, so it exposes them on the jSQL object.


jSQL.reset()

Delete all tables and then commit the changes to the persistence manager.

Example
jSQL.reset();

jSQL.minify(sql)

Remove SQL comments, extra spaces, tabs, linebreaks from a jSQL string.

Example
var sql = jSQL.minify('-- A Create Query Template \
CREATE TABLE IF NOT EXISTS `myTable` \
(	`String` VARCHAR(20), \
	`Number` INT \
)');

// returns: 'CREATE TABLE IF NOT EXISTS `myTable` ( `String` VARCHAR(20), `Number` INT )'

Clone this wiki locally