fix(oracle): 修复表数据加载与编辑
This commit is contained in:
1 parent
79277c660f
commit
cab0e79dad
17 files changed
+610
-90
No files matched your search
@@ -0,0 +1,21 @@
|
||||
import type { ColumnInfo, DatabaseType } from "@/types/database";
|
||||
|
||||
export const DBX_ROWID_COLUMN = "__DBX_ROWID";
|
||||
|
||||
export function editablePrimaryKeys(databaseType: DatabaseType | undefined, columns: ColumnInfo[]): string[] {
|
||||
const primaryKeys = columns.filter((column) => column.is_primary_key).map((column) => column.name);
|
||||
if (databaseType === "oracle" && primaryKeys.length === 0) return [DBX_ROWID_COLUMN];
|
||||
return primaryKeys;
|
||||
}
|
||||
|
||||
export function usesSyntheticRowIdKey(databaseType: DatabaseType | undefined, primaryKeys: string[]): boolean {
|
||||
return databaseType === "oracle" && primaryKeys.length === 1 && primaryKeys[0].toUpperCase() === DBX_ROWID_COLUMN;
|
||||
}
|
||||
|
||||
export function isHiddenGridColumn(
|
||||
databaseType: DatabaseType | undefined,
|
||||
column: string,
|
||||
primaryKeys: string[],
|
||||
): boolean {
|
||||
return usesSyntheticRowIdKey(databaseType, primaryKeys) && column.toUpperCase() === DBX_ROWID_COLUMN;
|
||||
}
|
||||
Reference in new issue
Block a user