diff --git a/Readme.md b/Readme.md index 6508a130a..c18e29851 100644 --- a/Readme.md +++ b/Readme.md @@ -6,6 +6,49 @@ [![Build Status][travis-image]][travis-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) +- [Terminating connections](#terminating-connections) +- [Pooling connections](#pooling-connections) +- [Pool options](#pool-options) +- [Pool events](#pool-events) +- [Closing all the connections in a pool](#closing-all-the-connections-in-a-pool) +- [PoolCluster](#poolcluster) +- [PoolCluster Option](#poolcluster-option) +- [Switching users and altering connection state](#switching-users-and-altering-connection-state) +- [Server disconnects](#server-disconnects) +- [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 Streams2](#piping-results-with-streams2) +- [Multiple statement queries](#multiple-statement-queries) +- [Stored procedures](#stored-procedures) +- [Joins with overlapping column names](#joins-with-overlapping-column-names) +- [Transactions](#transactions) +- [Timeouts](#timeouts) +- [Error handling](#error-handling) +- [Exception Safety](#exception-safety) +- [Type casting](#type-casting) +- [Connection Flags](#connection-flags) +- [Debugging and reporting problems](#debugging-and-reporting-problems) +- [Running tests](#running-tests) +- [Todo](#todo) + ## Install ```sh @@ -197,9 +240,9 @@ fails assumed to be plaintext strings. The `ssl` option in the connection options takes a string or an object. When given a string, it uses one of the predefined SSL profiles included. The following profiles are included: -* `"Amazon RDS"`: this profile is for connecting to an Amazon RDS server and contains the - ca from https://rds.amazonaws.com/doc/rds-ssl-ca-cert.pem - +* `"Amazon RDS"`: this profile is for connecting to an Amazon RDS server and contains the + ca from https://rds.amazonaws.com/doc/rds-ssl-ca-cert.pem + When connecting to other servers, you will need to provide an object of options, in the same format as [crypto.createCredentials](http://nodejs.org/api/crypto.html#crypto_crypto_createcredentials_details). Please note the arguments expect a string of the certificate, not a file name to the @@ -441,7 +484,7 @@ var clusterConfig = { var poolCluster = mysql.createPoolCluster(clusterConfig); ``` -## Switching users / altering connection state +## Switching users and altering connection state MySQL offers a changeUser command that allows you to alter the current user and other aspects of the connection without shutting down the underlying socket: @@ -638,7 +681,7 @@ string, otherwise it will throw. This option is also required when fetching big numbers from the database, otherwise you will get values rounded to hundreds or thousands due to the precision limit. -## Getting the number of affected rows. +## Getting the number of affected rows You can get the number of affected rows from an insert, update or delete statement. @@ -650,7 +693,7 @@ connection.query('DELETE FROM posts WHERE title = "wrong"', function (err, resul }) ``` -## Getting the number of changed rows. +## Getting the number of changed rows You can get the number of changed rows from an update statement. @@ -726,11 +769,11 @@ stream individual row columns, they will always be buffered up entirely. If you have a good use case for streaming large fields to and from MySQL, I'd love to get your thoughts and contributions on this. -### Piping results with [Streams2](http://blog.nodejs.org/2012/12/20/streams2/) +### Piping results with Streams2 The query object provides a convenience method `.stream([options])` that wraps query events into a [Readable](http://nodejs.org/api/stream.html#stream_class_stream_readable) -Streams2 object. This stream can easily be piped downstream and provides +[Streams2](http://blog.nodejs.org/2012/12/20/streams2/) object. This stream can easily be piped downstream and provides automatic pause/resume, based on downstream congestion and the optional `highWaterMark`. The `objectMode` parameter of the stream is set to `true` by default.