
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
sql-query-generator
Advanced tools
// Import
> const sql = require('sql-query-generator')
// Choose your dialect: postgres (default), mysql, mssql
sql.use("postgres");
// Every function return a statement object containing the following information
> sql.update("account", {email: "test@example.com", phone: "555-5555-5555"}).where({id: 1})
Statement {
operation: 'UPDATE',
table: 'account',
text: 'UPDATE account SET email = $1, phone = $2 WHERE id = $3',
values: [ 'test@example.com', '555-5555-5555', 1 ]
}
> sql.select("account", "*").text
'SELECT * FROM account'
> sql.select("account", ["id", "email", "phone"]).text
'SELECT id, email, phone FROM account'
> sql.select("account", "id, email, phone").text
'SELECT id, email, phone FROM account'
> sql.insert("account", { id:1, "email": "test@example.com", "phone": "555-5555-5555" }).text
'INSERT INTO account (id, email, phone) VALUES ($1, $2, $3)'
> sql.insert("account", {id:2}).returning("*").text
'INSERT INTO account (id) VALUES ($1) RETURNING *'
> sql.update("account", {email: "test@example.com", phone: "555-5555-5555"}).where({id: 1}).text
'UPDATE account SET email = $1, phone = $2 WHERE id = $3'
> sql.deletes("delete").where({id: 1}).text
'DELETE FROM delete WHERE id = $1'
> sql.select("account", "*").where({email: "test@example.com"}).text
'SELECT * FROM account WHERE email = $1'
> sql.select("account", "*").where({email: "%@example.com"}, 'LIKE').text
'SELECT * FROM account WHERE email LIKE $1'
> sql.select("account", "*").where({email: "test@example.com", id: 1}).text
'SELECT * FROM account WHERE (email = $1 AND id = $2)'
> sql.select("account", "*").where({email: "test@example.com", id: 1}, "=", "OR").text
'SELECT * FROM account WHERE (email = $1 OR id = $2)'
> sql.select("account", "*").where({email: "test@example.com", id: 1}).or({phone: '%5555%'}, 'LIKE').text
'SELECT * FROM account WHERE (email = $1 AND id = $2) OR phone LIKE $3'
> sql.select("account", "*").where({email: "test@example.com", phone: '555-5555-5555'}, '=', 'OR').and({id: 0}, '>').text
'SELECT * FROM account WHERE (email = $1 OR phone = $2) AND id > $3'
> sql.select("account", "*").orderby("email").text
'SELECT * FROM account ORDER BY email'
> sql.select("account", "*").orderby(["email DESC", "phone"]).text
'SELECT * FROM account ORDER BY email DESC, phone'
> sql.select("account", "*").orderby("email").limit(200).text
'SELECT * FROM account ORDER BY email LIMIT 200'
> sql.select("account", "*").orderby("email").limit(200, 200).text
'SELECT * FROM account ORDER BY email LIMIT 200 OFFSET 200'
FAQs
A schemaless sql query builder.
We found that sql-query-generator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.