Unverified 提交 7a2a5446 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov 提交者: GitHub

Merge pull request #1141 from katzyn/misc

Assorted optimizations and fixes
...@@ -21,6 +21,24 @@ Change Log ...@@ -21,6 +21,24 @@ Change Log
<h2>Next Version (unreleased)</h2> <h2>Next Version (unreleased)</h2>
<ul> <ul>
<li>PR #1138, #1139: Fix a memory leak caused by DatabaseCloser objects
</li>
<li>PR #1137: Step toward making transaction commit atomic
</li>
<li>PR #1136: Assorted minor optimizations
</li>
<li>PR #1134: Detect possible overflow in integer division and optimize some code
</li>
<li>PR #1133: Implement Comparable&lt;Value&gt; in CompareMode and optimize ValueHashMap.keys()
</li>
<li>PR #1132: Reduce allocation of ExpressionVisitor instances
</li>
<li>PR #1130: Improve TestScript and TestCrashAPI
</li>
<li>PR #1128: Fix ON DUPLICATE KEY UPDATE with ENUM
</li>
<li>PR #1127: Update JdbcDatabaseMetaData.getSQLKeywords() and perform some minor optimizations
</li>
<li>PR #1126: Fix an issue with code coverage and building of documentation <li>PR #1126: Fix an issue with code coverage and building of documentation
</li> </li>
<li>PR #1123: Fix TCP version check <li>PR #1123: Fix TCP version check
......
...@@ -2062,7 +2062,7 @@ public class ErrorCode { ...@@ -2062,7 +2062,7 @@ public class ErrorCode {
case FEATURE_NOT_SUPPORTED_1: return "HYC00"; case FEATURE_NOT_SUPPORTED_1: return "HYC00";
case LOCK_TIMEOUT_1: return "HYT00"; case LOCK_TIMEOUT_1: return "HYT00";
default: default:
return "" + errorCode; return Integer.toString(errorCode);
} }
} }
......
...@@ -343,7 +343,7 @@ public abstract class Prepared { ...@@ -343,7 +343,7 @@ public abstract class Prepared {
* *
* @param rowNumber the row number * @param rowNumber the row number
*/ */
protected void setCurrentRowNumber(int rowNumber) { public void setCurrentRowNumber(int rowNumber) {
if ((++rowScanCount & 127) == 0) { if ((++rowScanCount & 127) == 0) {
checkCanceled(); checkCanceled();
} }
......
...@@ -520,7 +520,7 @@ public abstract class Query extends Prepared { ...@@ -520,7 +520,7 @@ public abstract class Query extends Prepared {
} }
idx -= 1; idx -= 1;
if (idx < 0 || idx >= expressionCount) { if (idx < 0 || idx >= expressionCount) {
throw DbException.get(ErrorCode.ORDER_BY_NOT_IN_RESULT, "" + (idx + 1)); throw DbException.get(ErrorCode.ORDER_BY_NOT_IN_RESULT, Integer.toString(idx + 1));
} }
} }
index[i] = idx; index[i] = idx;
......
...@@ -411,7 +411,7 @@ public class Database implements DataHandler { ...@@ -411,7 +411,7 @@ public class Database implements DataHandler {
if (now > reconnectCheckNext) { if (now > reconnectCheckNext) {
if (pending) { if (pending) {
String pos = pageStore == null ? String pos = pageStore == null ?
null : "" + pageStore.getWriteCountTotal(); null : Long.toString(pageStore.getWriteCountTotal());
lock.setProperty("logPos", pos); lock.setProperty("logPos", pos);
lock.save(); lock.save();
} }
...@@ -433,7 +433,7 @@ public class Database implements DataHandler { ...@@ -433,7 +433,7 @@ public class Database implements DataHandler {
} }
} }
String pos = pageStore == null ? String pos = pageStore == null ?
null : "" + pageStore.getWriteCountTotal(); null : Long.toString(pageStore.getWriteCountTotal());
lock.setProperty("logPos", pos); lock.setProperty("logPos", pos);
if (pending) { if (pending) {
lock.setProperty("changePending", "true-" + Math.random()); lock.setProperty("changePending", "true-" + Math.random());
...@@ -2646,7 +2646,7 @@ public class Database implements DataHandler { ...@@ -2646,7 +2646,7 @@ public class Database implements DataHandler {
long now = System.nanoTime(); long now = System.nanoTime();
if (now > reconnectCheckNext + reconnectCheckDelayNs) { if (now > reconnectCheckNext + reconnectCheckDelayNs) {
if (SysProperties.CHECK && checkpointAllowed < 0) { if (SysProperties.CHECK && checkpointAllowed < 0) {
DbException.throwInternalError("" + checkpointAllowed); DbException.throwInternalError(Integer.toString(checkpointAllowed));
} }
synchronized (reconnectSync) { synchronized (reconnectSync) {
if (checkpointAllowed > 0) { if (checkpointAllowed > 0) {
...@@ -2716,7 +2716,7 @@ public class Database implements DataHandler { ...@@ -2716,7 +2716,7 @@ public class Database implements DataHandler {
if (reconnectModified(true)) { if (reconnectModified(true)) {
checkpointAllowed++; checkpointAllowed++;
if (SysProperties.CHECK && checkpointAllowed > 20) { if (SysProperties.CHECK && checkpointAllowed > 20) {
throw DbException.throwInternalError("" + checkpointAllowed); throw DbException.throwInternalError(Integer.toString(checkpointAllowed));
} }
return true; return true;
} }
...@@ -2738,7 +2738,7 @@ public class Database implements DataHandler { ...@@ -2738,7 +2738,7 @@ public class Database implements DataHandler {
checkpointAllowed--; checkpointAllowed--;
} }
if (SysProperties.CHECK && checkpointAllowed < 0) { if (SysProperties.CHECK && checkpointAllowed < 0) {
throw DbException.throwInternalError("" + checkpointAllowed); throw DbException.throwInternalError(Integer.toString(checkpointAllowed));
} }
} }
......
...@@ -20,7 +20,13 @@ class OnExitDatabaseCloser extends Thread { ...@@ -20,7 +20,13 @@ class OnExitDatabaseCloser extends Thread {
private static boolean registered; private static boolean registered;
private static boolean terminated;
static synchronized void register(Database db) { static synchronized void register(Database db) {
if (terminated) {
// Shutdown in progress
return;
}
DATABASES.put(db, null); DATABASES.put(db, null);
if (!registered) { if (!registered) {
// Mark as registered unconditionally to avoid further attempts to register a // Mark as registered unconditionally to avoid further attempts to register a
...@@ -41,6 +47,11 @@ class OnExitDatabaseCloser extends Thread { ...@@ -41,6 +47,11 @@ class OnExitDatabaseCloser extends Thread {
} }
static synchronized void unregister(Database db) { static synchronized void unregister(Database db) {
if (terminated) {
// Shutdown in progress, do nothing
// This method can be called from the onShutdown()
return;
}
DATABASES.remove(db); DATABASES.remove(db);
if (DATABASES.isEmpty() && registered) { if (DATABASES.isEmpty() && registered) {
try { try {
...@@ -54,11 +65,8 @@ class OnExitDatabaseCloser extends Thread { ...@@ -54,11 +65,8 @@ class OnExitDatabaseCloser extends Thread {
} }
} }
private OnExitDatabaseCloser() { private static synchronized void onShutdown() {
} terminated = true;
@Override
public void run() {
RuntimeException root = null; RuntimeException root = null;
for (Database database : DATABASES.keySet()) { for (Database database : DATABASES.keySet()) {
try { try {
...@@ -86,4 +94,12 @@ class OnExitDatabaseCloser extends Thread { ...@@ -86,4 +94,12 @@ class OnExitDatabaseCloser extends Thread {
} }
} }
private OnExitDatabaseCloser() {
}
@Override
public void run() {
onShutdown();
}
} }
...@@ -75,7 +75,7 @@ public class Right extends DbObjectBase { ...@@ -75,7 +75,7 @@ public class Right extends DbObjectBase {
public Right(Database db, int id, RightOwner grantee, int grantedRight, public Right(Database db, int id, RightOwner grantee, int grantedRight,
DbObject grantedObject) { DbObject grantedObject) {
initDbObjectBase(db, id, "" + id, Trace.USER); initDbObjectBase(db, id, Integer.toString(id), Trace.USER);
this.grantee = grantee; this.grantee = grantee;
this.grantedRight = grantedRight; this.grantedRight = grantedRight;
this.grantedObject = grantedObject; this.grantedObject = grantedObject;
......
...@@ -47,7 +47,7 @@ public class SettingsBase { ...@@ -47,7 +47,7 @@ public class SettingsBase {
* @return the setting * @return the setting
*/ */
protected int get(String key, int defaultValue) { protected int get(String key, int defaultValue) {
String s = get(key, "" + defaultValue); String s = get(key, Integer.toString(defaultValue));
try { try {
return Integer.decode(s); return Integer.decode(s);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
......
...@@ -333,7 +333,7 @@ public class CompareLike extends Condition { ...@@ -333,7 +333,7 @@ public class CompareLike extends Condition {
} }
return false; return false;
default: default:
DbException.throwInternalError("" + types[pi]); DbException.throwInternalError(Integer.toString(types[pi]));
} }
} }
return si == sLen; return si == sLen;
......
...@@ -557,7 +557,7 @@ public class Function extends Expression implements FunctionCall { ...@@ -557,7 +557,7 @@ public class Function extends Expression implements FunctionCall {
} else { } else {
if (index >= args.length) { if (index >= args.length) {
throw DbException.get(ErrorCode.INVALID_PARAMETER_COUNT_2, throw DbException.get(ErrorCode.INVALID_PARAMETER_COUNT_2,
info.name, "" + args.length); info.name, Integer.toString(args.length));
} }
args[index] = param; args[index] = param;
} }
...@@ -2165,7 +2165,7 @@ public class Function extends Expression implements FunctionCall { ...@@ -2165,7 +2165,7 @@ public class Function extends Expression implements FunctionCall {
if (len > 0 && args[len - 1] == null) { if (len > 0 && args[len - 1] == null) {
throw DbException.get( throw DbException.get(
ErrorCode.INVALID_PARAMETER_COUNT_2, ErrorCode.INVALID_PARAMETER_COUNT_2,
info.name, "" + len); info.name, Integer.toString(len));
} }
} }
} }
......
...@@ -100,7 +100,7 @@ public class Wildcard extends Expression { ...@@ -100,7 +100,7 @@ public class Wildcard extends Expression {
if (visitor.getType() == ExpressionVisitor.QUERY_COMPARABLE) { if (visitor.getType() == ExpressionVisitor.QUERY_COMPARABLE) {
return true; return true;
} }
throw DbException.throwInternalError("" + visitor.getType()); throw DbException.throwInternalError(Integer.toString(visitor.getType()));
} }
@Override @Override
......
...@@ -176,7 +176,7 @@ public class PageBtreeLeaf extends PageBtree { ...@@ -176,7 +176,7 @@ public class PageBtreeLeaf extends PageBtree {
written = false; written = false;
changeCount = index.getPageStore().getChangeCount(); changeCount = index.getPageStore().getChangeCount();
if (entryCount <= 0) { if (entryCount <= 0) {
DbException.throwInternalError("" + entryCount); DbException.throwInternalError(Integer.toString(entryCount));
} }
int startNext = at > 0 ? offsets[at - 1] : index.getPageStore().getPageSize(); int startNext = at > 0 ? offsets[at - 1] : index.getPageStore().getPageSize();
int rowLength = startNext - offsets[at]; int rowLength = startNext - offsets[at];
......
...@@ -474,7 +474,7 @@ public class PageBtreeNode extends PageBtree { ...@@ -474,7 +474,7 @@ public class PageBtreeNode extends PageBtree {
written = false; written = false;
changeCount = index.getPageStore().getChangeCount(); changeCount = index.getPageStore().getChangeCount();
if (entryCount < 0) { if (entryCount < 0) {
DbException.throwInternalError("" + entryCount); DbException.throwInternalError(Integer.toString(entryCount));
} }
if (entryCount > i) { if (entryCount > i) {
int startNext = i > 0 ? offsets[i - 1] : index.getPageStore().getPageSize(); int startNext = i > 0 ? offsets[i - 1] : index.getPageStore().getPageSize();
......
...@@ -220,7 +220,7 @@ public class PageDataLeaf extends PageData { ...@@ -220,7 +220,7 @@ public class PageDataLeaf extends PageData {
if (offset < start) { if (offset < start) {
writtenData = false; writtenData = false;
if (entryCount > 1) { if (entryCount > 1) {
DbException.throwInternalError("" + entryCount); DbException.throwInternalError(Integer.toString(entryCount));
} }
// need to write the overflow page id // need to write the overflow page id
start += 4; start += 4;
...@@ -283,7 +283,7 @@ public class PageDataLeaf extends PageData { ...@@ -283,7 +283,7 @@ public class PageDataLeaf extends PageData {
} }
entryCount--; entryCount--;
if (entryCount < 0) { if (entryCount < 0) {
DbException.throwInternalError("" + entryCount); DbException.throwInternalError(Integer.toString(entryCount));
} }
if (firstOverflowPageId != 0) { if (firstOverflowPageId != 0) {
start -= 4; start -= 4;
......
...@@ -388,7 +388,7 @@ public class PageDataNode extends PageData { ...@@ -388,7 +388,7 @@ public class PageDataNode extends PageData {
entryCount--; entryCount--;
length -= 4 + Data.getVarLongLen(keys[removedKeyIndex]); length -= 4 + Data.getVarLongLen(keys[removedKeyIndex]);
if (entryCount < 0) { if (entryCount < 0) {
DbException.throwInternalError("" + entryCount); DbException.throwInternalError(Integer.toString(entryCount));
} }
keys = remove(keys, entryCount + 1, removedKeyIndex); keys = remove(keys, entryCount + 1, removedKeyIndex);
childPageIds = remove(childPageIds, entryCount + 2, i); childPageIds = remove(childPageIds, entryCount + 2, i);
......
...@@ -46,7 +46,7 @@ public class JdbcSQLException extends SQLException { ...@@ -46,7 +46,7 @@ public class JdbcSQLException extends SQLException {
this.originalMessage = message; this.originalMessage = message;
this.cause = cause; this.cause = cause;
this.stackTrace = stackTrace; this.stackTrace = stackTrace;
// setSQL() invokes buildBessage() by itself // setSQL() invokes buildMessage() by itself
setSQL(sql); setSQL(sql);
initCause(cause); initCause(cause);
} }
......
...@@ -281,7 +281,8 @@ public class TransactionMap<K, V> { ...@@ -281,7 +281,8 @@ public class TransactionMap<K, V> {
Page mapRootPage = mapRootReference.root; Page mapRootPage = mapRootReference.root;
current = map.get(mapRootPage, key); current = map.get(mapRootPage, key);
VersionedValue old = getValue(mapRootPage, undoLogRootReference.root, key, readLogId, current, committingTransactions); VersionedValue old = getValue(mapRootPage, undoLogRootReference.root, key, readLogId, current,
committingTransactions);
if (!map.areValuesEqual(old, current)) { if (!map.areValuesEqual(old, current)) {
assert current != null; assert current != null;
long tx = TransactionStore.getTransactionId(current.getOperationId()); long tx = TransactionStore.getTransactionId(current.getOperationId());
...@@ -432,7 +433,7 @@ public class TransactionMap<K, V> { ...@@ -432,7 +433,7 @@ public class TransactionMap<K, V> {
* at the time when snapshot was taken * at the time when snapshot was taken
* @return the value * @return the value
*/ */
private VersionedValue getValue(Page root, Page undoRoot, K key, long maxLog, VersionedValue getValue(Page root, Page undoRoot, K key, long maxLog,
VersionedValue data, BitSet committingTransactions) { VersionedValue data, BitSet committingTransactions) {
while (true) { while (true) {
if (data == null) { if (data == null) {
...@@ -681,8 +682,7 @@ public class TransactionMap<K, V> { ...@@ -681,8 +682,7 @@ public class TransactionMap<K, V> {
private static final class KeyIterator<K> extends TMIterator<K,K> { private static final class KeyIterator<K> extends TMIterator<K,K> {
public KeyIterator(TransactionMap<K, ?> transactionMap, public KeyIterator(TransactionMap<K, ?> transactionMap, K from, K to, boolean includeUncommitted) {
K from, K to, boolean includeUncommitted) {
super(transactionMap, from, to, includeUncommitted); super(transactionMap, from, to, includeUncommitted);
} }
...@@ -714,8 +714,7 @@ public class TransactionMap<K, V> { ...@@ -714,8 +714,7 @@ public class TransactionMap<K, V> {
private final boolean includeAllUncommitted; private final boolean includeAllUncommitted;
private X current; private X current;
protected TMIterator(TransactionMap<K,?> transactionMap, K from, K to, boolean includeAllUncommitted) protected TMIterator(TransactionMap<K,?> transactionMap, K from, K to, boolean includeAllUncommitted) {
{
this.transactionMap = transactionMap; this.transactionMap = transactionMap;
TransactionStore store = transactionMap.transaction.store; TransactionStore store = transactionMap.transaction.store;
MVMap<K, VersionedValue> map = transactionMap.map; MVMap<K, VersionedValue> map = transactionMap.map;
...@@ -726,7 +725,8 @@ public class TransactionMap<K, V> { ...@@ -726,7 +725,8 @@ public class TransactionMap<K, V> {
committingTransactions = store.committingTransactions.get(); committingTransactions = store.committingTransactions.get();
undoRoot = store.undoLog.getRootPage(); undoRoot = store.undoLog.getRootPage();
mapRootReference = map.getRoot(); mapRootReference = map.getRoot();
} while(committingTransactions != store.committingTransactions.get() || undoRoot != store.undoLog.getRootPage()); } while (committingTransactions != store.committingTransactions.get()
|| undoRoot != store.undoLog.getRootPage());
this.root = mapRootReference.root; this.root = mapRootReference.root;
this.undoRoot = undoRoot; this.undoRoot = undoRoot;
......
...@@ -91,15 +91,15 @@ public class TcpServerThread implements Runnable { ...@@ -91,15 +91,15 @@ public class TcpServerThread implements Runnable {
int minClientVersion = transfer.readInt(); int minClientVersion = transfer.readInt();
if (minClientVersion < 6) { if (minClientVersion < 6) {
throw DbException.get(ErrorCode.DRIVER_VERSION_ERROR_2, throw DbException.get(ErrorCode.DRIVER_VERSION_ERROR_2,
"" + minClientVersion, "" + Constants.TCP_PROTOCOL_VERSION_MIN_SUPPORTED); Integer.toString(minClientVersion), "" + Constants.TCP_PROTOCOL_VERSION_MIN_SUPPORTED);
} }
int maxClientVersion = transfer.readInt(); int maxClientVersion = transfer.readInt();
if (maxClientVersion < Constants.TCP_PROTOCOL_VERSION_MIN_SUPPORTED) { if (maxClientVersion < Constants.TCP_PROTOCOL_VERSION_MIN_SUPPORTED) {
throw DbException.get(ErrorCode.DRIVER_VERSION_ERROR_2, throw DbException.get(ErrorCode.DRIVER_VERSION_ERROR_2,
"" + maxClientVersion, "" + Constants.TCP_PROTOCOL_VERSION_MIN_SUPPORTED); Integer.toString(maxClientVersion), "" + Constants.TCP_PROTOCOL_VERSION_MIN_SUPPORTED);
} else if (minClientVersion > Constants.TCP_PROTOCOL_VERSION_MAX_SUPPORTED) { } else if (minClientVersion > Constants.TCP_PROTOCOL_VERSION_MAX_SUPPORTED) {
throw DbException.get(ErrorCode.DRIVER_VERSION_ERROR_2, throw DbException.get(ErrorCode.DRIVER_VERSION_ERROR_2,
"" + minClientVersion, "" + Constants.TCP_PROTOCOL_VERSION_MAX_SUPPORTED); Integer.toString(minClientVersion), "" + Constants.TCP_PROTOCOL_VERSION_MAX_SUPPORTED);
} }
if (maxClientVersion >= Constants.TCP_PROTOCOL_VERSION_MAX_SUPPORTED) { if (maxClientVersion >= Constants.TCP_PROTOCOL_VERSION_MAX_SUPPORTED) {
clientVersion = Constants.TCP_PROTOCOL_VERSION_MAX_SUPPORTED; clientVersion = Constants.TCP_PROTOCOL_VERSION_MAX_SUPPORTED;
......
...@@ -338,8 +338,8 @@ public class WebApp { ...@@ -338,8 +338,8 @@ public class WebApp {
} }
private String admin() { private String admin() {
session.put("port", "" + server.getPort()); session.put("port", Integer.toString(server.getPort()));
session.put("allowOthers", "" + server.getAllowOthers()); session.put("allowOthers", Boolean.toString(server.getAllowOthers()));
session.put("ssl", String.valueOf(server.getSSL())); session.put("ssl", String.valueOf(server.getSSL()));
session.put("sessions", server.getSessions()); session.put("sessions", server.getSessions());
return "admin.jsp"; return "admin.jsp";
...@@ -1172,16 +1172,16 @@ public class WebApp { ...@@ -1172,16 +1172,16 @@ public class WebApp {
SimpleResultSet rs = new SimpleResultSet(); SimpleResultSet rs = new SimpleResultSet();
rs.addColumn("Type", Types.VARCHAR, 0, 0); rs.addColumn("Type", Types.VARCHAR, 0, 0);
rs.addColumn("KB", Types.VARCHAR, 0, 0); rs.addColumn("KB", Types.VARCHAR, 0, 0);
rs.addRow("Used Memory", "" + Utils.getMemoryUsed()); rs.addRow("Used Memory", Integer.toString(Utils.getMemoryUsed()));
rs.addRow("Free Memory", "" + Utils.getMemoryFree()); rs.addRow("Free Memory", Integer.toString(Utils.getMemoryFree()));
return rs; return rs;
} else if (isBuiltIn(sql, "@info")) { } else if (isBuiltIn(sql, "@info")) {
SimpleResultSet rs = new SimpleResultSet(); SimpleResultSet rs = new SimpleResultSet();
rs.addColumn("KEY", Types.VARCHAR, 0, 0); rs.addColumn("KEY", Types.VARCHAR, 0, 0);
rs.addColumn("VALUE", Types.VARCHAR, 0, 0); rs.addColumn("VALUE", Types.VARCHAR, 0, 0);
rs.addRow("conn.getCatalog", conn.getCatalog()); rs.addRow("conn.getCatalog", conn.getCatalog());
rs.addRow("conn.getAutoCommit", "" + conn.getAutoCommit()); rs.addRow("conn.getAutoCommit", Boolean.toString(conn.getAutoCommit()));
rs.addRow("conn.getTransactionIsolation", "" + conn.getTransactionIsolation()); rs.addRow("conn.getTransactionIsolation", Integer.toString(conn.getTransactionIsolation()));
rs.addRow("conn.getWarnings", "" + conn.getWarnings()); rs.addRow("conn.getWarnings", "" + conn.getWarnings());
String map; String map;
try { try {
...@@ -1190,8 +1190,8 @@ public class WebApp { ...@@ -1190,8 +1190,8 @@ public class WebApp {
map = e.toString(); map = e.toString();
} }
rs.addRow("conn.getTypeMap", "" + map); rs.addRow("conn.getTypeMap", "" + map);
rs.addRow("conn.isReadOnly", "" + conn.isReadOnly()); rs.addRow("conn.isReadOnly", Boolean.toString(conn.isReadOnly()));
rs.addRow("conn.getHoldability", "" + conn.getHoldability()); rs.addRow("conn.getHoldability", Integer.toString(conn.getHoldability()));
addDatabaseMetaData(rs, meta); addDatabaseMetaData(rs, meta);
return rs; return rs;
} else if (isBuiltIn(sql, "@attributes")) { } else if (isBuiltIn(sql, "@attributes")) {
...@@ -1328,7 +1328,7 @@ public class WebApp { ...@@ -1328,7 +1328,7 @@ public class WebApp {
} else if (isBuiltIn(sql, "@maxrows")) { } else if (isBuiltIn(sql, "@maxrows")) {
int maxrows = (int) Double.parseDouble( int maxrows = (int) Double.parseDouble(
sql.substring("@maxrows".length()).trim()); sql.substring("@maxrows".length()).trim());
session.put("maxrows", "" + maxrows); session.put("maxrows", Integer.toString(maxrows));
return "${text.result.maxrowsSet}"; return "${text.result.maxrowsSet}";
} else if (isBuiltIn(sql, "@parameter_meta")) { } else if (isBuiltIn(sql, "@parameter_meta")) {
sql = sql.substring("@parameter_meta".length()).trim(); sql = sql.substring("@parameter_meta".length()).trim();
......
...@@ -672,14 +672,11 @@ public class WebServer implements Service { ...@@ -672,14 +672,11 @@ public class WebServer implements Service {
Properties old = loadProperties(); Properties old = loadProperties();
prop = new SortedProperties(); prop = new SortedProperties();
prop.setProperty("webPort", prop.setProperty("webPort",
"" + SortedProperties.getIntProperty(old, Integer.toString(SortedProperties.getIntProperty(old, "webPort", port)));
"webPort", port));
prop.setProperty("webAllowOthers", prop.setProperty("webAllowOthers",
"" + SortedProperties.getBooleanProperty(old, Boolean.toString(SortedProperties.getBooleanProperty(old, "webAllowOthers", allowOthers)));
"webAllowOthers", allowOthers));
prop.setProperty("webSSL", prop.setProperty("webSSL",
"" + SortedProperties.getBooleanProperty(old, Boolean.toString(SortedProperties.getBooleanProperty(old, "webSSL", ssl)));
"webSSL", ssl));
if (commandHistoryString != null) { if (commandHistoryString != null) {
prop.setProperty(COMMAND_HISTORY, commandHistoryString); prop.setProperty(COMMAND_HISTORY, commandHistoryString);
} }
......
...@@ -12,6 +12,7 @@ import java.io.Reader; ...@@ -12,6 +12,7 @@ import java.io.Reader;
import java.sql.DatabaseMetaData; import java.sql.DatabaseMetaData;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.sql.Types;
import java.text.Collator; import java.text.Collator;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
...@@ -797,15 +798,15 @@ public class MetaTable extends Table { ...@@ -797,15 +798,15 @@ public class MetaTable extends Table {
// REMARKS // REMARKS
replaceNullWithEmpty(table.getComment()), replaceNullWithEmpty(table.getComment()),
// LAST_MODIFICATION // LAST_MODIFICATION
"" + table.getMaxDataModificationId(), Long.toString(table.getMaxDataModificationId()),
// ID // ID
"" + table.getId(), Integer.toString(table.getId()),
// TYPE_NAME // TYPE_NAME
null, null,
// TABLE_CLASS // TABLE_CLASS
table.getClass().getName(), table.getClass().getName(),
// ROW_COUNT_ESTIMATE // ROW_COUNT_ESTIMATE
"" + table.getRowCountApproximation() Long.toString(table.getRowCountApproximation())
); );
} }
break; break;
...@@ -832,6 +833,8 @@ public class MetaTable extends Table { ...@@ -832,6 +833,8 @@ public class MetaTable extends Table {
String collation = database.getCompareMode().getName(); String collation = database.getCompareMode().getName();
for (int j = 0; j < cols.length; j++) { for (int j = 0; j < cols.length; j++) {
Column c = cols[j]; Column c = cols[j];
DataType dataType = c.getDataType();
String precision = Integer.toString(c.getPrecisionAsInt());
Sequence sequence = c.getSequence(); Sequence sequence = c.getSequence();
add(rows, add(rows,
// TABLE_CATALOG // TABLE_CATALOG
...@@ -849,31 +852,31 @@ public class MetaTable extends Table { ...@@ -849,31 +852,31 @@ public class MetaTable extends Table {
// IS_NULLABLE // IS_NULLABLE
c.isNullable() ? "YES" : "NO", c.isNullable() ? "YES" : "NO",
// DATA_TYPE // DATA_TYPE
"" + DataType.convertTypeToSQLType(c.getType()), Integer.toString(dataType.sqlType),
// CHARACTER_MAXIMUM_LENGTH // CHARACTER_MAXIMUM_LENGTH
"" + c.getPrecisionAsInt(), precision,
// CHARACTER_OCTET_LENGTH // CHARACTER_OCTET_LENGTH
"" + c.getPrecisionAsInt(), precision,
// NUMERIC_PRECISION // NUMERIC_PRECISION
"" + c.getPrecisionAsInt(), precision,
// NUMERIC_PRECISION_RADIX // NUMERIC_PRECISION_RADIX
"10", "10",
// NUMERIC_SCALE // NUMERIC_SCALE
"" + c.getScale(), Integer.toString(c.getScale()),
// CHARACTER_SET_NAME // CHARACTER_SET_NAME
CHARACTER_SET_NAME, CHARACTER_SET_NAME,
// COLLATION_NAME // COLLATION_NAME
collation, collation,
// TYPE_NAME // TYPE_NAME
identifier(DataType.getDataType(c.getType()).name), identifier(dataType.name),
// NULLABLE // NULLABLE
"" + (c.isNullable() ? c.isNullable() ?
DatabaseMetaData.columnNullable : "" + DatabaseMetaData.columnNullable :
DatabaseMetaData.columnNoNulls) , "" + DatabaseMetaData.columnNoNulls,
// IS_COMPUTED // IS_COMPUTED
"" + (c.getComputed() ? "TRUE" : "FALSE"), c.getComputed() ? "TRUE" : "FALSE",
// SELECTIVITY // SELECTIVITY
"" + (c.getSelectivity()), Integer.toString(c.getSelectivity()),
// CHECK_CONSTRAINT // CHECK_CONSTRAINT
c.getCheckConstraintSQL(session, c.getName()), c.getCheckConstraintSQL(session, c.getName()),
// SEQUENCE_NAME // SEQUENCE_NAME
...@@ -953,7 +956,7 @@ public class MetaTable extends Table { ...@@ -953,7 +956,7 @@ public class MetaTable extends Table {
// INDEX_NAME // INDEX_NAME
identifier(index.getName()), identifier(index.getName()),
// ORDINAL_POSITION // ORDINAL_POSITION
"" + (k+1), Integer.toString(k + 1),
// COLUMN_NAME // COLUMN_NAME
identifier(column.getName()), identifier(column.getName()),
// CARDINALITY // CARDINALITY
...@@ -980,9 +983,9 @@ public class MetaTable extends Table { ...@@ -980,9 +983,9 @@ public class MetaTable extends Table {
// SQL // SQL
index.getCreateSQL(), index.getCreateSQL(),
// ID // ID
"" + index.getId(), Integer.toString(index.getId()),
// SORT_TYPE // SORT_TYPE
"" + idxCol.sortType, Integer.toString(idxCol.sortType),
// CONSTRAINT_NAME // CONSTRAINT_NAME
constraintName, constraintName,
// INDEX_CLASS // INDEX_CLASS
...@@ -1012,7 +1015,7 @@ public class MetaTable extends Table { ...@@ -1012,7 +1015,7 @@ public class MetaTable extends Table {
for (Setting s : database.getAllSettings()) { for (Setting s : database.getAllSettings()) {
String value = s.getStringValue(); String value = s.getStringValue();
if (value == null) { if (value == null) {
value = "" + s.getIntValue(); value = Integer.toString(s.getIntValue());
} }
add(rows, add(rows,
identifier(s.getName()), identifier(s.getName()),
...@@ -1022,7 +1025,7 @@ public class MetaTable extends Table { ...@@ -1022,7 +1025,7 @@ public class MetaTable extends Table {
add(rows, "info.BUILD_ID", "" + Constants.BUILD_ID); add(rows, "info.BUILD_ID", "" + Constants.BUILD_ID);
add(rows, "info.VERSION_MAJOR", "" + Constants.VERSION_MAJOR); add(rows, "info.VERSION_MAJOR", "" + Constants.VERSION_MAJOR);
add(rows, "info.VERSION_MINOR", "" + Constants.VERSION_MINOR); add(rows, "info.VERSION_MINOR", "" + Constants.VERSION_MINOR);
add(rows, "info.VERSION", "" + Constants.getFullVersion()); add(rows, "info.VERSION", Constants.getFullVersion());
if (admin) { if (admin) {
String[] settings = { String[] settings = {
"java.runtime.version", "java.vm.name", "java.runtime.version", "java.vm.name",
...@@ -1039,9 +1042,9 @@ public class MetaTable extends Table { ...@@ -1039,9 +1042,9 @@ public class MetaTable extends Table {
add(rows, "MODE", database.getMode().getName()); add(rows, "MODE", database.getMode().getName());
add(rows, "MULTI_THREADED", database.isMultiThreaded() ? "1" : "0"); add(rows, "MULTI_THREADED", database.isMultiThreaded() ? "1" : "0");
add(rows, "MVCC", database.isMultiVersion() ? "TRUE" : "FALSE"); add(rows, "MVCC", database.isMultiVersion() ? "TRUE" : "FALSE");
add(rows, "QUERY_TIMEOUT", "" + session.getQueryTimeout()); add(rows, "QUERY_TIMEOUT", Integer.toString(session.getQueryTimeout()));
add(rows, "RETENTION_TIME", "" + database.getRetentionTime()); add(rows, "RETENTION_TIME", Integer.toString(database.getRetentionTime()));
add(rows, "LOG", "" + database.getLogMode()); add(rows, "LOG", Integer.toString(database.getLogMode()));
// database settings // database settings
ArrayList<String> settingNames = Utils.newSmallArrayList(); ArrayList<String> settingNames = Utils.newSmallArrayList();
HashMap<String, String> s = database.getSettings().getSettings(); HashMap<String, String> s = database.getSettings().getSettings();
...@@ -1054,27 +1057,27 @@ public class MetaTable extends Table { ...@@ -1054,27 +1057,27 @@ public class MetaTable extends Table {
PageStore store = database.getPageStore(); PageStore store = database.getPageStore();
if (store != null) { if (store != null) {
add(rows, "info.FILE_WRITE_TOTAL", add(rows, "info.FILE_WRITE_TOTAL",
"" + store.getWriteCountTotal()); Long.toString(store.getWriteCountTotal()));
add(rows, "info.FILE_WRITE", add(rows, "info.FILE_WRITE",
"" + store.getWriteCount()); Long.toString(store.getWriteCount()));
add(rows, "info.FILE_READ", add(rows, "info.FILE_READ",
"" + store.getReadCount()); Long.toString(store.getReadCount()));
add(rows, "info.PAGE_COUNT", add(rows, "info.PAGE_COUNT",
"" + store.getPageCount()); Integer.toString(store.getPageCount()));
add(rows, "info.PAGE_SIZE", add(rows, "info.PAGE_SIZE",
"" + store.getPageSize()); Integer.toString(store.getPageSize()));
add(rows, "info.CACHE_MAX_SIZE", add(rows, "info.CACHE_MAX_SIZE",
"" + store.getCache().getMaxMemory()); Integer.toString(store.getCache().getMaxMemory()));
add(rows, "info.CACHE_SIZE", add(rows, "info.CACHE_SIZE",
"" + store.getCache().getMemory()); Integer.toString(store.getCache().getMemory()));
} }
Store mvStore = database.getMvStore(); Store mvStore = database.getMvStore();
if (mvStore != null) { if (mvStore != null) {
FileStore fs = mvStore.getStore().getFileStore(); FileStore fs = mvStore.getStore().getFileStore();
add(rows, "info.FILE_WRITE", "" + add(rows, "info.FILE_WRITE",
fs.getWriteCount()); Long.toString(fs.getWriteCount()));
add(rows, "info.FILE_READ", "" + add(rows, "info.FILE_READ",
fs.getReadCount()); Long.toString(fs.getReadCount()));
long size; long size;
try { try {
size = fs.getFile().size(); size = fs.getFile().size();
...@@ -1083,14 +1086,14 @@ public class MetaTable extends Table { ...@@ -1083,14 +1086,14 @@ public class MetaTable extends Table {
} }
int pageSize = 4 * 1024; int pageSize = 4 * 1024;
long pageCount = size / pageSize; long pageCount = size / pageSize;
add(rows, "info.PAGE_COUNT", "" + add(rows, "info.PAGE_COUNT",
pageCount); Long.toString(pageCount));
add(rows, "info.PAGE_SIZE", "" + add(rows, "info.PAGE_SIZE",
pageSize); Integer.toString(pageSize));
add(rows, "info.CACHE_MAX_SIZE", "" + add(rows, "info.CACHE_MAX_SIZE",
mvStore.getStore().getCacheSize()); Integer.toString(mvStore.getStore().getCacheSize()));
add(rows, "info.CACHE_SIZE", "" + add(rows, "info.CACHE_SIZE",
mvStore.getStore().getCacheSizeUsed()); Integer.toString(mvStore.getStore().getCacheSizeUsed()));
} }
} }
break; break;
...@@ -1189,7 +1192,7 @@ public class MetaTable extends Table { ...@@ -1189,7 +1192,7 @@ public class MetaTable extends Table {
// IS_CYCLE // IS_CYCLE
s.getCycle() ? "TRUE" : "FALSE", s.getCycle() ? "TRUE" : "FALSE",
// ID // ID
"" + s.getId() Integer.toString(s.getId())
); );
} }
break; break;
...@@ -1205,7 +1208,7 @@ public class MetaTable extends Table { ...@@ -1205,7 +1208,7 @@ public class MetaTable extends Table {
// REMARKS // REMARKS
replaceNullWithEmpty(u.getComment()), replaceNullWithEmpty(u.getComment()),
// ID // ID
"" + u.getId() Integer.toString(u.getId())
); );
} }
} }
...@@ -1220,7 +1223,7 @@ public class MetaTable extends Table { ...@@ -1220,7 +1223,7 @@ public class MetaTable extends Table {
// REMARKS // REMARKS
replaceNullWithEmpty(r.getComment()), replaceNullWithEmpty(r.getComment()),
// ID // ID
"" + r.getId() Integer.toString(r.getId())
); );
} }
} }
...@@ -1264,7 +1267,7 @@ public class MetaTable extends Table { ...@@ -1264,7 +1267,7 @@ public class MetaTable extends Table {
// TABLE_NAME // TABLE_NAME
tableName, tableName,
// ID // ID
"" + r.getId() Integer.toString(r.getId())
); );
} else { } else {
add(rows, add(rows,
...@@ -1281,7 +1284,7 @@ public class MetaTable extends Table { ...@@ -1281,7 +1284,7 @@ public class MetaTable extends Table {
// TABLE_NAME // TABLE_NAME
"", "",
// ID // ID
"" + r.getId() Integer.toString(r.getId())
); );
} }
} }
...@@ -1314,17 +1317,17 @@ public class MetaTable extends Table { ...@@ -1314,17 +1317,17 @@ public class MetaTable extends Table {
// JAVA_METHOD // JAVA_METHOD
alias.getJavaMethodName(), alias.getJavaMethodName(),
// DATA_TYPE // DATA_TYPE
"" + DataType.convertTypeToSQLType(method.getDataType()), Integer.toString(DataType.convertTypeToSQLType(method.getDataType())),
// TYPE_NAME // TYPE_NAME
DataType.getDataType(method.getDataType()).name, DataType.getDataType(method.getDataType()).name,
// COLUMN_COUNT INT // COLUMN_COUNT INT
"" + method.getParameterCount(), Integer.toString(method.getParameterCount()),
// RETURNS_RESULT SMALLINT // RETURNS_RESULT SMALLINT
"" + returnsResult, Integer.toString(returnsResult),
// REMARKS // REMARKS
replaceNullWithEmpty(alias.getComment()), replaceNullWithEmpty(alias.getComment()),
// ID // ID
"" + alias.getId(), Integer.toString(alias.getId()),
// SOURCE // SOURCE
alias.getSource() alias.getSource()
// when adding more columns, see also below // when adding more columns, see also below
...@@ -1345,17 +1348,17 @@ public class MetaTable extends Table { ...@@ -1345,17 +1348,17 @@ public class MetaTable extends Table {
// JAVA_METHOD // JAVA_METHOD
"", "",
// DATA_TYPE // DATA_TYPE
"" + DataType.convertTypeToSQLType(Value.NULL), "" + Types.NULL,
// TYPE_NAME // TYPE_NAME
DataType.getDataType(Value.NULL).name, DataType.getDataType(Value.NULL).name,
// COLUMN_COUNT INT // COLUMN_COUNT INT
"1", "1",
// RETURNS_RESULT SMALLINT // RETURNS_RESULT SMALLINT
"" + returnsResult, Integer.toString(returnsResult),
// REMARKS // REMARKS
replaceNullWithEmpty(agg.getComment()), replaceNullWithEmpty(agg.getComment()),
// ID // ID
"" + agg.getId(), Integer.toString(agg.getId()),
// SOURCE // SOURCE
"" ""
// when adding more columns, see also below // when adding more columns, see also below
...@@ -1389,19 +1392,19 @@ public class MetaTable extends Table { ...@@ -1389,19 +1392,19 @@ public class MetaTable extends Table {
// JAVA_METHOD // JAVA_METHOD
alias.getJavaMethodName(), alias.getJavaMethodName(),
// COLUMN_COUNT // COLUMN_COUNT
"" + method.getParameterCount(), Integer.toString(method.getParameterCount()),
// POS INT // POS INT
"0", "0",
// COLUMN_NAME // COLUMN_NAME
"P0", "P0",
// DATA_TYPE // DATA_TYPE
"" + DataType.convertTypeToSQLType(method.getDataType()), Integer.toString(DataType.convertTypeToSQLType(method.getDataType())),
// TYPE_NAME // TYPE_NAME
dt.name, dt.name,
// PRECISION INT // PRECISION INT
"" + MathUtils.convertLongToInt(dt.defaultPrecision), Integer.toString(MathUtils.convertLongToInt(dt.defaultPrecision)),
// SCALE // SCALE
"" + dt.defaultScale, Integer.toString(dt.defaultScale),
// RADIX // RADIX
"10", "10",
// NULLABLE SMALLINT // NULLABLE SMALLINT
...@@ -1436,23 +1439,23 @@ public class MetaTable extends Table { ...@@ -1436,23 +1439,23 @@ public class MetaTable extends Table {
// JAVA_METHOD // JAVA_METHOD
alias.getJavaMethodName(), alias.getJavaMethodName(),
// COLUMN_COUNT // COLUMN_COUNT
"" + method.getParameterCount(), Integer.toString(method.getParameterCount()),
// POS INT // POS INT
"" + (k + (method.hasConnectionParam() ? 0 : 1)), Integer.toString(k + (method.hasConnectionParam() ? 0 : 1)),
// COLUMN_NAME // COLUMN_NAME
"P" + (k + 1), "P" + (k + 1),
// DATA_TYPE // DATA_TYPE
"" + DataType.convertTypeToSQLType(dt.type), Integer.toString(DataType.convertTypeToSQLType(dt.type)),
// TYPE_NAME // TYPE_NAME
dt.name, dt.name,
// PRECISION INT // PRECISION INT
"" + MathUtils.convertLongToInt(dt.defaultPrecision), Integer.toString(MathUtils.convertLongToInt(dt.defaultPrecision)),
// SCALE // SCALE
"" + dt.defaultScale, Integer.toString(dt.defaultScale),
// RADIX // RADIX
"10", "10",
// NULLABLE SMALLINT // NULLABLE SMALLINT
"" + nullable, Integer.toString(nullable),
// COLUMN_TYPE // COLUMN_TYPE
"" + DatabaseMetaData.procedureColumnIn, "" + DatabaseMetaData.procedureColumnIn,
// REMARKS // REMARKS
...@@ -1485,7 +1488,7 @@ public class MetaTable extends Table { ...@@ -1485,7 +1488,7 @@ public class MetaTable extends Table {
// REMARKS // REMARKS
replaceNullWithEmpty(schema.getComment()), replaceNullWithEmpty(schema.getComment()),
// ID // ID
"" + schema.getId() Integer.toString(schema.getId())
); );
} }
break; break;
...@@ -1571,7 +1574,7 @@ public class MetaTable extends Table { ...@@ -1571,7 +1574,7 @@ public class MetaTable extends Table {
// REMARKS // REMARKS
replaceNullWithEmpty(view.getComment()), replaceNullWithEmpty(view.getComment()),
// ID // ID
"" + view.getId() Integer.toString(view.getId())
); );
} }
break; break;
...@@ -1707,7 +1710,7 @@ public class MetaTable extends Table { ...@@ -1707,7 +1710,7 @@ public class MetaTable extends Table {
// SQL // SQL
constraint.getCreateSQL(), constraint.getCreateSQL(),
// ID // ID
"" + constraint.getId() Integer.toString(constraint.getId())
); );
} }
break; break;
...@@ -1725,13 +1728,13 @@ public class MetaTable extends Table { ...@@ -1725,13 +1728,13 @@ public class MetaTable extends Table {
// CONSTANT_NAME // CONSTANT_NAME
identifier(constant.getName()), identifier(constant.getName()),
// CONSTANT_TYPE // CONSTANT_TYPE
"" + DataType.convertTypeToSQLType(expr.getType()), Integer.toString(DataType.convertTypeToSQLType(expr.getType())),
// REMARKS // REMARKS
replaceNullWithEmpty(constant.getComment()), replaceNullWithEmpty(constant.getComment()),
// SQL // SQL
expr.getSQL(), expr.getSQL(),
// ID // ID
"" + constant.getId() Integer.toString(constant.getId())
); );
} }
break; break;
...@@ -1751,15 +1754,15 @@ public class MetaTable extends Table { ...@@ -1751,15 +1754,15 @@ public class MetaTable extends Table {
// IS_NULLABLE // IS_NULLABLE
col.isNullable() ? "YES" : "NO", col.isNullable() ? "YES" : "NO",
// DATA_TYPE // DATA_TYPE
"" + col.getDataType().sqlType, Integer.toString(col.getDataType().sqlType),
// PRECISION INT // PRECISION INT
"" + col.getPrecisionAsInt(), Integer.toString(col.getPrecisionAsInt()),
// SCALE INT // SCALE INT
"" + col.getScale(), Integer.toString(col.getScale()),
// TYPE_NAME // TYPE_NAME
col.getDataType().name, col.getDataType().name,
// SELECTIVITY INT // SELECTIVITY INT
"" + col.getSelectivity(), Integer.toString(col.getSelectivity()),
// CHECK_CONSTRAINT // CHECK_CONSTRAINT
"" + col.getCheckConstraintSQL(session, "VALUE"), "" + col.getCheckConstraintSQL(session, "VALUE"),
// REMARKS // REMARKS
...@@ -1767,7 +1770,7 @@ public class MetaTable extends Table { ...@@ -1767,7 +1770,7 @@ public class MetaTable extends Table {
// SQL // SQL
"" + dt.getCreateSQL(), "" + dt.getCreateSQL(),
// ID // ID
"" + dt.getId() Integer.toString(dt.getId())
); );
} }
break; break;
...@@ -1793,19 +1796,19 @@ public class MetaTable extends Table { ...@@ -1793,19 +1796,19 @@ public class MetaTable extends Table {
// TABLE_NAME // TABLE_NAME
identifier(table.getName()), identifier(table.getName()),
// BEFORE BIT // BEFORE BIT
"" + trigger.isBefore(), Boolean.toString(trigger.isBefore()),
// JAVA_CLASS // JAVA_CLASS
trigger.getTriggerClassName(), trigger.getTriggerClassName(),
// QUEUE_SIZE INT // QUEUE_SIZE INT
"" + trigger.getQueueSize(), Integer.toString(trigger.getQueueSize()),
// NO_WAIT BIT // NO_WAIT BIT
"" + trigger.isNoWait(), Boolean.toString(trigger.isNoWait()),
// REMARKS // REMARKS
replaceNullWithEmpty(trigger.getComment()), replaceNullWithEmpty(trigger.getComment()),
// SQL // SQL
trigger.getCreateSQL(), trigger.getCreateSQL(),
// ID // ID
"" + trigger.getId() Integer.toString(trigger.getId())
); );
} }
break; break;
...@@ -1821,7 +1824,7 @@ public class MetaTable extends Table { ...@@ -1821,7 +1824,7 @@ public class MetaTable extends Table {
} }
add(rows, add(rows,
// ID // ID
"" + s.getId(), Integer.toString(s.getId()),
// USER_NAME // USER_NAME
s.getUser().getName(), s.getUser().getName(),
// SESSION_START // SESSION_START
...@@ -1831,7 +1834,7 @@ public class MetaTable extends Table { ...@@ -1831,7 +1834,7 @@ public class MetaTable extends Table {
// STATEMENT_START // STATEMENT_START
new Timestamp(start).toString(), new Timestamp(start).toString(),
// CONTAINS_UNCOMMITTED // CONTAINS_UNCOMMITTED
"" + s.containsUncommitted() Boolean.toString(s.containsUncommitted())
); );
} }
} }
...@@ -1847,7 +1850,7 @@ public class MetaTable extends Table { ...@@ -1847,7 +1850,7 @@ public class MetaTable extends Table {
// TABLE_NAME // TABLE_NAME
table.getName(), table.getName(),
// SESSION_ID // SESSION_ID
"" + s.getId(), Integer.toString(s.getId()),
// LOCK_TYPE // LOCK_TYPE
table.isLockedExclusivelyBy(s) ? "WRITE" : "READ" table.isLockedExclusivelyBy(s) ? "WRITE" : "READ"
); );
...@@ -1908,27 +1911,27 @@ public class MetaTable extends Table { ...@@ -1908,27 +1911,27 @@ public class MetaTable extends Table {
// SQL_STATEMENT // SQL_STATEMENT
entry.sqlStatement, entry.sqlStatement,
// EXECUTION_COUNT // EXECUTION_COUNT
"" + entry.count, Integer.toString(entry.count),
// MIN_EXECUTION_TIME // MIN_EXECUTION_TIME
"" + entry.executionTimeMinNanos / 1000d / 1000, Double.toString(entry.executionTimeMinNanos / 1_000_000d),
// MAX_EXECUTION_TIME // MAX_EXECUTION_TIME
"" + entry.executionTimeMaxNanos / 1000d / 1000, Double.toString(entry.executionTimeMaxNanos / 1_000_000d),
// CUMULATIVE_EXECUTION_TIME // CUMULATIVE_EXECUTION_TIME
"" + entry.executionTimeCumulativeNanos / 1000d / 1000, Double.toString(entry.executionTimeCumulativeNanos / 1_000_000d),
// AVERAGE_EXECUTION_TIME // AVERAGE_EXECUTION_TIME
"" + entry.executionTimeMeanNanos / 1000d / 1000, Double.toString(entry.executionTimeMeanNanos / 1_000_000d),
// STD_DEV_EXECUTION_TIME // STD_DEV_EXECUTION_TIME
"" + entry.getExecutionTimeStandardDeviation() / 1000d / 1000, Double.toString(entry.getExecutionTimeStandardDeviation() / 1_000_000d),
// MIN_ROW_COUNT // MIN_ROW_COUNT
"" + entry.rowCountMin, Integer.toString(entry.rowCountMin),
// MAX_ROW_COUNT // MAX_ROW_COUNT
"" + entry.rowCountMax, Integer.toString(entry.rowCountMax),
// CUMULATIVE_ROW_COUNT // CUMULATIVE_ROW_COUNT
"" + entry.rowCountCumulative, Long.toString(entry.rowCountCumulative),
// AVERAGE_ROW_COUNT // AVERAGE_ROW_COUNT
"" + entry.rowCountMean, Double.toString(entry.rowCountMean),
// STD_DEV_ROW_COUNT // STD_DEV_ROW_COUNT
"" + entry.getRowCountStandardDeviation() Double.toString(entry.getRowCountStandardDeviation())
); );
} }
} }
...@@ -1954,7 +1957,7 @@ public class MetaTable extends Table { ...@@ -1954,7 +1957,7 @@ public class MetaTable extends Table {
// REMARKS // REMARKS
replaceNullWithEmpty(synonym.getComment()), replaceNullWithEmpty(synonym.getComment()),
// ID // ID
"" + synonym.getId() Integer.toString(synonym.getId())
); );
} }
break; break;
......
...@@ -808,7 +808,7 @@ public class TableFilter implements ColumnResolver { ...@@ -808,7 +808,7 @@ public class TableFilter implements ColumnResolver {
IndexLookupBatch lookupBatch = joinBatch.getLookupBatch(joinFilterId); IndexLookupBatch lookupBatch = joinBatch.getLookupBatch(joinFilterId);
if (lookupBatch == null) { if (lookupBatch == null) {
if (joinFilterId != 0) { if (joinFilterId != 0) {
throw DbException.throwInternalError("" + joinFilterId); throw DbException.throwInternalError(Integer.toString(joinFilterId));
} }
} else { } else {
planBuff.append("batched:"); planBuff.append("batched:");
......
...@@ -264,7 +264,7 @@ public class CompressTool { ...@@ -264,7 +264,7 @@ public class CompressTool {
default: default:
throw DbException.get( throw DbException.get(
ErrorCode.UNSUPPORTED_COMPRESSION_ALGORITHM_1, ErrorCode.UNSUPPORTED_COMPRESSION_ALGORITHM_1,
"" + algorithm); Integer.toString(algorithm));
} }
} }
......
...@@ -65,7 +65,7 @@ public class MultiDimension implements Comparator<long[]> { ...@@ -65,7 +65,7 @@ public class MultiDimension implements Comparator<long[]> {
*/ */
public int getMaxValue(int dimensions) { public int getMaxValue(int dimensions) {
if (dimensions < 2 || dimensions > 32) { if (dimensions < 2 || dimensions > 32) {
throw new IllegalArgumentException("" + dimensions); throw new IllegalArgumentException(Integer.toString(dimensions));
} }
int bitsPerValue = getBitsPerValue(dimensions); int bitsPerValue = getBitsPerValue(dimensions);
return (int) ((1L << bitsPerValue) - 1); return (int) ((1L << bitsPerValue) - 1);
...@@ -270,18 +270,18 @@ public class MultiDimension implements Comparator<long[]> { ...@@ -270,18 +270,18 @@ public class MultiDimension implements Comparator<long[]> {
private void addMortonRanges(ArrayList<long[]> list, int[] min, int[] max, private void addMortonRanges(ArrayList<long[]> list, int[] min, int[] max,
int len, int level) { int len, int level) {
if (level > 100) { if (level > 100) {
throw new IllegalArgumentException("" + level); throw new IllegalArgumentException(Integer.toString(level));
} }
int largest = 0, largestDiff = 0; int largest = 0, largestDiff = 0;
long size = 1; long size = 1;
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
int diff = max[i] - min[i]; int diff = max[i] - min[i];
if (diff < 0) { if (diff < 0) {
throw new IllegalArgumentException(""+ diff); throw new IllegalArgumentException(Integer.toString(diff));
} }
size *= diff + 1; size *= diff + 1;
if (size < 0) { if (size < 0) {
throw new IllegalArgumentException("" + size); throw new IllegalArgumentException(Long.toString(size));
} }
if (diff > largestDiff) { if (diff > largestDiff) {
largestDiff = diff; largestDiff = diff;
......
...@@ -102,7 +102,8 @@ public class ColumnNamer { ...@@ -102,7 +102,8 @@ public class ColumnNamer {
} }
// go with a innocuous default name pattern // go with a innocuous default name pattern
if (columnName == null) { if (columnName == null) {
columnName = configuration.getDefaultColumnNamePattern().replace("$$", "" + (indexOfColumn + 1)); columnName = configuration.getDefaultColumnNamePattern()
.replace("$$", Integer.toString(indexOfColumn + 1));
} }
if (existingColumnNames.contains(columnName) && configuration.isGenerateUniqueColumnNames()) { if (existingColumnNames.contains(columnName) && configuration.isGenerateUniqueColumnNames()) {
columnName = generateUniqueName(columnName); columnName = generateUniqueName(columnName);
......
...@@ -86,7 +86,7 @@ public abstract class LazyFuture<T> implements Future<T> { ...@@ -86,7 +86,7 @@ public abstract class LazyFuture<T> implements Future<T> {
case S_CANCELED: case S_CANCELED:
throw new CancellationException(); throw new CancellationException();
default: default:
throw DbException.throwInternalError("" + state); throw DbException.throwInternalError(Integer.toString(state));
} }
} }
......
...@@ -178,7 +178,7 @@ public class NetUtils { ...@@ -178,7 +178,7 @@ public class NetUtils {
return new ServerSocket(port, 0, bindAddress); return new ServerSocket(port, 0, bindAddress);
} catch (BindException be) { } catch (BindException be) {
throw DbException.get(ErrorCode.EXCEPTION_OPENING_PORT_2, throw DbException.get(ErrorCode.EXCEPTION_OPENING_PORT_2,
be, "" + port, be.toString()); be, Integer.toString(port), be.toString());
} catch (IOException e) { } catch (IOException e) {
throw DbException.convertIOException(e, "port: " + port + " ssl: " + ssl); throw DbException.convertIOException(e, "port: " + port + " ssl: " + ssl);
} }
......
...@@ -207,7 +207,7 @@ public class Profiler implements Runnable { ...@@ -207,7 +207,7 @@ public class Profiler implements Runnable {
private static List<Object[]> readRunnableStackTraces(int pid) { private static List<Object[]> readRunnableStackTraces(int pid) {
try { try {
String jstack = exec("jstack", "" + pid); String jstack = exec("jstack", Integer.toString(pid));
LineNumberReader r = new LineNumberReader( LineNumberReader r = new LineNumberReader(
new StringReader(jstack)); new StringReader(jstack));
return readStackTrace(r); return readStackTrace(r);
......
...@@ -69,7 +69,7 @@ public class SortedProperties extends Properties { ...@@ -69,7 +69,7 @@ public class SortedProperties extends Properties {
* @return the value if set, or the default value if not * @return the value if set, or the default value if not
*/ */
public static int getIntProperty(Properties prop, String key, int def) { public static int getIntProperty(Properties prop, String key, int def) {
String value = prop.getProperty(key, "" + def); String value = prop.getProperty(key, Integer.toString(def));
try { try {
return Integer.decode(value); return Integer.decode(value);
} catch (Exception e) { } catch (Exception e) {
......
...@@ -948,7 +948,7 @@ public class DataType { ...@@ -948,7 +948,7 @@ public class DataType {
return Value.RESULT_SET; return Value.RESULT_SET;
default: default:
throw DbException.get( throw DbException.get(
ErrorCode.UNKNOWN_DATA_TYPE_1, "" + sqlType); ErrorCode.UNKNOWN_DATA_TYPE_1, Integer.toString(sqlType));
} }
} }
......
...@@ -779,7 +779,7 @@ public abstract class Value { ...@@ -779,7 +779,7 @@ public abstract class Value {
double d = getDouble(); double d = getDouble();
if (Double.isInfinite(d) || Double.isNaN(d)) { if (Double.isInfinite(d) || Double.isNaN(d)) {
throw DbException.get( throw DbException.get(
ErrorCode.DATA_CONVERSION_ERROR_1, "" + d); ErrorCode.DATA_CONVERSION_ERROR_1, Double.toString(d));
} }
return ValueDecimal.get(BigDecimal.valueOf(d)); return ValueDecimal.get(BigDecimal.valueOf(d));
} }
...@@ -787,7 +787,7 @@ public abstract class Value { ...@@ -787,7 +787,7 @@ public abstract class Value {
float f = getFloat(); float f = getFloat();
if (Float.isInfinite(f) || Float.isNaN(f)) { if (Float.isInfinite(f) || Float.isNaN(f)) {
throw DbException.get( throw DbException.get(
ErrorCode.DATA_CONVERSION_ERROR_1, "" + f); ErrorCode.DATA_CONVERSION_ERROR_1, Float.toString(f));
} }
// better rounding behavior than BigDecimal.valueOf(f) // better rounding behavior than BigDecimal.valueOf(f)
return ValueDecimal.get(new BigDecimal(Float.toString(f))); return ValueDecimal.get(new BigDecimal(Float.toString(f)));
......
...@@ -13,6 +13,7 @@ import java.sql.PreparedStatement; ...@@ -13,6 +13,7 @@ import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Time; import java.sql.Time;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.sql.Types;
import org.h2.engine.Mode; import org.h2.engine.Mode;
import org.h2.message.DbException; import org.h2.message.DbException;
...@@ -160,7 +161,7 @@ public class ValueNull extends Value { ...@@ -160,7 +161,7 @@ public class ValueNull extends Value {
@Override @Override
public void set(PreparedStatement prep, int parameterIndex) public void set(PreparedStatement prep, int parameterIndex)
throws SQLException { throws SQLException {
prep.setNull(parameterIndex, DataType.convertTypeToSQLType(Value.NULL)); prep.setNull(parameterIndex, Types.NULL);
} }
@Override @Override
......
...@@ -776,3 +776,5 @@ geometries sourceschema destschema generatedcolumn alphanumerically usages ...@@ -776,3 +776,5 @@ geometries sourceschema destschema generatedcolumn alphanumerically usages
sizable instantiates renders sdt txcommit unhelpful optimiser treats rejects referring untrusted computes vacate inverted sizable instantiates renders sdt txcommit unhelpful optimiser treats rejects referring untrusted computes vacate inverted
reordered colliding evgenij archaic invocations apostrophe hypothetically testref ryazanov useless completes highlighting tends degrade reordered colliding evgenij archaic invocations apostrophe hypothetically testref ryazanov useless completes highlighting tends degrade
summands minuend subtrahend
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论