HotDBMySQL
hotstaq / Modules / HotDBMySQL
Class: HotDBMySQL
The MySQL database connection.
Hierarchy​
HotDB
<mysql.Connection
,MySQLResults
,MySQLSchema
>↳
HotDBMySQL
Table of contents​
Constructors​
Properties​
Methods​
Constructors​
constructor​
• new HotDBMySQL(db?
, type?
, schema?
)
Parameters​
Name | Type | Default value |
---|---|---|
db | Connection | null |
type | string | "mysql" |
schema | MySQLSchema | null |
Overrides​
Defined in​
Properties​
connectionStatus​
• connectionStatus: ConnectionStatus
The connection status.
Inherited from​
Defined in​
db​
• db: Connection
The connection to the database (or the driver).
Inherited from​
Defined in​
schema​
• schema: MySQLSchema
The db schema. This will generate a database structure and keep it maintained as needed.
Inherited from​
Defined in​
type​
• type: string
The database type.
Inherited from​
Defined in​
Methods​
connect​
â–¸ connect(connectionInfo
): Promise
<any
[]>
Connect to the database.
Parameters​
Name | Type |
---|---|
connectionInfo | HotDBConnectionInterface |
Returns​
Promise
<any
[]>
Overrides​
Defined in​
dbCheck​
â–¸ Protected
dbCheck(): void
Checks to see if this has a database connection.
Returns​
void
Defined in​
disconnect​
â–¸ disconnect(): Promise
<void
>
Disconnect from the server.
Returns​
Promise
<void
>
Overrides​
Defined in​
multiQuery​
â–¸ multiQuery(queryStrings
): Promise
<MySQLResults
[]>
Make multiple queries. Warning! This can be a security vulnerability if misused! Ideally this should only be used when making changes to tables! Additionally, this could overwhelm the server and each command sent is not guaranteed to be done in order.
Parameters​
Name | Type |
---|---|
queryStrings | string [] | { query : string ; values : any [] }[] |
Returns​
Promise
<MySQLResults
[]>
Overrides​
Defined in​
query​
â–¸ query(queryString
, values?
): Promise
<MySQLResults
>
The query to make.
Parameters​
Name | Type | Default value |
---|---|---|
queryString | string | undefined |
values | any [] | [] |
Returns​
Promise
<MySQLResults
>
Overrides​
Defined in​
queryOne​
â–¸ queryOne(queryString
, values?
): Promise
<MySQLResults
>
Make a single query. If there are no results, null will be in MySQLResults.results
Parameters​
Name | Type | Default value |
---|---|---|
queryString | string | undefined |
values | any [] | [] |
Returns​
Promise
<MySQLResults
>
Overrides​
Defined in​
syncMigrationsTableTracker​
â–¸ syncMigrationsTableTracker(): Promise
<void
>
Sync the migrations table tracker. This keeps track of all database table migrations. If the "migrations" table is missing, it will be created.
Returns​
Promise
<void
>
Defined in​
tableCheck​
â–¸ tableCheck(tableName
): Promise
<boolean
>
Checks if the table exists.
Parameters​
Name | Type |
---|---|
tableName | string |
Returns​
Promise
<boolean
>