Skip to content

Fix/366_schema_list_sorting #372

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/connection/sqlJob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export class OldSQLJob extends SQLJob {
getStatus(): JobStatus {
const currentListenerCount = this.responseEmitter.eventNames().length;

return this.channel && currentListenerCount > 0 ? JobStatus.BUSY : this.status;
return this.channel && currentListenerCount > 0 ? JobStatus.BUSY : this.status as JobStatus;
}

async connect(): Promise<ConnectionResult> {
Expand Down
16 changes: 5 additions & 11 deletions src/database/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,18 +356,12 @@ export default class Schemas {

let query: string;

if (selects.length > 1) {
if (details.sort) {
query = `with results as (${selects.join(
" UNION ALL "
)}) select * from results Order by QSYS2.DELIMIT_NAME(NAME) asc`;
} else {
query = selects.join(` UNION ALL `);
}

if (details.sort) {
query = `with results as (${selects.join(
" UNION ALL "
)}) select * from results Order by QSYS2.DELIMIT_NAME(NAME) asc`;
} else {
// TODO: sort single
query = selects[0];
query = selects.join(` UNION ALL `);
}

const objects: any[] = await JobManager.runSQL(
Expand Down
2 changes: 1 addition & 1 deletion src/views/schemaBrowser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ export default class schemaBrowser {
let filterValue = this.filters[element.schema];
if (filterValue) {
const validSchemaName = Statement.noQuotes(element.schema);
const filteredObjects = await Schemas.getObjects(validSchemaName, AllSQLTypes, { filter: filterValue });
const filteredObjects = await Schemas.getObjects(validSchemaName, AllSQLTypes, { filter: filterValue, sort: true });
items = filteredObjects.map(obj => new SQLObject(obj));

} else {
Expand Down
Loading