开发指南 Reference Source

Function

Static Public Summary
public

format(arr: unknown[], dialect: AbstractDialect): *

this function was deprecated. use {@link injectReplacements} instead. This method has been removed in v7.
public

formatNamedParameters(sql: string, parameters: object, dialect: AbstractDialect): *

this function was deprecated. use {@link injectReplacements} instead. This method has been removed in v7.
public

injectReplacements(sqlString: *, dialect: *, replacements: *): *

Inlines replacements in places where they would be valid SQL values.

public

safeStringifyJson(value: any): string

Stringify a value as JSON with some differences:

  • bigints are stringified as a json string.

Static Public

public format(arr: unknown[], dialect: AbstractDialect): * source

this function was deprecated. use {@link injectReplacements} instead. This method has been removed in v7.

Params:

NameTypeAttributeDescription
arr unknown[]

first item is the SQL, following items are the positional replacements.

dialect AbstractDialect

Return:

*

public formatNamedParameters(sql: string, parameters: object, dialect: AbstractDialect): * source

this function was deprecated. use {@link injectReplacements} instead. This method has been removed in v7.

Params:

NameTypeAttributeDescription
sql string
parameters object
dialect AbstractDialect

Return:

*

public injectReplacements(sqlString: *, dialect: *, replacements: *): * source

Inlines replacements in places where they would be valid SQL values.

Params:

NameTypeAttributeDescription
sqlString *

The SQL that contains the replacements

dialect *

The dialect of the SQL

replacements *

if provided, this method will replace ':named' replacements & positional replacements (?)

Return:

*

The SQL with replacements rewritten in their dialect-specific syntax.

public safeStringifyJson(value: any): string source

Stringify a value as JSON with some differences:

Params:

NameTypeAttributeDescription
value any

the value to stringify.

Return:

string

the resulting json.