@types/mysql
Advanced tools
Comparing version 2.15.5 to 2.15.6
@@ -16,14 +16,55 @@ // Type definitions for mysql 2.15 | ||
export interface EscapeFunctions { | ||
/** | ||
* Escape an untrusted string to be used as a SQL value. Use this on user | ||
* provided data. | ||
* @param value Value to escape | ||
* @param stringifyObjects If true, don't convert objects into SQL lists | ||
* @param timeZone Convert dates from UTC to the given timezone. | ||
*/ | ||
escape(value: any, stringifyObjects?: boolean, timeZone?: string): string; | ||
/** | ||
* Escape an untrusted string to be used as a SQL identifier (database, | ||
* table, or column name). Use this on user provided data. | ||
* @param value Value to escape. | ||
* @param forbidQualified Don't allow qualified identifiers (eg escape '.') | ||
*/ | ||
escapeId(value: string, forbidQualified?: boolean): string; | ||
/** | ||
* Safely format a SQL query containing multiple untrusted values. | ||
* @param sql Query, with insertion points specified with ? (for values) or | ||
* ?? (for identifiers) | ||
* @param values Array of objects to insert. | ||
* @param stringifyObjects If true, don't convert objects into SQL lists | ||
* @param timeZone Convert dates from UTC to the given timezone. | ||
*/ | ||
format(sql: string, values: any[], stringifyObjects?: boolean, timeZone?: string): string; | ||
} | ||
// implements EscapeFunctions | ||
/** | ||
* Escape an untrusted string to be used as a SQL value. Use this on user | ||
* provided data. | ||
* @param value Value to escape | ||
* @param stringifyObjects If true, don't convert objects into SQL lists | ||
* @param timeZone Convert dates from UTC to the given timezone. | ||
*/ | ||
export function escape(value: any, stringifyObjects?: boolean, timeZone?: string): string; | ||
/** | ||
* Escape an untrusted string to be used as a SQL identifier (database, | ||
* table, or column name). Use this on user provided data. | ||
* @param value Value to escape. | ||
* @param forbidQualified Don't allow qualified identifiers (eg escape '.') | ||
*/ | ||
export function escapeId(value: string, forbidQualified?: boolean): string; | ||
/** | ||
* Safely format a SQL query containing multiple untrusted values. | ||
* @param sql Query, with insertion points specified with ? (for values) or | ||
* ?? (for identifiers) | ||
* @param values Array of objects to insert. | ||
* @param stringifyObjects If true, don't convert objects into SQL lists | ||
* @param timeZone Convert dates from UTC to the given timezone. | ||
*/ | ||
export function format(sql: string, values: any[], stringifyObjects?: boolean, timeZone?: string): string; | ||
@@ -37,2 +78,8 @@ | ||
/** | ||
* Create a string that will be inserted unescaped with format(), escape(). | ||
* Note: the value will still be escaped if used as an identifier (??) by | ||
* format(). | ||
* @param sql | ||
*/ | ||
export function raw(sql: string): () => string; | ||
@@ -74,9 +121,25 @@ | ||
/** | ||
* Close the connection. Any queued data (eg queries) will be sent first. If | ||
* there are any fatal errors, the connection will be immediately closed. | ||
* @param callback Handler for any fatal error | ||
*/ | ||
end(callback?: (err: MysqlError, ...args: any[]) => void): void; | ||
end(options: any, callback: (err: MysqlError, ...args: any[]) => void): void; | ||
/** | ||
* Close the connection immediately, without waiting for any queued data (eg | ||
* queries) to be sent. No further events or callbacks will be triggered. | ||
*/ | ||
destroy(): void; | ||
/** | ||
* Pause the connection. No more 'result' events will fire until resume() is | ||
* called. | ||
*/ | ||
pause(): void; | ||
/** | ||
* Resume the connection. | ||
*/ | ||
resume(): void; | ||
@@ -86,2 +149,5 @@ | ||
/** | ||
* Set handler to be run when the connection is closed. | ||
*/ | ||
on(ev: 'end', callback: (err?: MysqlError) => void): Connection; | ||
@@ -91,7 +157,18 @@ | ||
/** | ||
* Set handler to be run when a a fatal error occurs. | ||
*/ | ||
on(ev: 'error', callback: (err: MysqlError) => void): Connection; | ||
on(ev: 'enqueue', callback: (...args: any[]) => void): Connection; | ||
/** | ||
* Set handler to be run when a callback has been queued to wait for an | ||
* available connection. | ||
*/ | ||
// tslint:disable-next-line:unified-signatures | ||
on(ev: 'enqueue', callback: (err?: MysqlError) => void): Connection; | ||
on(ev: string, callback: (...args: any[]) => void): this; | ||
/** | ||
* Set handler to be run on a certain event. | ||
*/ | ||
on(ev: string, callback: (...args: any[]) => void): Connection; | ||
} | ||
@@ -102,4 +179,13 @@ | ||
/** | ||
* Close the connection. Any queued data (eg queries) will be sent first. If | ||
* there are any fatal errors, the connection will be immediately closed. | ||
* @param callback Handler for any fatal error | ||
*/ | ||
end(): void; | ||
/** | ||
* Close the connection immediately, without waiting for any queued data (eg | ||
* queries) to be sent. No further events or callbacks will be triggered. | ||
*/ | ||
destroy(): void; | ||
@@ -117,2 +203,7 @@ } | ||
/** | ||
* Close the connection. Any queued data (eg queries) will be sent first. If | ||
* there are any fatal errors, the connection will be immediately closed. | ||
* @param callback Handler for any fatal error | ||
*/ | ||
end(callback?: (err: MysqlError) => void): void; | ||
@@ -122,8 +213,39 @@ | ||
on(ev: 'connection' | 'acquire' | 'release', callback: (connection: PoolConnection) => void): Pool; | ||
/** | ||
* Set handler to be run when a new connection is made within the pool. | ||
*/ | ||
on(ev: 'connection', callback: (connection: PoolConnection) => void): Pool; | ||
/** | ||
* Set handler to be run when a connection is acquired from the pool. This | ||
* is called after all acquiring activity has been performed on the | ||
* connection, right before the connection is handed to the callback of the | ||
* acquiring code. | ||
*/ | ||
// tslint:disable-next-line:unified-signatures | ||
on(ev: 'acquire', callback: (connection: PoolConnection) => void): Pool; | ||
/** | ||
* Set handler to be run when a connection is released back to the pool. | ||
* This is called after all release activity has been performed on the | ||
* connection, so the connection will be listed as free at the time of the | ||
* event. | ||
*/ | ||
// tslint:disable-next-line:unified-signatures | ||
on(ev: 'release', callback: (connection: PoolConnection) => void): Pool; | ||
/** | ||
* Set handler to be run when a a fatal error occurs. | ||
*/ | ||
on(ev: 'error', callback: (err: MysqlError) => void): Pool; | ||
/** | ||
* Set handler to be run when a callback has been queued to wait for an | ||
* available connection. | ||
*/ | ||
on(ev: 'enqueue', callback: (err?: MysqlError) => void): Pool; | ||
/** | ||
* Set handler to be run on a certain event. | ||
*/ | ||
on(ev: string, callback: (...args: any[]) => void): Pool; | ||
@@ -139,2 +261,7 @@ } | ||
/** | ||
* Close the connection. Any queued data (eg queries) will be sent first. If | ||
* there are any fatal errors, the connection will be immediately closed. | ||
* @param callback Handler for any fatal error | ||
*/ | ||
end(callback?: (err: MysqlError) => void): void; | ||
@@ -156,5 +283,11 @@ | ||
/** | ||
* Set handler to be run on a certain event. | ||
*/ | ||
on(ev: string, callback: (...args: any[]) => void): PoolCluster; | ||
on(ev: 'remove' | 'offline' | 'remove', callback: (nodeId: string) => void): PoolCluster; | ||
/** | ||
* Set handler to be run when a node is removed or goes offline. | ||
*/ | ||
on(ev: 'remove' | 'offline', callback: (nodeId: string) => void): PoolCluster; | ||
} | ||
@@ -227,3 +360,3 @@ | ||
export interface GeometryType extends Array<{x: number, y: number} | GeometryType> { | ||
export interface GeometryType extends Array<{ x: number, y: number } | GeometryType> { | ||
x: number; | ||
@@ -235,4 +368,4 @@ y: number; | ||
(field: FieldInfo | ||
& { type: string, length: number, string(): string, buffer(): Buffer, geometry(): null | GeometryType}, | ||
next: () => void) => any); | ||
& { type: string, length: number, string(): string, buffer(): Buffer, geometry(): null | GeometryType }, | ||
next: () => void) => any); | ||
@@ -239,0 +372,0 @@ export type queryCallback = (err: MysqlError | null, results?: any, fields?: FieldInfo[]) => void; |
{ | ||
"name": "@types/mysql", | ||
"version": "2.15.5", | ||
"version": "2.15.6", | ||
"description": "TypeScript definitions for mysql", | ||
@@ -29,5 +29,7 @@ "license": "MIT", | ||
"main": "", | ||
"types": "index", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git" | ||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", | ||
"directory": "types/mysql" | ||
}, | ||
@@ -38,4 +40,4 @@ "scripts": {}, | ||
}, | ||
"typesPublisherContentHash": "5ab0640250fb34af9e11026236c9009f506a78be9ddd17745a348947c3766d6f", | ||
"typesPublisherContentHash": "7aa2a438d012a42eedaa7188f99199299ca19ff63b757fde81acad2a4fd94a11", | ||
"typeScriptVersion": "2.1" | ||
} |
@@ -5,3 +5,3 @@ # Installation | ||
# Summary | ||
This package contains type definitions for mysql (https://github.com/mysqljs/mysql). | ||
This package contains type definitions for mysql ( https://github.com/mysqljs/mysql ). | ||
@@ -12,4 +12,4 @@ # Details | ||
Additional Details | ||
* Last updated: Thu, 31 May 2018 20:09:03 GMT | ||
* Dependencies: stream, tls, node | ||
* Last updated: Tue, 23 Apr 2019 20:13:46 GMT | ||
* Dependencies: @types/node | ||
* Global values: none | ||
@@ -16,0 +16,0 @@ |
Sorry, the diff of this file is not supported yet
26484
588