Class: MySQLClient
mysql.MySQLClient MySQLClient is a client for MySQL database. Internally client uses go-sql-driver/mysql driver.Example
Table of contents
Constructors
Methods
Constructors
constructor
• new MySQLClient():MySQLClient
Returns
MySQLClient
Defined in
mysql.ts:33Methods
Connect
▸ Connect(host
, port
, username
): boolean
Connect connects to MySQL database using given credentials.
If connection is successful, it returns true.
If connection is unsuccessful, it returns false and error.
The connection is closed after the function returns.
Parameters
Name | Type |
---|---|
host | string |
port | number |
username | string |
Returns
boolean
Example
Defined in
mysql.ts:61ConnectWithDSN
▸ ConnectWithDSN(dsn
): boolean
ConnectWithDSN connects to MySQL database using given DSN.
we override mysql dialer with fastdialer so it respects network policy
If connection is successful, it returns true.
Parameters
Name | Type |
---|---|
dsn | string |
Returns
boolean
Example
Defined in
mysql.ts:91ExecuteQuery
▸ ExecuteQuery(host
, port
, username
): SQLResult
ExecuteQuery connects to Mysql database using given credentials
and executes a query on the db.
Parameters
Name | Type |
---|---|
host | string |
port | number |
username | string |
Returns
SQLResult
Example
Defined in
mysql.ts:124ExecuteQueryOnDB
▸ ExecuteQueryOnDB(host
, port
, username
): SQLResult
ExecuteQuery connects to Mysql database using given credentials
and executes a query on the db.
Parameters
Name | Type |
---|---|
host | string |
port | number |
username | string |
Returns
SQLResult
Example
Defined in
mysql.ts:139ExecuteQueryWithOpts
▸ ExecuteQueryWithOpts(opts
, query
): SQLResult
ExecuteQueryWithOpts connects to Mysql database using given credentials
and executes a query on the db.
Parameters
Name | Type |
---|---|
opts | MySQLOptions |
query | string |
Returns
SQLResult
Example
Defined in
mysql.ts:109FingerprintMySQL
▸ FingerprintMySQL(host
, port
): MySQLInfo
returns MySQLInfo when fingerpint is successful
Parameters
Name | Type |
---|---|
host | string |
port | number |
Returns
MySQLInfo
Example
Defined in
mysql.ts:75IsMySQL
▸ IsMySQL(host
, port
): boolean
IsMySQL checks if the given host is running MySQL database.
If the host is running MySQL database, it returns true.
If the host is not running MySQL database, it returns false.
Parameters
Name | Type |
---|---|
host | string |
port | number |
Returns
boolean
Example