(stmt: string)
| 12 | |
| 13 | // 执行 SQL 查询的函数 |
| 14 | export async function executeSQLQuery(stmt: string) { |
| 15 | try { |
| 16 | const result = await makeSiYuanRequest<SQLQueryResult>({ |
| 17 | endpoint: 'query/sql', |
| 18 | data: { stmt }, |
| 19 | }); |
| 20 | |
| 21 | return result; |
| 22 | } catch (error) { |
| 23 | logger.error('SQL query execution failed', { stmt, error }); |
| 24 | return { |
| 25 | results: { |
| 26 | results: {}, |
| 27 | }, |
| 28 | success: false, |
| 29 | error: error instanceof Error ? error.message : String(error), |
| 30 | query: stmt, |
| 31 | }; |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | // 注册 SQL 查询工具 |
| 36 | // 作者:Frostime |
no test coverage detected