Skip to content

Commit 402ddc1

Browse files
Denzel CodeDenzel Code
authored andcommitted
Space added to the select query
1 parent 5b5c2e7 commit 402ddc1

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

.idea/workspace.xml

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/java/advancedsql/MySQL.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public MySQL(String host, int port, String username, String password, String dat
2424
this.connect(host, port, username, password, database, attributes);
2525
} catch (SQLException e) {
2626
if (e.getErrorCode() == 1049) {
27-
createDatabase(host, port, username, password, database);
27+
createDatabase(host, port, username, password, database, attributes);
2828

2929
connect(host, port, username, password, database, attributes);
3030

@@ -59,8 +59,8 @@ private void connect(String host, int port, String username, String password, St
5959
this.connected = true;
6060
}
6161

62-
private void createDatabase(String host, int port, String username, String password, String database) throws SQLException {
63-
connection = DriverManager.getConnection("jdbc:mysql://" + host + ":" + port + "?", username, password);
62+
private void createDatabase(String host, int port, String username, String password, String database, String attributes) throws SQLException {
63+
connection = DriverManager.getConnection("jdbc:mysql://" + host + ":" + port + (attributes.isEmpty() ? "" : "?" + attributes), username, password);
6464

6565
Statement statement = connection.createStatement();
6666

src/main/java/advancedsql/query/Select.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public String toQuery() {
141141

142142
for (IJoin join: this.joins) query.append(" ").append(join);
143143

144-
query.append(this.where != null ? "WHERE " + this.where : "");
144+
query.append(this.where != null ? " WHERE " + this.where : "");
145145

146146
query.append(this.order != null ? " ORDER BY " + this.order : "");
147147

0 commit comments

Comments
 (0)