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

these methods can be static

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