Skip to content

Commit

Permalink
pref: add database debug log
Browse files Browse the repository at this point in the history
  • Loading branch information
StarWishsama committed Jun 2, 2023
1 parent f908691 commit e77739a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
import com.xzavier0722.mc.plugin.slimefun4.storage.common.FieldMapper;
import com.xzavier0722.mc.plugin.slimefun4.storage.common.RecordSet;
import io.github.bakedlibs.dough.collections.Pair;

import io.github.thebusybiscuit.slimefun4.core.debug.Debug;
import io.github.thebusybiscuit.slimefun4.core.debug.TestCase;
import java.sql.Connection;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
Expand All @@ -15,7 +16,6 @@
import java.util.List;
import java.util.Optional;
import java.util.Set;

import static com.xzavier0722.mc.plugin.slimefun4.storage.adapter.sqlcommon.SqlConstants.FIELD_BACKPACK_ID;
import static com.xzavier0722.mc.plugin.slimefun4.storage.adapter.sqlcommon.SqlConstants.FIELD_BACKPACK_NAME;
import static com.xzavier0722.mc.plugin.slimefun4.storage.adapter.sqlcommon.SqlConstants.FIELD_BACKPACK_NUM;
Expand Down Expand Up @@ -142,6 +142,8 @@ public static List<RecordSet> execQuery(Connection conn, String sql) throws SQLE
}

public static void execSql(Connection conn, String sql) throws SQLException {
Debug.log(TestCase.DATABASE, "Executing sql statement: " + sql);

try (var stmt = conn.createStatement()) {
stmt.execute(sql);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.github.thebusybiscuit.slimefun4.core.debug;

import java.util.Locale;

import javax.annotation.Nonnull;

/**
Expand All @@ -17,9 +16,12 @@ public enum TestCase {
* being checked and why it is comparing IDs or meta.
* This is helpful for us to check into why input nodes are taking a while for servers.
*/
CARGO_INPUT_TESTING;
CARGO_INPUT_TESTING,

DATABASE;

TestCase() {}
TestCase() {
}

@Override
public @Nonnull String toString() {
Expand Down

0 comments on commit e77739a

Please sign in to comment.