This repository has been archived by the owner on Mar 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 69
Fetch table columns & triggers #14
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
1cd7939
Tests and database API for listing table columns
BornaP 1491a96
Add list table columns feature for MySQL
BornaP 7e95360
List columns support for PostgreSQL and SQLServer
BornaP 9797966
Add support for fetching triggers on MySQL and PostgreSQL
BornaP 03836e8
Write new tests for triggers and alter old ones for routines
BornaP 9c96e8f
Add support for fetching triggers for SQL Server
BornaP 58d59c8
Wrap table string in brackets when making query to sql server
BornaP 1e26f13
Fix SQL Server trigger creation error
BornaP 6ea3500
Fixing SQL Server related build errors
BornaP File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,8 @@ export function createConnection(server, database) { | |
listTables: listTables.bind(null, server, database), | ||
listViews: listViews.bind(null, server, database), | ||
listRoutines: listRoutines.bind(null, server, database), | ||
listTableColumns: listTableColumns.bind(null, server, database), | ||
listTableTriggers: listTableTriggers.bind(null, server, database), | ||
executeQuery: executeQuery.bind(null, server, database), | ||
listDatabases: listDatabases.bind(null, server, database), | ||
getQuerySelectTop: getQuerySelectTop.bind(null, server, database), | ||
|
@@ -119,6 +121,16 @@ async function listRoutines(server, database) { | |
return database.connection.listRoutines(); | ||
} | ||
|
||
async function listTableColumns(server, database, table) { | ||
checkIsConnected(server, database); | ||
return database.connection.listTableColumns(table); | ||
} | ||
|
||
async function listTableTriggers(server, database, table) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it does not need async |
||
checkIsConnected(server, database); | ||
return database.connection.listTableTriggers(table); | ||
} | ||
|
||
async function executeQuery(server, database, query) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it does not need async |
||
checkIsConnected(server, database); | ||
return database.connection.executeQuery(query); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it does not need async
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess need the async because of the https://github.com/BornaP/sqlectron-core/blob/13-fetch-table-columns/src/db/client.js#L172.
That throws an exception. I guess without the async it will not reject the promise properly.
Since that is the current pattern used for all functions in that file. I will accept without applying your suggestions. We can try out without async in another commit.