(connection: Connection, databaseName: string, statement: string)
| 51 | }; |
| 52 | |
| 53 | const execute = async (connection: Connection, databaseName: string, statement: string): Promise<any> => { |
| 54 | connection.database = databaseName; |
| 55 | const conn = await getMySQLConnection(connection); |
| 56 | const [rows] = await conn.execute(statement); |
| 57 | conn.destroy(); |
| 58 | |
| 59 | const executionResult: ExecutionResult = { |
| 60 | rawResult: [], |
| 61 | affectedRows: 0, |
| 62 | }; |
| 63 | if (Array.isArray(rows)) { |
| 64 | executionResult.rawResult = rows; |
| 65 | } else { |
| 66 | executionResult.affectedRows = rows.affectedRows; |
| 67 | } |
| 68 | return executionResult; |
| 69 | }; |
| 70 | |
| 71 | const getDatabases = async (connection: Connection): Promise<string[]> => { |
| 72 | const conn = await getMySQLConnection(connection); |
no test coverage detected