modified: backend/src/services/AqlExecutor.ts
This commit is contained in:
@@ -195,25 +195,10 @@ export class AqlExecutor {
|
|||||||
throw new Error(`Invalid JSON response: ${responseText.substring(0, 200)}`);
|
throw new Error(`Invalid JSON response: ${responseText.substring(0, 200)}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Нормализуем ответ к формату QueryResult
|
// Возвращаем данные как есть
|
||||||
let rows: any[];
|
|
||||||
let rowCount: number;
|
|
||||||
|
|
||||||
if (Array.isArray(data)) {
|
|
||||||
rows = data;
|
|
||||||
rowCount = data.length;
|
|
||||||
} else if (data && typeof data === 'object') {
|
|
||||||
// Если ответ - объект, оборачиваем его в массив
|
|
||||||
rows = [data];
|
|
||||||
rowCount = 1;
|
|
||||||
} else {
|
|
||||||
rows = [];
|
|
||||||
rowCount = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
rows,
|
rows: data,
|
||||||
rowCount,
|
rowCount: Array.isArray(data) ? data.length : (data ? 1 : 0),
|
||||||
executionTime,
|
executionTime,
|
||||||
};
|
};
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
|
|||||||
Reference in New Issue
Block a user