-
Notifications
You must be signed in to change notification settings - Fork 0
Psharma/update readme #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,101 +14,151 @@ | |
| [starttls.js]: https://gist.github.com/TooTallNate/848444 | ||
| [node-mariasql]: https://github.com/mscdex/node-mariasql | ||
| [contributors]: https://github.com/sidorares/node-mysql2/graphs/contributors | ||
| [contributing]: https://github.com/sidorares/node-mysql2/blob/master/Contributing.md | ||
| [docs-base]: https://sidorares.github.io/node-mysql2/docs | ||
| [docs-base-zh-CN]: https://sidorares.github.io/node-mysql2/zh-CN/docs | ||
| [docs-base-pt-BR]: https://sidorares.github.io/node-mysql2/pt-BR/docs | ||
| [docs-prepared-statements]: https://sidorares.github.io/node-mysql2/docs/documentation/prepared-statements | ||
| [docs-mysql-server]: https://sidorares.github.io/node-mysql2/docs/documentation/mysql-server | ||
| [docs-promise-wrapper]: https://sidorares.github.io/node-mysql2/docs/documentation/promise-wrapper | ||
| [docs-authentication-switch]: https://sidorares.github.io/node-mysql2/docs/documentation/authentication-switch | ||
| [contributing]: https://github.com/singlestore-labs/singlestore-nodejs/blob/master/Contributing.md | ||
| [docs-base]: https://singlestore-labs.github.io/singlestore-nodejs/docs | ||
| [docs-api]: https://singlestore-labs.github.io/singlestore-nodejs/docs/api-and-configurations | ||
| [docs-prepared-statements]: https://singlestore-labs.github.io/singlestore-nodejs/docs/documentation/prepared-statements | ||
| [docs-mysql-server]: https://singlestore-labs.github.io/singlestore-nodejs/docs/documentation/mysql-server | ||
| [docs-promise-wrapper]: https://singlestore-labs.github.io/singlestore-nodejs/documentation/promise-wrapper | ||
| [docs-authentication-switch]: https://singlestore-labs.github.io/singlestore-nodejs/docs/documentation/authentication-switch | ||
| [docs-streams]: https://sidorares.github.io/node-mysql2/docs/documentation/extras | ||
| [docs-typescript-docs]: https://sidorares.github.io/node-mysql2/docs/documentation/typescript-examples | ||
| [docs-qs-pooling]: https://sidorares.github.io/node-mysql2/docs#using-connection-pools | ||
| [docs-qs-first-query]: https://sidorares.github.io/node-mysql2/docs#first-query | ||
| [docs-qs-using-prepared-statements]: https://sidorares.github.io/node-mysql2/docs#using-prepared-statements | ||
| [docs-examples]: https://sidorares.github.io/node-mysql2/docs/examples | ||
| [docs-faq]: https://sidorares.github.io/node-mysql2/docs/faq | ||
| [docs-documentation]: https://sidorares.github.io/node-mysql2/docs/documentation | ||
| [docs-contributing]: https://sidorares.github.io/node-mysql2/docs/contributing/website | ||
| [coverage]: https://img.shields.io/codecov/c/github/sidorares/node-mysql2 | ||
| [coverage-url]: https://app.codecov.io/github/sidorares/node-mysql2 | ||
| [ci-url]: https://github.com/sidorares/node-mysql2/actions/workflows/ci-coverage.yml?query=branch%3Amaster | ||
| [ci-image]: https://img.shields.io/github/actions/workflow/status/sidorares/node-mysql2/ci-coverage.yml?event=push&style=flat&label=CI&branch=master | ||
|
|
||
| # MySQL2 | ||
| [docs-qs-pooling]: https://singlestore-labs.github.io/singlestore-nodejs/docs#using-connection-pools | ||
| [docs-qs-first-query]: https://singlestore-labs.github.io/singlestore-nodejs/docs#first-query | ||
| [docs-qs-using-prepared-statements]: https://singlestore-labs.github.io/singlestore-nodejs/docs#using-prepared-statements | ||
| [docs-examples]: https://singlestore-labs.github.io/singlestore-nodejs/docs/examples | ||
| [docs-faq]: https://singlestore-labs.github.io/singlestore-nodejs/docs/faq | ||
| [docs-documentation]: https://singlestore-labs.github.io/singlestore-nodejs/docs/documentation | ||
| [docs-contributing]: https://singlestore-labs.github.io/singlestore-nodejs/docs/contributing | ||
| [tests-image]: https://github.com/singlestore-labs/singlestore-nodejs/actions/workflows/tests.yml/badge.svg?branch=master | ||
| [tests-url]: https://github.com/singlestore-labs/singlestore-nodejs/actions/workflows/tests.yml | ||
| [gh-pages-image]: https://github.com/singlestore-labs/singlestore-nodejs/actions/workflows/gh-pages.yml/badge.svg?branch=master | ||
| [gh-pages-url]: https://github.com/singlestore-labs/singlestore-nodejs/actions/workflows/gh-pages.yml | ||
|
|
||
| # SingleStore Node.js Driver | ||
|
|
||
| > SingleStore client for Node.js with focus on performance. Supports prepared statements, distributed queries, real-time analytics, compression, ssl and much more. | ||
|
|
||
| [![NPM Version][npm-image]][npm-url] | ||
| [![NPM Downloads][downloads-image]][downloads-url] | ||
| [![Node.js Version][node-version-image]][node-version-url] | ||
| [![GitHub Workflow Status (with event)][ci-image]][ci-url] | ||
| [![Codecov][coverage]][coverage-url] | ||
| [![Tests][tests-image]][tests-url] | ||
| [![GitHub Pages][gh-pages-image]][gh-pages-url] | ||
| [![License][license-image]][license-url] | ||
|
|
||
| [English][docs-base] | [简体中文][docs-base-zh-CN] | [Português (BR)][docs-base-pt-BR] | ||
|
|
||
| > MySQL client for Node.js with focus on performance. Supports prepared statements, non-utf8 encodings, binary log protocol, compression, ssl [much more][docs-documentation]. | ||
|
|
||
| **Table of Contents** | ||
| ## Table of Contents | ||
|
|
||
| - [History and Why MySQL2](#history-and-why-mysql2) | ||
| - [Why SingleStore Node.js Driver](#why-singlestore-nodejs-driver) | ||
| - [Installation](#installation) | ||
| - [Quick Start](#quick-start) | ||
| - [Features](#features) | ||
| - [Migration from MySQL2](#migration-from-mysql2) | ||
| - [Documentation](#documentation) | ||
| - [Acknowledgements](#acknowledgements) | ||
| - [Contributing](#contributing) | ||
| - [Acknowledgments](#acknowledgments) | ||
|
|
||
| ## History and Why MySQL2 | ||
|
|
||
| MySQL2 project is a continuation of [MySQL-Native][mysql-native]. Protocol parser code was rewritten from scratch and api changed to match popular [Node MySQL][node-mysql]. MySQL2 team is working together with [Node MySQL][node-mysql] team to factor out shared code and move it under [mysqljs][mysqljs] organization. | ||
|
|
||
| MySQL2 is mostly API compatible with [Node MySQL][node-mysql] and supports majority of features. MySQL2 also offers these additional features: | ||
| ## Why SingleStore Node.js Driver | ||
|
|
||
| - Faster / Better Performance | ||
| - [Prepared Statements][docs-prepared-statements] | ||
| - MySQL Binary Log Protocol | ||
| - [MySQL Server][docs-mysql-server] | ||
| - Extended support for Encoding and Collation | ||
| - [Promise Wrapper][docs-promise-wrapper] | ||
| - Compression | ||
| - SSL and [Authentication Switch][docs-authentication-switch] | ||
| - [Custom Streams][docs-streams] | ||
| - [Pooling][docs-qs-pooling] | ||
| The SingleStore Node.js Driver is a fork of MySQL2, adapted specifically for SingleStore database. Since SingleStore is MySQL wire-protocol compatible, most MySQL2 features work seamlessly, with additional optimizations for SingleStore's distributed architecture and analytics capabilities. | ||
|
|
||
| ## Installation | ||
| This driver offers these features optimized for SingleStore: | ||
|
|
||
| MySQL2 is free from native bindings and can be installed on Linux, Mac OS or Windows without any issues. | ||
| - **Faster / Better Performance** for distributed queries | ||
| - **Connection routing** to appropriate nodes (aggregator/leaf) | ||
| - **Support for ColumnStore and RowStore** tables | ||
| - **Real-time analytics** optimizations | ||
| - **Distributed query execution** handling | ||
| - **Pipeline data ingestion** support | ||
| - **Optimized batch inserts** for high-throughput scenarios | ||
| - All existing MySQL2 features (Prepared Statements, Pooling, etc.) | ||
|
|
||
| ## Installation | ||
|
|
||
| ```bash | ||
| npm install --save mysql2 | ||
| npm install singlestore-nodejs | ||
| ``` | ||
|
|
||
| If you are using TypeScript, you will need to install `@types/node`. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is still useful info |
||
|
|
||
| ```bash | ||
| npm install --save-dev @types/node | ||
| ## Quick Start | ||
|
|
||
| ```javascript | ||
| const singlestore = require('singlestore_nodejs'); | ||
|
|
||
| // Create connection | ||
| const connection = singlestore.createConnection({ | ||
| host: 'localhost', | ||
| user: 'root', | ||
| password: 'password', | ||
| database: 'mydb', | ||
| port: 3306, | ||
| }); | ||
|
|
||
| // Simple query | ||
| connection.query('SELECT * FROM users', (err, results, fields) => { | ||
| if (err) throw err; | ||
| console.log(results); | ||
| }); | ||
|
|
||
| // Using promises | ||
| connection | ||
| .promise() | ||
| .query('SELECT * FROM products') | ||
| .then(([rows, fields]) => { | ||
| console.log(rows); | ||
| }) | ||
| .catch(console.error); | ||
|
|
||
| // Close connection | ||
| connection.end(); | ||
| ``` | ||
|
|
||
| > For TypeScript documentation and examples, see [here][docs-typescript-docs]. | ||
| ## Features | ||
|
|
||
| - **High Performance**: Optimized for SingleStore's distributed architecture | ||
| - **Prepared Statements**: Binary protocol with prepared statements | ||
| - **Connection Pooling**: Built-in connection pool management | ||
| - **Promise Wrapper**: Native promise support | ||
| - **Compression**: Protocol compression support | ||
| - **SSL/TLS**: Secure connections | ||
| - **Transaction Support**: Full transaction support | ||
| - **Streaming**: Stream large result sets | ||
| - **TypeScript**: Full TypeScript definitions included | ||
|
|
||
|
Comment on lines
+122
to
+132
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this should be removed - let's keep original features in "History and Why MySQL2" and add new features to "SingleStore-Specific Features" |
||
| ## Migration from MySQL2 | ||
|
|
||
| SingleStore Node.js Driver is API-compatible with MySQL2, so migration is straightforward: | ||
|
|
||
| ```javascript | ||
| // Before (MySQL2) | ||
| const mysql = require('mysql2'); | ||
| const connection = mysql.createConnection({...}); | ||
|
|
||
| // After (SingleStore Node.js Driver) | ||
| const singlestore = require('singlestore_nodejs'); | ||
| const connection = singlestore.createConnection({...}); | ||
|
|
||
| // All existing queries work as-is! | ||
| ``` | ||
|
|
||
| ## Documentation | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's keep documentation on Github pages and simply link there |
||
|
|
||
| - [Quickstart][docs-base] | ||
| - [First Query][docs-qs-first-query], [Using Prepared Statements][docs-qs-using-prepared-statements], [Using Connection Pools][docs-qs-pooling] and more. | ||
| - [Documentation][docs-documentation] | ||
| 📚 **Full documentation:** [SingleStore Nodejs Driver][docs-base] | ||
|
|
||
| - [Getting Started][docs-documentation] | ||
| - [Examples][docs-examples] | ||
| - [FAQ][docs-faq] | ||
|
|
||
| ## Acknowledgements | ||
|
|
||
| - Internal protocol is written by [@sidorares][sidorares] [MySQL-Native][mysql-native]. | ||
| - Constants, SQL parameters interpolation, Pooling, `ConnectionConfig` class taken from [Node MySQL][node-mysql]. | ||
| - SSL upgrade code based on [@TooTallNate][TooTallNate] [code][starttls.js]. | ||
| - Secure connection / compressed connection api flags compatible to [MariaSQL][node-mariasql] client. | ||
| - [Contributors][contributors]. | ||
| - [API Reference][docs-api] | ||
|
|
||
| ## Contributing | ||
|
|
||
| Want to improve something in **MySQL2**? | ||
| Please check [Contributing.md][contributing] for detailed instruction on how to get started. | ||
| Contributions are welcome! Please see [Contributing.md](Contributing.md) for details. | ||
|
|
||
| ## Acknowledgments | ||
|
|
||
| To contribute in **MySQL2 Documentation**, please visit the [Website Contributing Guidelines][docs-contributing] for detailed instruction on how to get started. | ||
| 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. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,31 @@ | ||
| # API and Configuration | ||
|
|
||
| [node-mysql]: https://github.com/mysqljs/mysql | ||
| [node-mysql2]: https://github.com/sidorares/node-mysql2 | ||
| [singlestore-docs]: https://docs.singlestore.com/ | ||
|
|
||
| MySQL2 is mostly API compatible with [Node MySQL][node-mysql]. | ||
| 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. | ||
|
|
||
| ## Known Incompatibilities | ||
|
|
||
| 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. | ||
|
|
||
| ## Migration from MySQL2 | ||
|
|
||
| SingleStore Node.js Driver is API-compatible with MySQL2, so migration is straightforward: | ||
|
|
||
| ```javascript | ||
| // Before (MySQL2) | ||
| const mysql = require('mysql2'); | ||
| const connection = mysql.createConnection({...}); | ||
|
|
||
| // After (SingleStore Node.js Driver) | ||
| const singlestore = require('singlestore_nodejs'); | ||
| const connection = singlestore.createConnection({...}); | ||
|
|
||
| // All existing queries work as-is! | ||
| ``` | ||
|
|
||
| :::info | ||
| If you find any other incompatibility with [Node MySQL][node-mysql], Please report via Issue tracker. We will fix reported incompatibility on priority basis. | ||
| 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. | ||
| ::: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be removed before merging? Or replaced with
gh-pagesbranch name?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes , feature branch will be removed.