Compare commits

...

26 Commits

Author SHA1 Message Date
Syngnat
9ba3216fa8 test(oceanbase): cover Oracle sequence metadata fallbacks 2026-07-08 12:05:48 +08:00
Syngnat
fca3f0cffb fix(oceanbase): make Oracle sequence metadata queries tolerant 2026-07-08 12:05:14 +08:00
Syngnat
20ff4f3687 fix(query-result): show capped result counts as exact totals 2026-07-08 11:32:01 +08:00
Syngnat
73ce3039ce fix(oceanbase): improve query limit and Oracle object links 2026-07-08 11:31:29 +08:00
Syngnat
c27a038fc5 test(query-result): auto limit cap has exact page total 2026-07-08 11:08:03 +08:00
Syngnat
c3c4efc6ec fix(query-result): avoid not-counted summary for auto limit cap 2026-07-08 11:07:31 +08:00
Syngnat
61296bc855 chore: remove OceanBase follow-up note from focused fix 2026-07-08 10:44:43 +08:00
Syngnat
78da0076cf chore: remove temporary OceanBase follow-up note 2026-07-08 10:44:34 +08:00
Syngnat
279b38fec3 docs(oceanbase): note first implementation batch 2026-07-08 10:44:06 +08:00
Syngnat
0e348fcca4 test(query-editor): allow literal 100-row limit label 2026-07-08 10:43:46 +08:00
Syngnat
7d79fae84d fix(query-editor): use literal label for 100-row option 2026-07-08 10:43:02 +08:00
Syngnat
f642e0325d chore: remove temporary max rows i18n note 2026-07-08 10:40:20 +08:00
Syngnat
43a408f1c9 docs(query-editor): note 100-row option i18n key 2026-07-08 10:40:05 +08:00
Syngnat
b97b5cf6e2 docs(oceanbase): track remaining follow-up issues 2026-07-08 10:39:55 +08:00
Syngnat
6c269a99cf fix(oceanbase): support multi-part Oracle table links 2026-07-08 10:39:32 +08:00
Syngnat
24841f2dd9 test(query-editor): require 100-row limit label key 2026-07-08 10:37:10 +08:00
Syngnat
c2e60c1e52 feat(query-editor): add 100-row limit option 2026-07-08 10:36:38 +08:00
Syngnat
7a87d43bdc chore: remove temporary macOS CI annotation cleanup workflow 2026-07-08 09:43:21 +08:00
Syngnat
5fa1c90674 chore: trigger macOS CI annotation cleanup workflow 2026-07-08 09:42:18 +08:00
Syngnat
c79225ef27 chore: add temporary macOS CI annotation cleanup workflow 2026-07-08 09:41:44 +08:00
Syngnat
0bd8fdea1f chore: remove temporary macOS CI annotation cleanup workflow 2026-07-08 09:40:30 +08:00
Syngnat
18dbd043ae chore: temporarily apply macOS CI annotation cleanup 2026-07-08 09:39:28 +08:00
Syngnat
a7535dec2b fix(update): repair Go syntax in Windows update cleanup 2026-07-08 08:46:42 +08:00
Syngnat
dbd4b7f763 fix(update): repair Go multiline boolean expression 2026-07-08 08:44:15 +08:00
Syngnat
68eacbbcf7 fix(update): preserve latest Windows portable filename 2026-07-07 22:47:05 +08:00
Syngnat
a4a0ac25cf fix(update): clean Windows update packages and logs 2026-07-07 20:54:13 +08:00
8 changed files with 100 additions and 12 deletions

View File

@@ -126,10 +126,11 @@ const installOceanBaseOracleNavigationFallback = (editor: any) => {
} }
const parts = splitSqlIdentifierPath(identifier.text); const parts = splitSqlIdentifierPath(identifier.text);
if (parts.length !== 2) { if (parts.length < 2) {
return; return;
} }
const [schemaName, tableName] = parts; const schemaName = parts[parts.length - 2];
const tableName = parts[parts.length - 1];
if (!schemaName || !tableName) { if (!schemaName || !tableName) {
return; return;
} }

View File

