Skip to content
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

Dbinteraction #228

Merged
merged 25 commits into from Jul 9, 2021
Merged

Dbinteraction #228

merged 25 commits into from Jul 9, 2021

Conversation

ScorpioBroker
Copy link
Owner

This changes the db handling and adresses a few bugs introduced by tenant handling

try {
return queryDAO.query(qp);
} catch (Exception e) {
throw new ResponseException(ErrorType.TenantNotFound);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[minor]Use generic error message "e.getMessage()" instead of "ErrorType.TenantNotFound)"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

try {
String tenantId = qp.getTenant();
template = getJDBCTemplate(tenantId);
} catch (Exception e) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[minor]Handle "ResponseException" instead of "Exception".

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

synchronized (readerJdbcTemplate) {
readerJdbcTemplate = new JdbcTemplate(masterDataSource);
}

// String databasename="ngbcsource2";
// SELECT EXISTS(SELECT datname FROM pg_database WHERE datname = 'tenant2');
String sql = "SELECT database_name FROM tenant WHERE tenant_id = ?";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[major]only suggestion, No need to write the select query operation here so we can compare "tenantidValue"with append string with prefix database name "ngb" like as ngb+tenantidValue..

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@pawannec pawannec requested a review from amitrnec July 9, 2021 09:57
@ScorpioBroker ScorpioBroker merged commit 9b4cf21 into development Jul 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants