# mysql
[![NPM Version][npm-version-image]][npm-url]
[![NPM Downloads][npm-downloads-image]][npm-url]
[![Node.js Version][node-image]][node-url]
[![Linux Build][travis-image]][travis-url]
[![Windows Build][appveyor-image]][appveyor-url]
[![Test Coverage][coveralls-image]][coveralls-url]
## Table of Contents
- [Install](#install)
- [Introduction](#introduction)
- [Contributors](#contributors)
- [Sponsors](#sponsors)
- [Community](#community)
- [Establishing connections](#establishing-connections)
- [Connection options](#connection-options)
- [SSL options](#ssl-options)
- [Connection flags](#connection-flags)
- [Terminating connections](#terminating-connections)
- [Pooling connections](#pooling-connections)
- [Pool options](#pool-options)
- [Pool events](#pool-events)
- [acquire](#acquire)
- [connection](#connection)
- [enqueue](#enqueue)
- [release](#release)
- [Closing all the connections in a pool](#closing-all-the-connections-in-a-pool)
- [PoolCluster](#poolcluster)
- [PoolCluster options](#poolcluster-options)
- [Switching users and altering connection state](#switching-users-and-altering-connection-state)
- [Server disconnects](#server-disconnects)
- [Performing queries](#performing-queries)
- [Escaping query values](#escaping-query-values)
- [Escaping query identifiers](#escaping-query-identifiers)
- [Preparing Queries](#preparing-queries)
- [Custom format](#custom-format)
- [Getting the id of an inserted row](#getting-the-id-of-an-inserted-row)
- [Getting the number of affected rows](#getting-the-number-of-affected-rows)
- [Getting the number of changed rows](#getting-the-number-of-changed-rows)
- [Getting the connection ID](#getting-the-connection-id)
- [Executing queries in parallel](#executing-queries-in-parallel)
- [Streaming query rows](#streaming-query-rows)
- [Piping results with Streams](#piping-results-with-streams)
- [Multiple statement queries](#multiple-statement-queries)
- [Stored procedures](#stored-procedures)
- [Joins with overlapping column names](#joins-with-overlapping-column-names)
- [Transactions](#transactions)
- [Ping](#ping)
- [Timeouts](#timeouts)
- [Error handling](#error-handling)
- [Exception Safety](#exception-safety)
- [Type casting](#type-casting)
- [Number](#number)
- [Date](#date)
- [Buffer](#buffer)
- [String](#string)
- [Custom type casting](#custom-type-casting)
- [Debugging and reporting problems](#debugging-and-reporting-problems)
- [Security issues](#security-issues)
- [Contributing](#contributing)
- [Running tests](#running-tests)
- [Running unit tests](#running-unit-tests)
- [Running integration tests](#running-integration-tests)
- [Todo](#todo)
## Install
This is a [Node.js](https://nodejs.org/en/) module available through the
[npm registry](https://www.npmjs.com/).
Before installing, [download and install Node.js](https://nodejs.org/en/download/).
Node.js 0.6 or higher is required.
Installation is done using the
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
```sh
$ npm install mysql
```
For information about the previous 0.9.x releases, visit the [v0.9 branch][].
Sometimes I may also ask you to install the latest version from Github to check
if a bugfix is working. In this case, please do:
```sh
$ npm install mysqljs/mysql
```
[v0.9 branch]: https://github.com/mysqljs/mysql/tree/v0.9
## Introduction
This is a node.js driver for mysql. It is written in JavaScript, does not
require compiling, and is 100% MIT licensed.
Here is an example on how to use it:
```js
var mysql = require('mysql');
var connection = mysql.createConnection({
host : 'localhost',
user : 'me',
password : 'secret',
database : 'my_db'
});
connection.connect();
connection.query('SELECT 1 + 1 AS solution', function (error, results, fields) {
if (error) throw error;
console.log('The solution is: ', results[0].solution);
});
connection.end();
```
From this example, you can learn the following:
* Every method you invoke on a connection is queued and executed in sequence.
* Closing the connection is done using `end()` which makes sure all remaining
queries are executed before sending a quit packet to the mysql server.
## Contributors
Thanks goes to the people who have contributed code to this module, see the
[GitHub Contributors page][].
[GitHub Contributors page]: https://github.com/mysqljs/mysql/graphs/contributors
Additionally I'd like to thank the following people:
* [Andrey Hristov][] (Oracle) - for helping me with protocol questions.
* [Ulf Wendel][] (Oracle) - for helping me with protocol questions.
[Ulf Wendel]: http://blog.ulf-wendel.de/
[Andrey Hristov]: http://andrey.hristov.com/
## Sponsors
The following companies have supported this project financially, allowing me to
spend more time on it (ordered by time of contribution):
* [Transloadit](http://transloadit.com) (my startup, we do file uploading &
video encoding as a service, check it out)
* [Joyent](http://www.joyent.com/)
* [pinkbike.com](http://pinkbike.com/)
* [Holiday Extras](http://www.holidayextras.co.uk/) (they are [hiring](http://join.holidayextras.co.uk/))
* [Newscope](http://newscope.com/) (they are [hiring](https://newscope.com/unternehmen/jobs/))
## Community
If you'd like to discuss this module, or ask questions about it, please use one
of the following:
* **Mailing list**: https://groups.google.com/forum/#!forum/node-mysql
* **IRC Channel**: #node.js (on freenode.net, I pay attention to any message
including the term `mysql`)
## Establishing connections
The recommended way to establish a connection is this:
```js
var mysql = require('mysql');
var connection = mysql.createConnection({
host : 'example.org',
user : 'bob',
password : 'secret'
});
connection.connect(function(err) {
if (err) {
console.error('error connecting: ' + err.stack);
return;
}
console.log('connected as id ' + connection.threadId);
});
```
However, a connection can also be implicitly established by invoking a query:
```js
var mysql = require('mysql');
var connection = mysql.createConnection(...);
connection.query('SELECT 1', function (error, results, fields) {
if (error) throw error;
// connected!
});
```
Depending on how you like to handle your errors, either method may be
appropriate. Any type of connection error (handshake or network) is considered
a fatal error, see the [Error Handling](#error-handling) section for more
information.
## Connection options
When establishing a connection, you can set the following options:
* `host`: The hostname of the database you are connecting to. (Default:
`localhost`)
* `port`: The port number to connect to. (Default: `3306`)
* `localAddress`: The source IP address to use for TCP connection. (Optional)
* `socketPath`: The path to a unix domain socket to connect to. When used `host`
and `port` are ignored.
* `user`: The MySQL user to authenticate as.
* `password`: The password of that MySQL user.
* `database`: Name of the database to use for this connection (Optional).
* `charset`: The charset for the connection. This is called "collation" in the SQL-level
of MySQL (like `utf8_general_ci`). If a SQL-level charset is specified (like `utf8mb4`)
then the default collation for that charset is used. (Default: `'UTF8_GENERAL_CI'`)
* `timezone`: The timezone configured on the MySQL server. This is used to type cast server date/time values to JavaScript `Date` object and vice versa. This can be `'local'`, `'Z'`, or an offset in the form `+HH:MM` or `-HH:MM`. (Default: `'local'`)
* `connectTimeout`: The milliseconds before a timeout occurs during the initial connection
to the MySQL server. (Default: `10000`)
* `stringifyObjects`: Stringify objects instead of converting to values. See
issue [#501](https://github.com/mysqljs/mysql/issues/501). (Default: `false`)
* `insecureAuth`: Allow connecting to MySQL instances that ask for the old
(insecure) authentica
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
【资源说明】 基于图像处理的水果自助售卖系统源码+项目说明+后端源码(比赛项目).zip基于图像处理的水果自助售卖系统源码+项目说明+后端源码(比赛项目).zip 基于图像处理的水果自助售卖系统(研究生电赛) 通过CT-LO200 USB2.0 2MP摄像头进行图像采集,将采集到的图片传到AM5708的工业派中, 通过opencv模块对图像进行处理,识别到水果种类后,传递到全局变量中, 程序通过多线程实现压力传感器、语音模块、post网页数据发送等功能具体实现过程是: 通过HX711压力传感模块读取水果质量, 并通过语音模块进行播放,将水果的种类、质量通过http的post请求传送到网页端, 通过网页端显示水果种类、质量、单价,以及水果的照片, 网页会有确认付款的按键,按下出现付款码,客户完成付款后,最终实现自动化购买。 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载使用,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可直接用于毕设、课设、作业等。 欢迎下载,沟通交流,互相学习,共同进步!
资源推荐
资源详情
资源评论
收起资源包目录
基于图像处理的水果自助售卖系统源码+项目说明+后端源码(比赛项目).zip (645个子文件)
CMakeDetermineCompilerABI_CXX.bin 13KB
CMakeDetermineCompilerABI_C.bin 13KB
feature_tests.bin 13KB
CMakeCCompilerId.c 17KB
syn6288_thread.c 9KB
new_hx711.c 5KB
post_thread.c 5KB
hx711_thread.c 2KB
main.c 788B
feature_tests.c 688B
print_thread.c 321B
cmake.check_cache 85B
CMakeCXXCompiler.cmake 6KB
CMakeCCompiler.cmake 4KB
Makefile.cmake 3KB
cmake_install.cmake 1KB
DependInfo.cmake 768B
CMakeDirectoryInformation.cmake 658B
CMakeSystem.cmake 362B
cmake_clean.cmake 304B
mime.cmd 316B
CMakeCXXCompilerId.cpp 16KB
fruit.cpp 6KB
project_main.cpp 2KB
read.cpp 1KB
feature_tests.cxx 10KB
.editorconfig 540B
.editorconfig 286B
.eslintignore 10B
.eslintignore 10B
.eslintignore 10B
.eslintignore 10B
.eslintrc 1KB
.eslintrc 1022B
.eslintrc 715B
.eslintrc 247B
.eslintrc 231B
.eslintrc 180B
.eslintrc 176B
.eslintrc 172B
.eslintrc 164B
fruit_test 137KB
syn6288_thread.h 953B
fruit.h 583B
post_thread.h 528B
main_a.h 394B
main.h 321B
hx711_thread.h 280B
print_thread.h 129B
API.html 85KB
CXX.includecache 565B
depend.internal 331B
errors.js 172KB
bignumber.js 87KB
ssl_profiles.js 81KB
qs.js 67KB
parse.js 34KB
stringify.js 32KB
sbcs-data-generated.js 31KB
_stream_readable.js 31KB
response.js 27KB
index.js 23KB
dbcs-codec.js 21KB
_stream_writable.js 20KB
ipaddr.js 19KB
bignumber.min.js 18KB
index.js 18KB
tests.js 15KB
index.js 15KB
application.js 14KB
Connection.js 14KB
Parser.js 13KB
request.js 12KB
index.js 12KB
Protocol.js 11KB
charsets.js 11KB
index.js 11KB
index.js 10KB
stringify.js 10KB
ipaddr.min.js 10KB
string_decoder.js 9KB
parse.js 9KB
utf7.js 9KB
index.js 9KB
extend-node.js 8KB
GetIntrinsic.js 8KB
dbcs-data.js 8KB
_stream_transform.js 8KB
Pool.js 7KB
values.js 7KB
index.js 7KB
utils.js 7KB
index.js 7KB
indent-option.js 6KB
index.js 6KB
ConnectionConfig.js 6KB
PoolCluster.js 6KB
index.js 6KB
index.js 6KB
internal.js 6KB
共 645 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
资源评论
- Camellllia2023-11-10资源简直太好了,完美解决了当下遇到的难题,这样的资源很难不支持~
Make程序设计
- 粉丝: 6877
- 资源: 3577
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功