Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
mysql-native
Advanced tools
Readme
Mysql client module for node.js, written in JavaScript. No other mysql runtime required.
npm install mysql-native
Check out the google group http://groups.google.com/group/node-mysql-native for questions/answers from users of the driver.
var db = require("mysql-native").createTCPClient(); // localhost:3306 by default db.auto_prepare = true; function dump_rows(cmd) { cmd.addListener('row', function(r) { console.dir(r); } ); } db.auth("test", "testuser", "testpass"); dump_rows(db.query("select 1+1,2,3,'4',length('hello')")); dump_rows(db.execute("select 1+1,2,3,'4',length(?)", ["hello"])); db.close();
output is: row: [ 2, 2, 3, "4", 5] row: [ 2, 2, 3, "4", 5]
#API
All commands fire 'end'() event at the end of command executing.
auth(db, user, pass)
- perform mysql connection handshake. Should be always a first command (TODO: add default user/pass if missing?).
Events:
'authorized'(serverStatus) event.
query(sql)
- simple query.
Events:
'field'(field) - one for each field description
'fields_eof'() - after last field
'row'(rows) - array of field values, fired for each row in result set
client.prepre(sql)
- prepare a statement and store result in client.pscache
Events:
'prepared'(preparedStatement)
'parameter'(field) - input parameter description
execute(sql, parameters)
- parameters is an array of values. Known types are sent in appropriate mysql binary type (TODO: currently this is not true, type is always string and input converted using param.toString() )
Events:
same as with query()
client.close
- create and enqueue corresponding command
client.execute
also adds prepare command if there is no cached statement and client.auto_prepare set to true (TODO: add better api than client.auto_prepare flag)
client.terminate
- close conection immediately
MySql protocol documentation:
Other node.js mysql clients:
FAQs
MySql protocol client for Node.Js
The npm package mysql-native receives a total of 17 weekly downloads. As such, mysql-native popularity was classified as not popular.
We found that mysql-native 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.