Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
think-mysql
Advanced tools
npm install think-mysql
You can find all the config options at https://github.com/mysqljs/mysql#connection-options
const defaultConfig = {
port: 3306,
host: '127.0.0.1',
user: '',
password: '',
database: '',
connectionLimit: 1,
multipleStatements: true,
logger: console.log.bind(console),
logConnect: false,
logSql: false,
acquireWaitTimeout: 0 // if set timeout, it will be throw an error after get connection timeout
};
import mysql from 'think-mysql';
let instance = mysql.getInstance(config);
await instance.execute({
sql:"insert into `think_test`.`books` (`name`, `author`) values ('thinkjs best practice', ?)",
timeout: 5000,
values: ['David']
});
let books = await instance.query({
sql:'SELECT * FROM `books` WHERE `author` = ?',
timeout: 5000,
values: ['David']
});
console.log(books[0].name) //thinkjs best practice
import mysql from 'think-mysql';
let instance = mysql.getInstance(config);
let result = null;
try{
await instance.transaction(async(conn) => {
result = instance.execute({
sql: "insert into `think_test`.`books` (`name`, `author`) values ('1st step', ?)",
values: ['0-David']
}, conn);
result = await instance.execute({
sql: "insert into `think_test`.`books` (`name`, `author`) values ('2nd step', ?)",
values: [`${result.insertId}-David`]
}, conn);
await instance.execute({
sql: "insert into `think_test`.`books` (`name`, `autor`) values ('3rd step', ?)",
values: [`${result.insertId}-David`]
}, conn);
});
}catch (e){
console.log(e);
}
result = await instance.query({
sql:'SELECT * FROM `books` WHERE `author` = ?',
values:[`${result.insertId}-David`]
});
console.log(result[0].name); //3rd step
FAQs
think-mysql for ThinkJS
The npm package think-mysql receives a total of 632 weekly downloads. As such, think-mysql popularity was classified as not popular.
We found that think-mysql demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 9 open source maintainers 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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.