@@ -14,6 +14,7 @@ const legacyLiterals = [
'选择连接', '选择连接',
'选择数据库', '选择数据库',
'最大返回行数', '最大返回行数',
'最大行数100',
'最大行数500', '最大行数500',
'最大行数1000', '最大行数1000',
'最大行数5000', '最大行数5000',
@@ -64,6 +65,7 @@ describe('QueryEditorToolbar i18n', () => {
expect(source).toContain("import { useOptionalI18n } from '../i18n/provider';"); expect(source).toContain("import { useOptionalI18n } from '../i18n/provider';");
expect(source).toContain('const i18n = useOptionalI18n();'); expect(source).toContain('const i18n = useOptionalI18n();');
expect(source).toContain('const t = i18n?.t ?? defaultTranslate;'); expect(source).toContain('const t = i18n?.t ?? defaultTranslate;');
expect(source).toContain("{ label: '100', value: 100 }");
for (const key of requiredKeys) { for (const key of requiredKeys) {
expect(source).toContain(key); expect(source).toContain(key);

View File

@@ -291,6 +291,7 @@ const QueryEditorToolbar: React.FC<QueryEditorToolbarProps> = ({
value={maxRows} value={maxRows}
onChange={(val) => onMaxRowsChange(Number(val))} onChange={(val) => onMaxRowsChange(Number(val))}
options={[ options={[
{ label: '100', value: 100 },
{ label: t("query_editor.max_rows.option_500"), value: 500 }, { label: t("query_editor.max_rows.option_500"), value: 500 },
{ label: t("query_editor.max_rows.option_1000"), value: 1000 }, { label: t("query_editor.max_rows.option_1000"), value: 1000 },
{ label: t("query_editor.max_rows.option_5000"), value: 5000 }, { label: t("query_editor.max_rows.option_5000"), value: 5000 },

View File

@@ -26,6 +26,25 @@ describe('queryResultPagination', () => {
}); });
}); });
it('treats query-editor injected LIMIT as a capped page rather than an uncounted total', () => {
const page = createInitialQueryResultPagination({
executedSql: 'SELECT id, name FROM users LIMIT 500',
exportSql: 'SELECT id, name FROM users',
dbType: 'mysql',
returnedRowCount: 500,
fallbackPageSize: 500,
});
expect(page).toMatchObject({
current: 1,
pageSize: 500,
total: 500,
totalKnown: true,
baseSql: 'SELECT id, name FROM users',
exportAllSql: 'SELECT id, name FROM users',
});
});
it('builds the next page SQL with one lookahead row', () => { it('builds the next page SQL with one lookahead row', () => {
expect(buildQueryResultPageSql({ expect(buildQueryResultPageSql({
baseSql: 'SELECT id FROM users', baseSql: 'SELECT id FROM users',

View File

@@ -22,6 +22,14 @@ const normalizePositiveInteger = (value: unknown): number => {
return Number.isFinite(parsed) && parsed > 0 ? parsed : 0; return Number.isFinite(parsed) && parsed > 0 ? parsed : 0;
}; };
const normalizeSqlForComparison = (sql: string): string => (
String(sql || '')
.replace(/\s+/g, ' ')
.replace(/;+\s*$/g, '')
.trim()
.toLowerCase()
);
const parseTopLevelLimit = (sql: string): LimitInfo | null => { const parseTopLevelLimit = (sql: string): LimitInfo | null => {
const { main } = splitSqlTail(sql); const { main } = splitSqlTail(sql);
const limitPos = findTopLevelKeyword(main, 'limit'); const limitPos = findTopLevelKeyword(main, 'limit');
@@ -60,6 +68,14 @@ const stripExplicitLimitForExport = (sql: string): string => {
return splitSqlTail(sql).main.trim(); return splitSqlTail(sql).main.trim();
}; };
const wasLimitAppliedByQueryEditorCap = (executedSql: string, exportSql: string): boolean => {
const executed = String(executedSql || '').trim();
const exportable = String(exportSql || '').trim();
if (!executed || !exportable) return false;
if (normalizeSqlForComparison(executed) === normalizeSqlForComparison(exportable)) return false;
return normalizeSqlForComparison(stripExplicitLimitForExport(executed)) === normalizeSqlForComparison(stripExplicitLimitForExport(exportable));
};
const resolveWrappedBaseSql = (dbType: string, baseSql: string): string => { const resolveWrappedBaseSql = (dbType: string, baseSql: string): string => {
const normalizedType = String(dbType || '').trim().toLowerCase(); const normalizedType = String(dbType || '').trim().toLowerCase();
const base = baseSql.trim(); const base = baseSql.trim();
@@ -146,11 +162,14 @@ export const createInitialQueryResultPagination = (params: {
const exportAllSql = exportSql && getLeadingKeyword(exportSql) === 'select' const exportAllSql = exportSql && getLeadingKeyword(exportSql) === 'select'
? stripExplicitLimitForExport(exportSql) ? stripExplicitLimitForExport(exportSql)
: stripExplicitLimitForExport(executedSql); : stripExplicitLimitForExport(executedSql);
const totalState = resolveQueryResultPaginationTotal({ const autoLimitCap = current === 1 && wasLimitAppliedByQueryEditorCap(executedSql, exportSql);
current, const totalState = autoLimitCap
pageSize, ? { total: returnedRowCount, totalKnown: true }
rowCount: returnedRowCount, : resolveQueryResultPaginationTotal({
}); current,
pageSize,
rowCount: returnedRowCount,
});
return { return {
current, current,

View File

@@ -417,9 +417,16 @@ func buildObjectSequenceMetadataQueries(dbType string, dbName string) []objectMe
switch dbType { switch dbType {
case "oracle", "dameng": case "oracle", "dameng":
if strings.TrimSpace(dbName) == "" { if strings.TrimSpace(dbName) == "" {
return []objectMetadataQuerySpec{{sql: "SELECT SEQUENCE_NAME AS sequence_name FROM USER_SEQUENCES ORDER BY SEQUENCE_NAME"}} return []objectMetadataQuerySpec{
{sql: "SELECT * FROM USER_SEQUENCES ORDER BY SEQUENCE_NAME"},
{sql: "SELECT OBJECT_NAME AS sequence_name FROM USER_OBJECTS WHERE OBJECT_TYPE = 'SEQUENCE' ORDER BY OBJECT_NAME"},
}
}
owner := strings.ToUpper(safeDbName)
return []objectMetadataQuerySpec{
{sql: fmt.Sprintf("SELECT * FROM ALL_SEQUENCES WHERE SEQUENCE_OWNER = '%s' ORDER BY SEQUENCE_NAME", owner)},
{sql: fmt.Sprintf("SELECT OWNER AS schema_name, OBJECT_NAME AS sequence_name FROM ALL_OBJECTS WHERE OWNER = '%s' AND OBJECT_TYPE = 'SEQUENCE' ORDER BY OBJECT_NAME", owner)},
} }
return []objectMetadataQuerySpec{{sql: fmt.Sprintf("SELECT SEQUENCE_OWNER AS schema_name, SEQUENCE_NAME AS sequence_name FROM ALL_SEQUENCES WHERE SEQUENCE_OWNER = '%s' ORDER BY SEQUENCE_NAME", strings.ToUpper(safeDbName))}}
default: default:
return nil return nil
} }

View File

@@ -0,0 +1,39 @@
package app
import (
"strings"
"testing"
)
func TestBuildObjectSequenceMetadataQueriesOracleUsesWildcardAndObjectFallback(t *testing.T) {
t.Parallel()
specs := buildObjectSequenceMetadataQueries("oracle", "sbdev")
if len(specs) != 2 {
t.Fatalf("expected 2 Oracle sequence metadata queries, got %d", len(specs))
}
if !strings.Contains(specs[0].sql, "SELECT * FROM ALL_SEQUENCES") {
t.Fatalf("expected ALL_SEQUENCES wildcard query, got %q", specs[0].sql)
}
if strings.Contains(specs[0].sql, "LAST_NUMBER") || strings.Contains(specs[0].sql, "ORDER_FLAG") {
t.Fatalf("query should not enumerate optional sequence columns: %q", specs[0].sql)
}
if !strings.Contains(specs[1].sql, "ALL_OBJECTS") || !strings.Contains(specs[1].sql, "OBJECT_TYPE = 'SEQUENCE'") {
t.Fatalf("expected ALL_OBJECTS fallback query, got %q", specs[1].sql)
}
}
func TestBuildObjectSequenceMetadataQueriesOracleUserFallbacks(t *testing.T) {
t.Parallel()
specs := buildObjectSequenceMetadataQueries("oracle", "")
if len(specs) != 2 {
t.Fatalf("expected 2 Oracle user sequence metadata queries, got %d", len(specs))
}
if specs[0].sql != "SELECT * FROM USER_SEQUENCES ORDER BY SEQUENCE_NAME" {
t.Fatalf("unexpected USER_SEQUENCES query: %q", specs[0].sql)
}
if !strings.Contains(specs[1].sql, "USER_OBJECTS") || !strings.Contains(specs[1].sql, "OBJECT_TYPE = 'SEQUENCE'") {
t.Fatalf("expected USER_OBJECTS fallback query, got %q", specs[1].sql)
}
}

View File

@@ -93,9 +93,9 @@ func resolveWindowsUpdateFinalTargetPath(currentTarget string, sourcePath string
func isVersionedWindowsUpdatePackageName(name string) bool { func isVersionedWindowsUpdatePackageName(name string) bool {
trimmed := strings.TrimSpace(name) trimmed := strings.TrimSpace(name)
lower := strings.ToLower(trimmed) lower := strings.ToLower(trimmed)
return strings.HasPrefix(trimmed, "GoNavi-") return strings.HasPrefix(trimmed, "GoNavi-") &&
&& strings.Contains(trimmed, "-Windows-") strings.Contains(trimmed, "-Windows-") &&
&& strings.HasSuffix(lower, ".exe") strings.HasSuffix(lower, ".exe")
} }
func prepareWindowsStagedUpdateAsset(sourcePath string, stagedDir string) (string, error) { func prepareWindowsStagedUpdateAsset(sourcePath string, stagedDir string) (string, error) {