docs: spelling and general improvements

This commit is contained in:
Daniel Lang 2017-10-03 18:14:37 +02:00
parent 7c5adbf23f
commit 76d177abda
4 changed files with 113 additions and 95 deletions

View File

@ -1,21 +1,20 @@
# Active Record vs Data Mapper
* [What is Active Record?](#what-is-active-record)
* [What is Data Mapper?](#what-is-data-mapper)
* [What is the Active Record pattern?](#what-is-the-active-record-pattern)
* [What is the Data Mapper pattern?](#what-is-the-data-mapper-pattern)
* [Which one should I choose?](#which-one-should-i-choose)
## What is Active Record?
## What is the Active Record pattern?
In TypeORM you can use both Active Record and Data Mapper patterns.
In TypeORM you can use both, the Active Record and the Data Mapper patterns.
Using Active Record approach you define all your query methods inside model itself,
and you save, remove, load objects using model methods.
Using the Active Record approach, you define all your query methods inside the model itself, and you save, remove and load objects using model methods.
Simply said active record is an approach to access your database within your models.
You can read more about active record on [wikipedia](https://en.wikipedia.org/wiki/Active_record_pattern).
Simply said the Active Record pattern is an approach to access your database within your models.
You can read more about the Active Record pattern on [Wikipedia](https://en.wikipedia.org/wiki/Active_record_pattern).
Example:
```typescript
import {BaseEntity, Entity, PrimaryGeneratedColumn, Column} from "typeorm";
@ -37,7 +36,7 @@ export class User extends BaseEntity {
}
```
All active-record entities must extend `BaseEntity` class which provides methods to work with entity.
All active-record entities must extend the `BaseEntity` class which provides methods to work with the entity.
Example how to work with such entity:
```typescript
@ -59,9 +58,9 @@ const timber = await User.findOne({ firstName: "Timber", lastName: "Saw" });
```
`BaseEntity` has most of methods standard `Repository` has.
Most of times you don't need to use `Repository` or `EntityManager` with active record entities.
Most of the times you don't need to use `Repository` or `EntityManager` with active record entities.
Now lets say we want to create a function that returns users by first and last names.
Now let's say we want to create a function that returns users by first and last names.
We can create such function as a static method in a `User` class:
```typescript
@ -98,19 +97,19 @@ And use it just like other methods:
const timber = await User.findByName("Timber", "Saw");
```
## What is Data Mapper?
## What is the Data Mapper pattern?
In TypeORM you can use both Active Record and Data Mapper patterns.
Using Data Mapper approach you define all your query methods separate classes called "repositories",
Using the Data Mapper, approach you define all your query methods separate classes called "repositories",
and you save, remove, load objects using repositories.
In data mapper your entities are very dumb - they just define their properties and may have some "dummy" methods.
Simply said data mapper is an approach to access your database within repositories instead of models.
You can read more about data mapper on [wikipedia](https://en.wikipedia.org/wiki/Data_mapper_pattern).
You can read more about data mapper on [Wikipedia](https://en.wikipedia.org/wiki/Data_mapper_pattern).
Example:
```typescript
import {BaseEntity, Entity, PrimaryGeneratedColumn, Column} from "typeorm";
@ -152,7 +151,7 @@ const newUsers = await userRepository.find({ isActive: true });
const timber = await userRepository.findOne({ firstName: "Timber", lastName: "Saw" });
```
Now lets say we want to create a function that returns users by first and last names.
Now let's say we want to create a function that returns users by first and last names.
We can create such function in a "custom repository".
```typescript
@ -183,10 +182,10 @@ For more information about custom repositories refer [this documentation](workin
## Which one should I choose?
Decision is up to you.
The decision is up to you.
Both strategies have their own cons and pros.
One thing we should always keep in mind in software development is how we are going to maintain it.
`Data Mapper` approach helps you to keep maintainability of your software in a bigger apps more effective.
`Active record` approach helps you to keep things simple which work good in a small apps.
The `Data Mapper` approach helps you to keep maintainability of your software which is more effective in bigger apps.
The `Active record` approach helps you to keep things simple which work good in a small apps.
And simplicity is always a key to better maintainability.

View File

@ -1,7 +1,7 @@
# Caching queries
You can cache results selected by a `QueryBuilder` methods: `getMany`, `getOne`, `getRawMany`, `getRawOne` and `getCount`.
To enable caching you need to explicitly enable it in connection options:
You can cache results selected by these `QueryBuilder` methods: `getMany`, `getOne`, `getRawMany`, `getRawOne` and `getCount`.
To enable caching you need to explicitly enable it in your connection options:
```typescript
{
@ -14,7 +14,7 @@ To enable caching you need to explicitly enable it in connection options:
```
When you enable cache for the first time,
you must synchronize your database schema (using cli, migrations or simply option in connection).
you must synchronize your database schema (using CLI, migrations or the `synchronize` connection option).
Then in `QueryBuilder` you can enable query cache for any query:
@ -26,12 +26,12 @@ const users = await connection
.getMany();
```
This will execute query to fetch all admin users and cache its result.
Next time when you execute same code it will get admin users from cache.
This will execute a query to fetch all admin users and cache its result.
Next time when you execute same code it will get admin users from the cache.
Default cache time is equal to `1000 ms`, e.g. 1 second.
It means cache will be invalid in 1 second after you first time call query builder code.
In practice it means if users open user page 150 times within 3 seconds only three queries will be executed during this period.
All other inserted users during 1 second of caching won't be returned to user.
This means cache will be invalid 1 second after you called the query builder code.
In practice, it means that if users open user page 150 times within 3 seconds only three queries will be executed during this period.
All users instered during the 1 second of caching won't be returned to the user.
You can change cache time manually:
@ -57,7 +57,7 @@ Or globally in connection options:
}
```
Also you can set a "cache id":
Also, you can set a "cache id":
```typescript
const users = await connection
@ -68,16 +68,16 @@ const users = await connection
```
It will allow you to granular control your cache,
for example clear cached results when you insert a new user:
for example, clear cached results when you insert a new user:
```typescript
await connection.queryResultCache.remove(["users_admins"]);
```
By default, TypeORM uses separate table called `query-result-cache` and stores all queries and results there.
By default, TypeORM uses a separate table called `query-result-cache` and stores all queries and results there.
If storing cache in a single database table is not effective for you,
you can change cache type to "redis" and TypeORM will store all cache records in redis instead.
you can change the cache type to "redis" and TypeORM will store all cached records in redis instead.
Example:
```typescript
@ -98,4 +98,4 @@ Example:
"options" are [redis specific options](https://github.com/NodeRedis/node_redis#options-object-properties).
You can use `typeorm cache:clear` command to clear everything stored in cache.
You can use `typeorm cache:clear` to clear everything stored in the cache.

View File

@ -47,7 +47,7 @@ const connection = await createConnections([{
}]);
```
* `getConnectionManager()` - Gets connection manager which stores all created (using `createConnection` method) connections.
* `getConnectionManager()` - Gets connection manager which stores all created (using `createConnection()` or `createConnections()`) connections.
```typescript
import {getConnectionManager} from "typeorm";
@ -79,7 +79,7 @@ const secondaryManager = getEntityManager("secondary-connection");
// you can use secondary connection manager methods
```
* `getRepository()` - Gets some entity's `Repository` from connection.
* `getRepository()` - Gets `Repository` for given entity from connection.
Connection name can be specified to indicate what connection's entity manager should be taken.
```typescript
@ -92,7 +92,7 @@ const blogRepository = getRepository(Blog, "secondary-connection");
// you can use secondary connection repository methods
```
* `getTreeRepository()` - Gets some entity's `TreeRepository` from connection.
* `getTreeRepository()` - Gets `TreeRepository` for given entity from connection.
Connection name can be specified to indicate what connection's entity manager should be taken.
```typescript
@ -105,7 +105,7 @@ const blogRepository = getTreeRepository(Blog, "secondary-connection");
// you can use secondary connection repository methods
```
* `getMongoRepository()` - Gets some entity's `MongoRepository` from connection.
* `getMongoRepository()` - Gets `MongoRepository` for given entity from connection.
Connection name can be specified to indicate what connection's entity manager should be taken.
```typescript
@ -120,7 +120,7 @@ const blogRepository = getMongoRepository(Blog, "secondary-connection");
## `Connection` API
* `name` - Connection name. If you created nameless connection then its equal to "default".
* `name` - Connection name. If you created nameless connection then it's equal to "default".
You use this name when you work with multiple connections and call `getConnection(connectionName: string)`
```typescript
@ -128,14 +128,15 @@ const connectionName: string = connection.name;
```
* `options` - Connection options used to create this connection.
For more information about connection options see [Connection Options](./connection-options.md) documentation.
Learn more about [Connection Options](./connection-options.md).
```typescript
const connectionOptions: ConnectionOptions = connection.options;
// you can cast connectionOptions to MysqlConnectionOptions or any other xxxConnectionOptions depend on database driver you use
// you can cast connectionOptions to MysqlConnectionOptions
// or any other xxxConnectionOptions depending on the database driver you use
```
* `isConnected` - Indicates if real connection to the database is established.
* `isConnected` - Indicates if a real connection to the database is established.
```typescript
const isConnected: boolean = connection.isConnected;
@ -145,11 +146,12 @@ const isConnected: boolean = connection.isConnected;
```typescript
const driver: Driver = connection.driver;
// you can cast connectionOptions to MysqlDriver or any other xxxDriver depend on database driver you use
// you can cast connectionOptions to MysqlDriver
// or any other xxxDriver depending on the database driver you use
```
* `manager` - `EntityManager` used to work with connection entities.
For more information about EntityManager see [Entity Manager and Repository](working-with-entity-manager.md) documentation.
Learn more about [Entity Manager and Repository](working-with-entity-manager.md).
```typescript
const manager: EntityManager = connection.manager;
@ -167,21 +169,21 @@ const user = await manager.findOneById(1);
```
* `connect` - Performs connection to the database.
When you use `createConnection` method it automatically calls this method and you usually don't need to call it by yourself.
When you use `createConnection` it automatically calls `connect` and you don't need to call it yourself.
```typescript
await connection.connect();
```
* `close` - Closes connection with the database.
Usually you call this method when your application is shutdown.
Usually, you call this method when your application is shutting down.
```typescript
await connection.close();
```
* `synchronize` - Synchronizes database schema. When `synchronize: true` is set in connection options it calls exactly this method.
Usually you call this method when your application is shutdown.
* `synchronize` - Synchronizes database schema. When `synchronize: true` is set in connection options it calls this method.
Usually, you call this method when your application is shuting down.
```typescript
await connection.synchronize();
@ -208,7 +210,7 @@ await connection.undoLastMigration();
```
* `hasMetadata` - Checks if metadata for a given entity is registered.
Learn more about metadata in [Entity Metadata](./entity-metadata.md) documentation.
Learn more about [Entity Metadata](./entity-metadata.md).
```typescript
if (connection.hasMetadata(User))
@ -217,7 +219,7 @@ if (connection.hasMetadata(User))
* `getMetadata` - Gets `EntityMetadata` of the given entity.
You can also specify a table name and if entity metadata with such table name is found it will be returned.
Learn more about metadata in [Entity Metadata](./entity-metadata.md) documentation.
Learn more about [Entity Metadata](./entity-metadata.md).
```typescript
const userMetadata = connection.getMetadata(User);
@ -226,7 +228,7 @@ const userMetadata = connection.getMetadata(User);
* `getRepository` - Gets `Repository` of the given entity.
You can also specify a table name and if repository for given table is found it will be returned.
Learn more about repositories in [Repository](working-with-entity-manager.md) documentation.
Learn more about [Repositories](working-with-entity-manager.md).
```typescript
const repository = connection.getRepository(User);
@ -236,7 +238,7 @@ const users = await repository.findOneById(1);
* `getTreeRepository` - Gets `TreeRepository` of the given entity.
You can also specify a table name and if repository for given table is found it will be returned.
Learn more about repositories in [Repository](working-with-entity-manager.md) documentation.
Learn more about [Repositories](working-with-entity-manager.md).
```typescript
const repository = connection.getTreeRepository(Category);
@ -244,9 +246,9 @@ const repository = connection.getTreeRepository(Category);
const categories = await repository.findTrees();
```
* `getMongoRepository` - Gets `getMongoRepository` of the given entity.
* `getMongoRepository` - Gets `MongoRepository` of the given entity.
This repository is used for entities in MongoDB connection.
Learn more about mongodb support refer to [MongoDB documentation](./mongodb.md).
Learn more about [MongoDB support](./mongodb.md).
```typescript
const repository = connection.getMongoRepository(User);
@ -257,7 +259,7 @@ const category2 = await categoryCursor.next();
```
* `getCustomRepository` - Gets customly defined repository.
Learn more about custom repositories in [Repository](working-with-entity-manager.md) documentation.
Learn more about [custom repositories](working-with-entity-manager.md).
```typescript
const userRepository = connection.getCustomRepository(UserRepository);
@ -266,7 +268,7 @@ const crazyUsers = await userRepository.findCrazyUsers();
```
* `transaction` - Provides a single transaction where multiple database requests will be executed in a single database transaction.
Learn more about transactions in [Transactions](./transactions.md) documentation.
Learn more about [Transactions](./transactions.md).
```typescript
await connection.transaction(async manager => {
@ -282,8 +284,8 @@ await connection.transaction(async manager => {
const rawData = await connection.query(`SELECT * FROM USERS`);
```
* `createQueryBuilder` - Creates a query builder use to build SQL queries.
Learn more about query builder in [QueryBuilder](select-query-builder.md) documentation.
* `createQueryBuilder` - Creates a query builder, which can be used to build queries.
Learn more about [QueryBuilder](select-query-builder.md).
```typescript
const users = await connection.createQueryBuilder()
@ -293,13 +295,13 @@ const users = await connection.createQueryBuilder()
.getMany();
```
* `createQueryRunner` - Creates a query runner used to work with a single real database connection, manage it and work with it.
Learn more about query runners in [QueryRunner](./query-runner.md) documentation.
* `createQueryRunner` - Creates a query runner used manage and work with a single real database connection.
Learn more about [QueryRunner](./query-runner.md).
```typescript
const queryRunner = connection.createQueryRunner();
// you can use it methods only after you call connect method
// you can use its methods only after you call connect
// which performs real database connection
await queryRunner.connect();
@ -331,7 +333,7 @@ const defaultConnection = connectionManager.get("default");
const secondaryConnection = connectionManager.get("secondary");
```
* `has` - Checks if connection is registered in the given connection manager.
* `has` - Checks if a connection is registered in the given connection manager.
```typescript
if (connectionManager.has("default")) {

View File

@ -4,24 +4,26 @@
* [Common connection options](#common-connection-options)
* [`mysql` / `mariadb` connection options](#mysql--mariadb-connection-options)
* [`postgres` connection options](#postgres-connection-options)
* [`sqlite` / `websql` connection options](#sqlite--websql-connection-options)
* [`sqlite` connection options](#sqlite-connection-options)
* [`websql` connection options](#websql-connection-options)
* [`cordova` connection options](#cordova-connection-options)
* [`mssql` connection options](#mssql-connection-options)
* [`mongodb` connection options](#mongodb-connection-options)
* [Connection options example](#connection-options-example)
## What is `ConnectionOptions`
Connection options is a connection configuration object you pass to `createConnection` method
Connection options is a connection configuration object you pass to `createConnection`
or create in `ormconfig` file. Different drivers have their own specific connection options.
## Common connection options
* `type` - Database type. You must specify what database engine you use.
Possible values are "mysql", "postgres", "mariadb", "sqlite", "oracle", "mssql", "websql", "mongodb".
Possible values are "mysql", "postgres", "mariadb", "sqlite", "cordova", "oracle", "mssql", "websql", "mongodb".
This option is required.
* `name` - Connection name. You'll use it to get connection you need using `getConnection(name: string)`
or `ConnectionManager.get(name: string)` methods.
or `ConnectionManager.get(name: string)`.
Connection names for different connections cannot be same - they all must be unique.
If connection name is not given then it will be called "default".
@ -29,59 +31,59 @@ If connection name is not given then it will be called "default".
Use it if you want to pass extra settings to underlying database driver.
* `entities` - Entities to be loaded and used for this connection.
Accepts both entity classes and directories where from they must to be loaded.
Accepts both entity classes and directories paths to load from.
Directories support glob patterns.
Example: `entities: [Post, Category, "entity/*.js", "modules/**/entity/*.js"]`.
For more information about entities refer to [Entities](./entities.md) documentation.
Learn more about [Entities](./entities.md).
* `subscribers` - Subscribers to be loaded and used for this connection.
Accepts both entity classes and directories where from they must to be loaded.
Accepts both entity classes and directories to load from.
Directories support glob patterns.
Example: `subscribers: [PostSubscriber, AppSubscriber, "subscriber/*.js", "modules/**/subscriber/*.js"]`.
For more information about subscribers refer to [Subscribers](listeners-and-subscribers.md) documentation.
Learn more about [Subscribers](listeners-and-subscribers.md).
* `entitySchemas` - Entity schemas to be loaded and used for this connection.
Accepts both entity schema classes and directories where from they must to be loaded.
Accepts both entity schema classes and directories to load from.
Directories support glob patterns.
Example: `entitySchemas: [PostSchema, CategorySchema, "entity-schema/*.json", "modules/**/entity-schema/*.json"]`.
For more information about subscribers refer to [Entity Schemas](./schema-in-files.md) documentation.
Learn more about [Entity Schemas](./schema-in-files.md).
* `migrations` - Migrations to be loaded and used for this connection.
Accepts both migration classes and directories where from they must to be loaded.
Accepts both migration classes and directories to load from.
Directories support glob patterns.
Example: `migrations: [FirstMigration, SecondMigration, "migration/*.js", "modules/**/migration/*.js"]`.
For more information about migrations refer to [Migrations](./migrations.md) documentation.
Learn more about [Migrations](./migrations.md).
* `logging` - Indicates if logging is enabled or not.
If set to `true` then query and error logging will be enabled.
You can also specify different types of logging to be enabled, for example `["query", "error", "schema"]`.
For more information about logging refer to [Logging](./logging.md) documentation.
Learn more about [Logging](./logging.md).
* `logger` - Logger to be used for logging purposes. Possible values are "advanced-console", "simple-console" and "file".
Default is "advanced-console". You can also specify a logger class that implements `Logger` interface.
For more information about logging refer to [Logging](./logging.md) documentation.
Learn more about [Logging](./logging.md).
* `maxQueryExecutionTime` - If query execution time exceed this given max execution time (in milliseconds)
then logger will log this query.
* `namingStrategy` - Naming strategy to be used to name tables and columns in the database.
Refer to [Naming strategy](./naming-strategy.md) documentation for more information.
Learn more about [Naming strategies](./naming-strategy.md).
* `entityPrefix` - Prefixes with the given string all tables (or collections) on this database connection.
* `dropSchema` - Drops the schema each time connection is being established.
Be careful with this option and don't use this in production - otherwise you'll loose all production data.
Be careful with this option and don't use this in production - otherwise you'll lose all production data.
This option is useful during debug and development.
* `synchronize` - Indicates if database schema should be auto created on every application launch.
Be careful with this option and don't use this in production - otherwise you can loose production data.
This option is useful during debug and development.
Alternative to it, you can use CLI and run schema:sync command.
As an alternative to it, you can use CLI and run schema:sync command.
Note that for MongoDB database it does not create schema, because MongoDB is schemaless.
Instead, it syncs just by creating indices.
* `migrationsRun` - Indicates if migrations should be auto run on every application launch.
Alternative to it, you can use CLI and run migrations:run command.
As an alternative, you can use CLI and run migrations:run command.
* `cli.entitiesDir` - Directory where entities should be created by default by CLI.
@ -104,10 +106,9 @@ Alternative to it, you can use CLI and run migrations:run command.
* `database` - Database name.
* `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`).
(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` - he timezone configured on the MySQL server. This is used to type cast server date/time
* `timezone` - the timezone configured on the MySQL server. This is used to typecast 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`)
@ -128,7 +129,7 @@ objects only when they cannot be accurately represented with
(which happens when they exceed the `[-2^53, +2^53]` range), otherwise they will be returned as
Number objects. This option is ignored if `supportBigNumbers` is disabled.
* `dateStrings` - Force date types (`TIMESTAMP`, `DATETIME`, `DATE`) to be returned as strings rather then
* `dateStrings` - Force date types (`TIMESTAMP`, `DATETIME`, `DATE`) to be returned as strings rather than
inflated into JavaScript Date objects. Can be true/false or an array of type names to keep as strings.
(Default: `false`)
@ -144,7 +145,7 @@ of SQL injection attacks. (Default: `false`)
* `flags` - List of connection flags to use other than the default ones. It is also possible to blacklist default ones.
For more information, check [Connection Flags](https://github.com/mysqljs/mysql#connection-flags).
* `ssl` - object with ssl parameters or a string containing name of ssl profile.
* `ssl` - object with ssl parameters or a string containing the name of ssl profile.
See [SSL options](https://github.com/mysqljs/mysql#ssl-options).
## `postgres` connection options
@ -165,10 +166,26 @@ See [SSL options](https://github.com/mysqljs/mysql#ssl-options).
* `ssl` - Object with ssl parameters. See [TLS/SSL](https://node-postgres.com/features/ssl).
## `sqlite` / `websql` connection options
## `sqlite` connection options
* `database` - Database path. For example "./mydb.sql"
## `websql` connection options
* `database` - Database name
* `version` - Version number of the database
* `description` - Database description
* `size` - The size of the database
## `cordova`connection options
* `database` - Database name
* `location` - Where to save the database. See [cordova-sqlite-storage](https://github.com/litehelpers/Cordova-sqlite-storage#opening-a-database) for options.
## `mssql` connection options
* `url` - Connection url where perform connection to.
@ -185,7 +202,7 @@ See [SSL options](https://github.com/mysqljs/mysql#ssl-options).
* `schema` - Schema name. Default is "public".
* `domain` - Once you set domain, driver will connect to SQL Server using domain login.
* `domain` - Once you set domain, the driver will connect to SQL Server using domain login.
* `connectionTimeout` - Connection timeout in ms (default: `15000`).
@ -194,7 +211,7 @@ See [SSL options](https://github.com/mysqljs/mysql#ssl-options).
* `stream` - Stream recordsets/rows instead of returning them all at once as an argument of callback (default: `false`).
You can also enable streaming for each request independently (`request.stream = true`). Always set to `true` if you plan to
work with large amount of rows.
work with a large amount of rows.
* `pool.max` - The maximum number of connections there can be in the pool (default: `10`).
@ -227,7 +244,7 @@ See [SSL options](https://github.com/mysqljs/mysql#ssl-options).
Default `-1` (nothing can get evicted).
* `pool.idleTimeoutMillis` - the minimum amount of time that an object may sit idle in the pool before it is eligible for
eviction due to idle time. Supercedes `softIdleTimeoutMillis`. Default: `30000`.
eviction due to idle time. Supersedes `softIdleTimeoutMillis`. Default: `30000`.
* `options.fallbackToDefaultDb` - By default, if the database requestion by `options.database` cannot be accessed, the connection
will fail with an error. However, if `options.fallbackToDefaultDb` is set to `true`, then the user's default database will
@ -247,7 +264,7 @@ See [SSL options](https://github.com/mysqljs/mysql#ssl-options).
error is encountered during the given transaction's execution. This sets the value for `SET XACT_ABORT` during the
initial SQL phase of a connection ([documentation](http://msdn.microsoft.com/en-us/library/ms188792.aspx)).
* `options.localAddress` - A string indicating which network interface (ip addres) to use when connecting to SQL Server.
* `options.localAddress` - A string indicating which network interface (ip address) to use when connecting to SQL Server.
* `options.useColumnNames` - A boolean determining whether to return rows as arrays or key-value collections. (default: `false`).
@ -274,7 +291,7 @@ See [SSL options](https://github.com/mysqljs/mysql#ssl-options).
(default: `READ_COMMITTED`)
* `options.readOnlyIntent` - A boolean, determining whether the connection will request read only access from a
* `options.readOnlyIntent` - A boolean, determining whether the connection will request read-only access from a
SQL Server Availability Group. For more information, see here. (default: `false`).
* `options.encrypt` - A boolean determining whether or not the connection will be encrypted. Set to true if you're
@ -288,14 +305,14 @@ See [SSL options](https://github.com/mysqljs/mysql#ssl-options).
See done, [doneInProc](http://tediousjs.github.io/tedious/api-request.html#event_doneInProc)
and [doneProc](http://tediousjs.github.io/tedious/api-request.html#event_doneProc). (default: `false`)
Caution: If many row are received, enabling this option could result in excessive memory usage.
Caution: If many rows are received, enabling this option could result in excessive memory usage.
* `options.rowCollectionOnRequestCompletion` - A boolean, that when true will expose received rows
in Requests' completion callback. See [new Request](http://tediousjs.github.io/tedious/api-request.html#function_newRequest). (default: `false`)
Caution: If many row are received, enabling this option could result in excessive memory usage.
Caution: If many rows are received, enabling this option could result in excessive memory usage.
* `options.tdsVersion` - The version of TDS to use. If server doesn't support specified version, negotiated version
* `options.tdsVersion` - The version of TDS to use. If the server doesn't support the specified version, a negotiated version
is used instead. The versions are available from `require('tedious').TDS_VERSION`.
* `7_1`
* `7_2`
@ -327,7 +344,7 @@ See [SSL options](https://github.com/mysqljs/mysql#ssl-options).
* `database` - Database name.
* `poolSize` - Set the maximum poolSize for each individual server or proxy connection.
* `poolSize` - Set the maximum pool size for each individual server or proxy connection.
* `ssl` - Use ssl connection (needs to have a mongod server with ssl support). Default: `false`.
@ -428,7 +445,7 @@ See [SSL options](https://github.com/mysqljs/mysql#ssl-options).
## Connection options example
Here is small example of connection options for mysql:
Here is a small example of connection options for mysql:
```typescript
{