MCPcopy Create free account
hub / github.com/Y80/bmm / dbExecute

Function dbExecute

scripts/utils.mjs:7–20  ·  view source on GitHub ↗
(sql = '')

Source from the content-addressed store, hash-verified

5import * as zx from 'zx'
6
7export 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
22export async function testDbConnect() {
23 try {

Callers 2

testDBInitialedFunction · 0.90
testDbConnectFunction · 0.85

Calls 1

executeFunction · 0.85

Tested by

no test coverage detected