提交 64d5d907 authored 作者: Noel Grandin's avatar Noel Grandin

these methods can be static

上级 31dfacb3
......@@ -3527,7 +3527,7 @@ public class Parser {
return false;
}
private boolean equalsTokenIgnoreCase(String a, String b) {
private static boolean equalsTokenIgnoreCase(String a, String b) {
if (a == null) {
return b == null;
} else if (a.equals(b)) {
......
......@@ -273,7 +273,7 @@ final class FullTextSettings {
return whitespaceChars;
}
private String normalizeWord(String word) {
private static String normalizeWord(String word) {
// TODO this is locale specific, document
return word.toUpperCase();
}
......
......@@ -98,7 +98,7 @@ public class CreateCluster extends Tool {
process(urlSource, urlTarget, user, password, serverList);
}
private void process(String urlSource, String urlTarget,
private static void process(String urlSource, String urlTarget,
String user, String password, String serverList) throws SQLException {
Connection connSource = null, connTarget = null;
Statement statSource = null, statTarget = null;
......@@ -171,6 +171,7 @@ public class CreateCluster extends Tool {
new Thread(
new Runnable(){
@Override
public void run() {
try {
while (rs.next()) {
......
......@@ -168,7 +168,7 @@ public class TestSetCollation extends TestBase {
}
}
private void insertValues(Connection con, String[] values, int startId) throws SQLException {
private static void insertValues(Connection con, String[] values, int startId) throws SQLException {
PreparedStatement ps = con.prepareStatement("INSERT INTO charsettable VALUES (?, ?)");
int id = startId;
for (String value : values) {
......@@ -179,7 +179,7 @@ public class TestSetCollation extends TestBase {
ps.close();
}
private List<String> loadTableValues(Connection con) throws SQLException {
private static List<String> loadTableValues(Connection con) throws SQLException {
List<String> results = new ArrayList<>();
Statement statement = con.createStatement();
ResultSet resultSet = statement.executeQuery("select testvalue from charsettable order by testvalue");
......
......@@ -5,15 +5,14 @@
*/
package org.h2.test.db;
import org.h2.engine.Constants;
import org.h2.jdbc.JdbcSQLException;
import org.h2.test.TestBase;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import org.h2.engine.Constants;
import org.h2.jdbc.JdbcSQLException;
import org.h2.test.TestBase;
/**
* Tests for table synonyms.
......@@ -248,7 +247,7 @@ public class TestSynonymForTable extends TestBase {
conn.close();
}
private void deleteFromSynonym(Connection conn, int id) throws SQLException {
private static void deleteFromSynonym(Connection conn, int id) throws SQLException {
PreparedStatement prep = conn.prepareStatement(
"DELETE FROM testsynonym WHERE id = ?");
prep.setInt(1, id);
......@@ -307,21 +306,21 @@ public class TestSynonymForTable extends TestBase {
assertFalse(rs.next());
}
private void insertIntoSynonym(Connection conn, int id) throws SQLException {
private static void insertIntoSynonym(Connection conn, int id) throws SQLException {
PreparedStatement prep = conn.prepareStatement(
"INSERT INTO testsynonym VALUES(?)");
prep.setInt(1, id);
prep.execute();
}
private void insertIntoBackingTable(Connection conn, int id) throws SQLException {
private static void insertIntoBackingTable(Connection conn, int id) throws SQLException {
PreparedStatement prep = conn.prepareStatement(
"INSERT INTO backingtable VALUES(?)");
prep.setInt(1, id);
prep.execute();
}
private void createTableWithSynonym(Connection conn) throws SQLException {
private static void createTableWithSynonym(Connection conn) throws SQLException {
Statement stat = conn.createStatement();
stat.execute("CREATE TABLE IF NOT EXISTS backingtable(id INT PRIMARY KEY)");
stat.execute("CREATE OR REPLACE SYNONYM testsynonym FOR backingtable");
......
......@@ -5,6 +5,15 @@
*/
package org.h2.test.jdbc;
import java.io.Serializable;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Types;
import java.text.DecimalFormat;
import java.util.Locale;
import org.h2.api.CustomDataTypesHandler;
import org.h2.api.ErrorCode;
import org.h2.message.DbException;
......@@ -20,16 +29,6 @@ import org.h2.value.ValueDouble;
import org.h2.value.ValueJavaObject;
import org.h2.value.ValueString;
import java.io.Serializable;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Types;
import java.text.DecimalFormat;
import java.util.Locale;
/**
* Tests {@link CustomDataTypesHandler}.
*/
......@@ -300,7 +299,7 @@ public class TestCustomDataTypesHandler extends TestBase {
}
/** Constructs data type instance for complex number type */
private DataType createComplex() {
private static DataType createComplex() {
DataType result = new DataType();
result.type = COMPLEX_DATA_TYPE_ID;
result.name = COMPLEX_DATA_TYPE_NAME;
......
......@@ -27,7 +27,7 @@ public class TestConcurrentLinkedList extends TestBase {
public static void main(String... a) throws Exception {
TestConcurrentLinkedList test = (TestConcurrentLinkedList) TestBase.createCaller().init();
test.test();
test.testPerformance();
testPerformance();
}
@Override
......@@ -36,7 +36,7 @@ public class TestConcurrentLinkedList extends TestBase {
testConcurrent();
}
private void testPerformance() {
private static void testPerformance() {
testPerformance(true);
testPerformance(false);
testPerformance(true);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论