You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> SingleStore client for Node.js with focus on performance. Supports configurable connection behavior, prepared statements, compression, ssl and much more.
@@ -74,41 +76,89 @@ MySQL2 is mostly API compatible with [Node MySQL][node-mysql] and supports major
74
76
-[Custom Streams][docs-streams]
75
77
-[Pooling][docs-qs-pooling]
76
78
77
-
## Installation
79
+
## Why SingleStore Node.js Driver
80
+
81
+
The SingleStore Node.js Driver is a fork of [mysql2][node-mysql2], adapted specifically for SingleStore database. Since SingleStore is MySQL wire-protocol compatible, most mysql2 features work seamlessly.
82
+
83
+
SingleStore Node.js Driver is mostly API compatible with [node-mysql][node-mysql] and [node-mysql2][node-mysql2] and supports majority of features.
78
84
79
-
MySQL2 is free from native bindings and can be installed on Linux, Mac OS or Windows without any issues.
85
+
-**Official SingleStore Support**: Officially supported by SingleStore for guaranteed compatibility and reliability
86
+
-**Consistent Data Type Handling**: Handles SingleStore data types more consistently than generic MySQL drivers
87
+
-**Configurable Connection Behavior**: Allows you to configure connection behavior by setting session variables
88
+
-**MySQL Compatibility**: Maintains full compatibility with MySQL wire protocol
89
+
90
+
For more information about SingleStore, visit the [official documentation][singlestore-docs].
91
+
92
+
## Installation
80
93
81
94
```bash
82
-
npm install --save mysql2
95
+
npm install singlestore-nodejs
83
96
```
84
97
85
98
If you are using TypeScript, you will need to install `@types/node`.
86
99
87
-
```bash
88
-
npm install --save-dev @types/node
100
+
## Quick Start
101
+
102
+
```javascript
103
+
constsinglestore=require('singlestore_nodejs');
104
+
105
+
// Create connection
106
+
constconnection=singlestore.createConnection({
107
+
host:'localhost',
108
+
user:'root',
109
+
password:'password',
110
+
database:'mydb',
111
+
port:3306,
112
+
});
113
+
114
+
// Simple query
115
+
connection.query('SELECT * FROM users', (err, results, fields) => {
116
+
if (err) throw err;
117
+
console.log(results);
118
+
});
119
+
120
+
// Using promises
121
+
connection
122
+
.promise()
123
+
.query('SELECT * FROM products')
124
+
.then(([rows, fields]) => {
125
+
console.log(rows);
126
+
})
127
+
.catch(console.error);
128
+
129
+
// Close connection
130
+
connection.end();
89
131
```
90
132
91
-
> For TypeScript documentation and examples, see [here][docs-typescript-docs].
133
+
## Migration from MySQL2
134
+
135
+
SingleStore Node.js Driver is API-compatible with MySQL2, so migration is straightforward:
-[First Query][docs-qs-first-query], [Using Prepared Statements][docs-qs-using-prepared-statements], [Using Connection Pools][docs-qs-pooling] and more.
- Internal protocol is written by [@sidorares][sidorares][MySQL-Native][mysql-native].
104
-
- Constants, SQL parameters interpolation, Pooling, `ConnectionConfig` class taken from [Node MySQL][node-mysql].
105
-
- SSL upgrade code based on [@TooTallNate][TooTallNate][code][starttls.js].
106
-
- Secure connection / compressed connection api flags compatible to [MariaSQL][node-mariasql] client.
107
-
-[Contributors][contributors].
156
+
-[API Reference][docs-api]
108
157
109
158
## Contributing
110
159
111
-
Want to improve something in **MySQL2**?
112
-
Please check [Contributing.md][contributing] for detailed instruction on how to get started.
160
+
Contributions are welcome! Please see [Contributing.md](Contributing.md) for details.
161
+
162
+
## Acknowledgments
113
163
114
-
To contribute in **MySQL2 Documentation**, please visit the [Website Contributing Guidelines][docs-contributing]for detailed instruction on how to get started.
164
+
This project is a fork of [mysql2](https://github.com/sidorares/node-mysql2) by @sidorares. We are grateful for the excellent foundation provided by the MySQL2 project.
MySQL2 is mostly API compatible with [Node MySQL][node-mysql].
7
+
SingleStore Node.js Driver is mostly API compatible with [node-mysql2][node-mysql2] and [Node MySQL][node-mysql]. Since SingleStore is MySQL wire-protocol compatible, most existing MySQL client code works seamlessly.
8
+
9
+
## Known Incompatibilities
6
10
7
11
One known incompatibility is that `DECIMAL` values are returned as strings whereas in [Node MySQL][node-mysql] they are returned as numbers. This includes the result of `SUM()` and `AVG()` functions when applied to `INTEGER` arguments. This is done deliberately to avoid loss of precision - see https://github.com/sidorares/node-mysql2/issues/935.
8
12
13
+
## Migration from MySQL2
14
+
15
+
SingleStore Node.js Driver is API-compatible with MySQL2, so migration is straightforward:
If you find any other incompatibility with [Node MySQL][node-mysql], Please report via Issue tracker. We will fix reported incompatibility on priority basis.
30
+
If you find any incompatibility with [node-mysql2][node-mysql2] or issues specific to SingleStoreDB, please report via GitHub issue. We will address reported issues on priority basis.
@@ -9,5 +9,5 @@ import { PageTitle } from '@site/src/components/PageTitle';
9
9
10
10
# Contributing
11
11
12
-
Want to improve something in **MySQL2**?
13
-
Please check [Contributing.md](https://github.com/sidorares/node-mysql2/blob/master/Contributing.md) for detailed instruction on how to get started.
12
+
Want to improve something in **singlestore-nodejs**?
13
+
Please check [Contributing.md](https://github.com/singlestore-labs/singlestore-nodejs/blob/master/Contributing.md) for detailed instruction on how to get started.
MySQL2 aims to be a drop in replacement for [Node MySQL][node-mysql].
16
+
**singlestore-nodejs** is a Node.js driver for SingleStoreDB, forked from [node-mysql2][node-mysql2]. It maintains compatibility with [Node MySQL][node-mysql] while providing optimized support for SingleStoreDB features.
15
17
16
18
:::note
17
-
_If you see any API incompatibilities with [Node MySQL][node-mysql], please report via github issue._
19
+
_This driver is based on [node-mysql2][node-mysql2] and maintains API compatibility. If you encounter any problems, please report via GitHub issues._
18
20
:::
19
21
20
-
Not only **MySQL2** offers better performance over [Node MySQL][node-mysql], we also support these additional features:
0 commit comments