(sql = '')
| 5 | import * as zx from 'zx' |
| 6 | |
| 7 | export async function dbExecute(sql = '') { |
| 8 | const { db } = await import('@/db') |
| 9 | function execute() { |
| 10 | if (typeof db.execute === 'function') { |
| 11 | return db.execute.bind(db) |
| 12 | } |
| 13 | if (typeof db.$client.execute === 'function') { |
| 14 | return db.$client.execute.bind(db.$client) |
| 15 | } |
| 16 | exitWithDbClose(1) |
| 17 | throw new Error('无法获取数据库 execute() 方法') |
| 18 | } |
| 19 | return execute()(sql) |
| 20 | } |
| 21 | |
| 22 | export async function testDbConnect() { |
| 23 | try { |
no test coverage detected