提交 87b97ef0 authored 作者: Thomas Mueller's avatar Thomas Mueller

Split long lines.

上级 ced54a0a
...@@ -558,10 +558,13 @@ public class Schema extends DbObjectBase { ...@@ -558,10 +558,13 @@ public class Schema extends DbObjectBase {
* @param force create the object even if the database can not be accessed * @param force create the object even if the database can not be accessed
* @return the {@link TableLink} object * @return the {@link TableLink} object
*/ */
public TableLink createTableLink(int id, String tableName, String driver, String url, String user, String password, public TableLink createTableLink(int id, String tableName,
String driver, String url, String user, String password,
String originalSchema, String originalTable, boolean emitUpdates, boolean force) { String originalSchema, String originalTable, boolean emitUpdates, boolean force) {
synchronized (database) { synchronized (database) {
return new TableLink(this, id, tableName, driver, url, user, password, originalSchema, originalTable, emitUpdates, force); return new TableLink(this, id, tableName,
driver, url, user, password,
originalSchema, originalTable, emitUpdates, force);
} }
} }
......
...@@ -189,10 +189,14 @@ public class AES implements BlockCipher { ...@@ -189,10 +189,14 @@ public class AES implements BlockCipher {
x1 = ((FS[(y1 >> 24) & 255] << 24) | (FS[(y2 >> 16) & 255] << 16) | (FS[(y3 >> 8) & 255] << 8) | FS[y0 & 255]) ^ k[41]; x1 = ((FS[(y1 >> 24) & 255] << 24) | (FS[(y2 >> 16) & 255] << 16) | (FS[(y3 >> 8) & 255] << 8) | FS[y0 & 255]) ^ k[41];
x2 = ((FS[(y2 >> 24) & 255] << 24) | (FS[(y3 >> 16) & 255] << 16) | (FS[(y0 >> 8) & 255] << 8) | FS[y1 & 255]) ^ k[42]; x2 = ((FS[(y2 >> 24) & 255] << 24) | (FS[(y3 >> 16) & 255] << 16) | (FS[(y0 >> 8) & 255] << 8) | FS[y1 & 255]) ^ k[42];
x3 = ((FS[(y3 >> 24) & 255] << 24) | (FS[(y0 >> 16) & 255] << 16) | (FS[(y1 >> 8) & 255] << 8) | FS[y2 & 255]) ^ k[43]; x3 = ((FS[(y3 >> 24) & 255] << 24) | (FS[(y0 >> 16) & 255] << 16) | (FS[(y1 >> 8) & 255] << 8) | FS[y2 & 255]) ^ k[43];
out[off] = (byte) (x0 >> 24); out[off+1] = (byte) (x0 >> 16); out[off+2] = (byte) (x0 >> 8); out[off+3] = (byte) x0; out[off] = (byte) (x0 >> 24); out[off+1] = (byte) (x0 >> 16);
out[off+4] = (byte) (x1 >> 24); out[off+5] = (byte) (x1 >> 16); out[off+6] = (byte) (x1 >> 8); out[off+7] = (byte) x1; out[off+2] = (byte) (x0 >> 8); out[off+3] = (byte) x0;
out[off+8] = (byte) (x2 >> 24); out[off+9] = (byte) (x2 >> 16); out[off+10] = (byte) (x2 >> 8); out[off+11] = (byte) x2; out[off+4] = (byte) (x1 >> 24); out[off+5] = (byte) (x1 >> 16);
out[off+12] = (byte) (x3 >> 24); out[off+13] = (byte) (x3 >> 16); out[off+14] = (byte) (x3 >> 8); out[off+15] = (byte) x3; out[off+6] = (byte) (x1 >> 8); out[off+7] = (byte) x1;
out[off+8] = (byte) (x2 >> 24); out[off+9] = (byte) (x2 >> 16);
out[off+10] = (byte) (x2 >> 8); out[off+11] = (byte) x2;
out[off+12] = (byte) (x3 >> 24); out[off+13] = (byte) (x3 >> 16);
out[off+14] = (byte) (x3 >> 8); out[off+15] = (byte) x3;
} }
private void decryptBlock(byte[] in, byte[] out, int off) { private void decryptBlock(byte[] in, byte[] out, int off) {
...@@ -241,10 +245,14 @@ public class AES implements BlockCipher { ...@@ -241,10 +245,14 @@ public class AES implements BlockCipher {
x1 = ((RS[(y1 >> 24) & 255] << 24) | (RS[(y0 >> 16) & 255] << 16) | (RS[(y3 >> 8) & 255] << 8) | RS[y2 & 255]) ^ k[41]; x1 = ((RS[(y1 >> 24) & 255] << 24) | (RS[(y0 >> 16) & 255] << 16) | (RS[(y3 >> 8) & 255] << 8) | RS[y2 & 255]) ^ k[41];
x2 = ((RS[(y2 >> 24) & 255] << 24) | (RS[(y1 >> 16) & 255] << 16) | (RS[(y0 >> 8) & 255] << 8) | RS[y3 & 255]) ^ k[42]; x2 = ((RS[(y2 >> 24) & 255] << 24) | (RS[(y1 >> 16) & 255] << 16) | (RS[(y0 >> 8) & 255] << 8) | RS[y3 & 255]) ^ k[42];
x3 = ((RS[(y3 >> 24) & 255] << 24) | (RS[(y2 >> 16) & 255] << 16) | (RS[(y1 >> 8) & 255] << 8) | RS[y0 & 255]) ^ k[43]; x3 = ((RS[(y3 >> 24) & 255] << 24) | (RS[(y2 >> 16) & 255] << 16) | (RS[(y1 >> 8) & 255] << 8) | RS[y0 & 255]) ^ k[43];
out[off] = (byte) (x0 >> 24); out[off+1] = (byte) (x0 >> 16); out[off+2] = (byte) (x0 >> 8); out[off+3] = (byte) x0; out[off] = (byte) (x0 >> 24); out[off+1] = (byte) (x0 >> 16);
out[off+4] = (byte) (x1 >> 24); out[off+5] = (byte) (x1 >> 16); out[off+6] = (byte) (x1 >> 8); out[off+7] = (byte) x1; out[off+2] = (byte) (x0 >> 8); out[off+3] = (byte) x0;
out[off+8] = (byte) (x2 >> 24); out[off+9] = (byte) (x2 >> 16); out[off+10] = (byte) (x2 >> 8); out[off+11] = (byte) x2; out[off+4] = (byte) (x1 >> 24); out[off+5] = (byte) (x1 >> 16);
out[off+12] = (byte) (x3 >> 24); out[off+13] = (byte) (x3 >> 16); out[off+14] = (byte) (x3 >> 8); out[off+15] = (byte) x3; out[off+6] = (byte) (x1 >> 8); out[off+7] = (byte) x1;
out[off+8] = (byte) (x2 >> 24); out[off+9] = (byte) (x2 >> 16);
out[off+10] = (byte) (x2 >> 8); out[off+11] = (byte) x2;
out[off+12] = (byte) (x3 >> 24); out[off+13] = (byte) (x3 >> 16);
out[off+14] = (byte) (x3 >> 8); out[off+15] = (byte) x3;
} }
public int getKeyLength() { public int getKeyLength() {
......
...@@ -153,13 +153,65 @@ public class CipherFactory { ...@@ -153,13 +153,65 @@ public class CipherFactory {
KeyFactory keyFactory = KeyFactory.getInstance("RSA"); KeyFactory keyFactory = KeyFactory.getInstance("RSA");
store.load(null, password.toCharArray()); store.load(null, password.toCharArray());
PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec( PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(
StringUtils.convertHexToBytes("30820277020100300d06092a864886f70d0101010500048202613082025d02010002818100dc0a13c602b7141110eade2f051b54777b060d0f74e6a110f9cce81159f271ebc88d8e8aa1f743b505fc2e7dfe38d33b8d3f64d1b363d1af4d877833897954cbaec2fa384c22a415498cf306bb07ac09b76b001cd68bf77ea0a628f5101959cf2993a9c23dbee79b19305977f8715ae78d023471194cc900b231eecb0aaea98d02030100010281810099aa4ff4d0a09a5af0bd953cb10c4d08c3d98df565664ac5582e494314d5c3c92dddedd5d316a32a206be4ec084616fe57be15e27cad111aa3c21fa79e32258c6ca8430afc69eddd52d3b751b37da6b6860910b94653192c0db1d02abcfd6ce14c01f238eec7c20bd3bb750940004bacba2880349a9494d10e139ecb2355d101024100ffdc3defd9c05a2d377ef6019fa62b3fbd5b0020a04cc8533bca730e1f6fcf5dfceea1b044fbe17d9eababfbc7d955edad6bc60f9be826ad2c22ba77d19a9f65024100dc28d43fdbbc93852cc3567093157702bc16f156f709fb7db0d9eec028f41fd0edcd17224c866e66be1744141fb724a10fd741c8a96afdd9141b36d67fff6309024077b1cddbde0f69604bdcfe33263fb36ddf24aa3b9922327915b890f8a36648295d0139ecdf68c245652c4489c6257b58744fbdd961834a4cab201801a3b1e52d024100b17142e8991d1b350a0802624759d48ae2b8071a158ff91fabeb6a8f7c328e762143dc726b8529f42b1fab6220d1c676fdc27ba5d44e847c72c52064afd351a902407c6e23fe35bcfcd1a662aa82a2aa725fcece311644d5b6e3894853fd4ce9fe78218c957b1ff03fc9e5ef8ffeb6bd58235f6a215c97d354fdace7e781e4a63e8b")); StringUtils.convertHexToBytes(
"30820277020100300d06092a864886f70d010101" +
"0500048202613082025d02010002818100dc0a13" +
"c602b7141110eade2f051b54777b060d0f74e6a1" +
"10f9cce81159f271ebc88d8e8aa1f743b505fc2e" +
"7dfe38d33b8d3f64d1b363d1af4d877833897954" +
"cbaec2fa384c22a415498cf306bb07ac09b76b00" +
"1cd68bf77ea0a628f5101959cf2993a9c23dbee7" +
"9b19305977f8715ae78d023471194cc900b231ee" +
"cb0aaea98d02030100010281810099aa4ff4d0a0" +
"9a5af0bd953cb10c4d08c3d98df565664ac5582e" +
"494314d5c3c92dddedd5d316a32a206be4ec0846" +
"16fe57be15e27cad111aa3c21fa79e32258c6ca8" +
"430afc69eddd52d3b751b37da6b6860910b94653" +
"192c0db1d02abcfd6ce14c01f238eec7c20bd3bb" +
"750940004bacba2880349a9494d10e139ecb2355" +
"d101024100ffdc3defd9c05a2d377ef6019fa62b" +
"3fbd5b0020a04cc8533bca730e1f6fcf5dfceea1" +
"b044fbe17d9eababfbc7d955edad6bc60f9be826" +
"ad2c22ba77d19a9f65024100dc28d43fdbbc9385" +
"2cc3567093157702bc16f156f709fb7db0d9eec0" +
"28f41fd0edcd17224c866e66be1744141fb724a1" +
"0fd741c8a96afdd9141b36d67fff6309024077b1" +
"cddbde0f69604bdcfe33263fb36ddf24aa3b9922" +
"327915b890f8a36648295d0139ecdf68c245652c" +
"4489c6257b58744fbdd961834a4cab201801a3b1" +
"e52d024100b17142e8991d1b350a0802624759d4" +
"8ae2b8071a158ff91fabeb6a8f7c328e762143dc" +
"726b8529f42b1fab6220d1c676fdc27ba5d44e84" +
"7c72c52064afd351a902407c6e23fe35bcfcd1a6" +
"62aa82a2aa725fcece311644d5b6e3894853fd4c" +
"e9fe78218c957b1ff03fc9e5ef8ffeb6bd58235f" +
"6a215c97d354fdace7e781e4a63e8b"));
PrivateKey privateKey = keyFactory.generatePrivate(keySpec); PrivateKey privateKey = keyFactory.generatePrivate(keySpec);
Certificate[] certs = { CertificateFactory Certificate[] certs = { CertificateFactory
.getInstance("X.509") .getInstance("X.509")
.generateCertificate( .generateCertificate(
new ByteArrayInputStream( new ByteArrayInputStream(
StringUtils.convertHexToBytes("3082018b3081f502044295ce6b300d06092a864886f70d0101040500300d310b3009060355040313024832301e170d3035303532363133323630335a170d3337303933303036353734375a300d310b300906035504031302483230819f300d06092a864886f70d010101050003818d0030818902818100dc0a13c602b7141110eade2f051b54777b060d0f74e6a110f9cce81159f271ebc88d8e8aa1f743b505fc2e7dfe38d33b8d3f64d1b363d1af4d877833897954cbaec2fa384c22a415498cf306bb07ac09b76b001cd68bf77ea0a628f5101959cf2993a9c23dbee79b19305977f8715ae78d023471194cc900b231eecb0aaea98d0203010001300d06092a864886f70d01010405000381810083f4401a279453701bef9a7681a5b8b24f153f7d18c7c892133d97bd5f13736be7505290a445a7d5ceb75522403e5097515cd966ded6351ff60d5193de34cd36e5cb04d380398e66286f99923fd92296645fd4ada45844d194dfd815e6cd57f385c117be982809028bba1116c85740b3d27a55b1a0948bf291ddba44bed337b9"))), }; StringUtils.convertHexToBytes(
"3082018b3081f502044295ce6b300d06092a8648" +
"86f70d0101040500300d310b3009060355040313" +
"024832301e170d3035303532363133323630335a" +
"170d3337303933303036353734375a300d310b30" +
"0906035504031302483230819f300d06092a8648" +
"86f70d010101050003818d0030818902818100dc" +
"0a13c602b7141110eade2f051b54777b060d0f74" +
"e6a110f9cce81159f271ebc88d8e8aa1f743b505" +
"fc2e7dfe38d33b8d3f64d1b363d1af4d87783389" +
"7954cbaec2fa384c22a415498cf306bb07ac09b7" +
"6b001cd68bf77ea0a628f5101959cf2993a9c23d" +
"bee79b19305977f8715ae78d023471194cc900b2" +
"31eecb0aaea98d0203010001300d06092a864886" +
"f70d01010405000381810083f4401a279453701b" +
"ef9a7681a5b8b24f153f7d18c7c892133d97bd5f" +
"13736be7505290a445a7d5ceb75522403e509751" +
"5cd966ded6351ff60d5193de34cd36e5cb04d380" +
"398e66286f99923fd92296645fd4ada45844d194" +
"dfd815e6cd57f385c117be982809028bba1116c8" +
"5740b3d27a55b1a0948bf291ddba44bed337b9"))), };
store.setKeyEntry("h2", privateKey, password.toCharArray(), certs); store.setKeyEntry("h2", privateKey, password.toCharArray(), certs);
// --- generated code end --- // --- generated code end ---
return store; return store;
......
...@@ -45,10 +45,14 @@ public class Fog implements BlockCipher { ...@@ -45,10 +45,14 @@ public class Fog implements BlockCipher {
x1 = (x1 << s) | (x1 >>> (32 - s)); x1 = (x1 << s) | (x1 >>> (32 - s));
x3 ^= k; x3 ^= k;
x3 = (x3 << s) | (x3 >>> (32 - s)); x3 = (x3 << s) | (x3 >>> (32 - s));
out[off] = (byte) (x0 >> 24); out[off+1] = (byte) (x0 >> 16); out[off+2] = (byte) (x0 >> 8); out[off+3] = (byte) x0; out[off] = (byte) (x0 >> 24); out[off+1] = (byte) (x0 >> 16);
out[off+4] = (byte) (x1 >> 24); out[off+5] = (byte) (x1 >> 16); out[off+6] = (byte) (x1 >> 8); out[off+7] = (byte) x1; out[off+2] = (byte) (x0 >> 8); out[off+3] = (byte) x0;
out[off+8] = (byte) (x2 >> 24); out[off+9] = (byte) (x2 >> 16); out[off+10] = (byte) (x2 >> 8); out[off+11] = (byte) x2; out[off+4] = (byte) (x1 >> 24); out[off+5] = (byte) (x1 >> 16);
out[off+12] = (byte) (x3 >> 24); out[off+13] = (byte) (x3 >> 16); out[off+14] = (byte) (x3 >> 8); out[off+15] = (byte) x3; out[off+6] = (byte) (x1 >> 8); out[off+7] = (byte) x1;
out[off+8] = (byte) (x2 >> 24); out[off+9] = (byte) (x2 >> 16);
out[off+10] = (byte) (x2 >> 8); out[off+11] = (byte) x2;
out[off+12] = (byte) (x3 >> 24); out[off+13] = (byte) (x3 >> 16);
out[off+14] = (byte) (x3 >> 8); out[off+15] = (byte) x3;
} }
private void decryptBlock(byte[] in, byte[] out, int off) { private void decryptBlock(byte[] in, byte[] out, int off) {
...@@ -67,10 +71,14 @@ public class Fog implements BlockCipher { ...@@ -67,10 +71,14 @@ public class Fog implements BlockCipher {
x0 ^= k; x0 ^= k;
x2 = (x2 << s) | (x2 >>> (32 - s)); x2 = (x2 << s) | (x2 >>> (32 - s));
x2 ^= k; x2 ^= k;
out[off] = (byte) (x0 >> 24); out[off+1] = (byte) (x0 >> 16); out[off+2] = (byte) (x0 >> 8); out[off+3] = (byte) x0; out[off] = (byte) (x0 >> 24); out[off+1] = (byte) (x0 >> 16);
out[off+4] = (byte) (x1 >> 24); out[off+5] = (byte) (x1 >> 16); out[off+6] = (byte) (x1 >> 8); out[off+7] = (byte) x1; out[off+2] = (byte) (x0 >> 8); out[off+3] = (byte) x0;
out[off+8] = (byte) (x2 >> 24); out[off+9] = (byte) (x2 >> 16); out[off+10] = (byte) (x2 >> 8); out[off+11] = (byte) x2; out[off+4] = (byte) (x1 >> 24); out[off+5] = (byte) (x1 >> 16);
out[off+12] = (byte) (x3 >> 24); out[off+13] = (byte) (x3 >> 16); out[off+14] = (byte) (x3 >> 8); out[off+15] = (byte) x3; out[off+6] = (byte) (x1 >> 8); out[off+7] = (byte) x1;
out[off+8] = (byte) (x2 >> 24); out[off+9] = (byte) (x2 >> 16);
out[off+10] = (byte) (x2 >> 8); out[off+11] = (byte) x2;
out[off+12] = (byte) (x3 >> 24); out[off+13] = (byte) (x3 >> 16);
out[off+14] = (byte) (x3 >> 8); out[off+15] = (byte) x3;
} }
public int getKeyLength() { public int getKeyLength() {
......
...@@ -289,7 +289,8 @@ public class PgServer implements Service { ...@@ -289,7 +289,8 @@ public class PgServer implements Service {
} }
return ""; return "";
} }
PreparedStatement prep = conn.prepareStatement("select column_name from information_schema.indexes where id=? and ordinal_position=?"); PreparedStatement prep = conn.prepareStatement(
"select column_name from information_schema.indexes where id=? and ordinal_position=?");
prep.setInt(1, indexId); prep.setInt(1, indexId);
prep.setInt(2, ordinalPosition.intValue()); prep.setInt(2, ordinalPosition.intValue());
ResultSet rs = prep.executeQuery(); ResultSet rs = prep.executeQuery();
......
...@@ -465,7 +465,8 @@ public class WebApp { ...@@ -465,7 +465,8 @@ public class WebApp {
return "query.jsp"; return "query.jsp";
} }
private static int addColumns(boolean mainSchema, DbTableOrView table, StringBuilder buff, int treeIndex, boolean showColumnTypes, private static int addColumns(boolean mainSchema, DbTableOrView table,
StringBuilder buff, int treeIndex, boolean showColumnTypes,
StringBuilder columnsBuffer) { StringBuilder columnsBuffer) {
DbColumn[] columns = table.columns; DbColumn[] columns = table.columns;
for (int i = 0; columns != null && i < columns.length; i++) { for (int i = 0; columns != null && i < columns.length; i++) {
...@@ -509,7 +510,8 @@ public class WebApp { ...@@ -509,7 +510,8 @@ public class WebApp {
String columns; String columns;
} }
private static int addIndexes(boolean mainSchema, DatabaseMetaData meta, String table, String schema, StringBuilder buff, int treeIndex) private static int addIndexes(boolean mainSchema, DatabaseMetaData meta,
String table, String schema, StringBuilder buff, int treeIndex)
throws SQLException { throws SQLException {
ResultSet rs; ResultSet rs;
try { try {
...@@ -846,7 +848,8 @@ public class WebApp { ...@@ -846,7 +848,8 @@ public class WebApp {
long time = System.currentTimeMillis() - start; long time = System.currentTimeMillis() - start;
String success; String success;
if (time > 1000) { if (time > 1000) {
success = "<a class=\"error\" href=\"#\" onclick=\"var x=document.getElementById('prof').style;x.display=x.display==''?'none':'';\">" + success = "<a class=\"error\" href=\"#\" " +
"onclick=\"var x=document.getElementById('prof').style;x.display=x.display==''?'none':'';\">" +
"${text.login.testSuccessful}</a>" + "${text.login.testSuccessful}</a>" +
"<span style=\"display: none;\" id=\"prof\"><br />" + "<span style=\"display: none;\" id=\"prof\"><br />" +
PageParser.escapeHtml(profOpen) + PageParser.escapeHtml(profOpen) +
...@@ -1575,10 +1578,19 @@ public class WebApp { ...@@ -1575,10 +1578,19 @@ public class WebApp {
append("<img onclick=\"javascript:editRow("). append("<img onclick=\"javascript:editRow(").
append(rs.getRow()). append(rs.getRow()).
append(",'${sessionId}', '${text.resultEdit.save}', '${text.resultEdit.cancel}'"). append(",'${sessionId}', '${text.resultEdit.save}', '${text.resultEdit.cancel}'").
append(")\" width=16 height=16 src=\"ico_write.gif\" onmouseover = \"this.className ='icon_hover'\" onmouseout = \"this.className ='icon'\" class=\"icon\" alt=\"${text.resultEdit.edit}\" title=\"${text.resultEdit.edit}\" border=\"1\"/>"). append(")\" width=16 height=16 src=\"ico_write.gif\" " +
"onmouseover = \"this.className ='icon_hover'\" " +
"onmouseout = \"this.className ='icon'\" " +
"class=\"icon\" alt=\"${text.resultEdit.edit}\" " +
"title=\"${text.resultEdit.edit}\" border=\"1\"/>").
append("<a href=\"editResult.do?op=2&row="). append("<a href=\"editResult.do?op=2&row=").
append(rs.getRow()). append(rs.getRow()).
append("&jsessionid=${sessionId}\" target=\"h2result\" ><img width=16 height=16 src=\"ico_remove.gif\" onmouseover = \"this.className ='icon_hover'\" onmouseout = \"this.className ='icon'\" class=\"icon\" alt=\"${text.resultEdit.delete}\" title=\"${text.resultEdit.delete}\" border=\"1\" /></a>"). append("&jsessionid=${sessionId}\" target=\"h2result\" >" +
"<img width=16 height=16 src=\"ico_remove.gif\" " +
"onmouseover = \"this.className ='icon_hover'\" " +
"onmouseout = \"this.className ='icon'\" " +
"class=\"icon\" alt=\"${text.resultEdit.delete}\" " +
"title=\"${text.resultEdit.delete}\" border=\"1\" /></a>").
append("</td>"); append("</td>");
} }
for (int i = 0; i < columns; i++) { for (int i = 0; i < columns; i++) {
...@@ -1609,7 +1621,11 @@ public class WebApp { ...@@ -1609,7 +1621,11 @@ public class WebApp {
if (edit) { if (edit) {
buff.append("<tr><td>"). buff.append("<tr><td>").
append("<img onclick=\"javascript:editRow(-1, '${sessionId}', '${text.resultEdit.save}', '${text.resultEdit.cancel}'"). append("<img onclick=\"javascript:editRow(-1, '${sessionId}', '${text.resultEdit.save}', '${text.resultEdit.cancel}'").
append(")\" width=16 height=16 src=\"ico_add.gif\" onmouseover = \"this.className ='icon_hover'\" onmouseout = \"this.className ='icon'\" class=\"icon\" alt=\"${text.resultEdit.add}\" title=\"${text.resultEdit.add}\" border=\"1\"/>"). append(")\" width=16 height=16 src=\"ico_add.gif\" " +
"onmouseover = \"this.className ='icon_hover'\" " +
"onmouseout = \"this.className ='icon'\" " +
"class=\"icon\" alt=\"${text.resultEdit.add}\" " +
"title=\"${text.resultEdit.add}\" border=\"1\"/>").
append("</td>"); append("</td>");
for (int i = 0; i < columns; i++) { for (int i = 0; i < columns; i++) {
buff.append("<td></td>"); buff.append("<td></td>");
...@@ -1631,7 +1647,9 @@ public class WebApp { ...@@ -1631,7 +1647,9 @@ public class WebApp {
time = System.currentTimeMillis() - time; time = System.currentTimeMillis() - time;
buff.append(time).append(" ms)"); buff.append(time).append(" ms)");
if (!edit && isUpdatable && allowEdit) { if (!edit && isUpdatable && allowEdit) {
buff.append("<br /><br /><form name=\"editResult\" method=\"post\" action=\"query.do?jsessionid=${sessionId}\" target=\"h2result\">" + buff.append("<br /><br />" +
"<form name=\"editResult\" method=\"post\" " +
"action=\"query.do?jsessionid=${sessionId}\" target=\"h2result\">" +
"<input type=\"submit\" class=\"button\" value=\"${text.resultEdit.editResult}\" />" + "<input type=\"submit\" class=\"button\" value=\"${text.resultEdit.editResult}\" />" +
"<input type=\"hidden\" name=\"sql\" value=\"@edit "). "<input type=\"hidden\" name=\"sql\" value=\"@edit ").
append(PageParser.escapeHtmlData(sql)). append(PageParser.escapeHtmlData(sql)).
......
...@@ -77,12 +77,13 @@ public class WebServer implements Service { ...@@ -77,12 +77,13 @@ public class WebServer implements Service {
private static final String[] GENERIC = { private static final String[] GENERIC = {
"Generic JNDI Data Source|javax.naming.InitialContext|java:comp/env/jdbc/Test|sa", "Generic JNDI Data Source|javax.naming.InitialContext|java:comp/env/jdbc/Test|sa",
"Generic Firebird Server|org.firebirdsql.jdbc.FBDriver|jdbc:firebirdsql:localhost:c:/temp/firebird/test|sysdba", "Generic Firebird Server|org.firebirdsql.jdbc.FBDriver|jdbc:firebirdsql:localhost:c:/temp/firebird/test|sysdba",
"Generic OneDollarDB|in.co.daffodil.db.jdbc.DaffodilDBDriver|jdbc:daffodilDB_embedded:school;path=C:/temp;create=true|sa",
"Generic SQLite|org.sqlite.JDBC|jdbc:sqlite:test|sa", "Generic SQLite|org.sqlite.JDBC|jdbc:sqlite:test|sa",
"Generic DB2|COM.ibm.db2.jdbc.net.DB2Driver|jdbc:db2://localhost/test|" , "Generic DB2|COM.ibm.db2.jdbc.net.DB2Driver|jdbc:db2://localhost/test|" ,
"Generic Oracle|oracle.jdbc.driver.OracleDriver|jdbc:oracle:thin:@localhost:1521:XE|sa" , "Generic Oracle|oracle.jdbc.driver.OracleDriver|jdbc:oracle:thin:@localhost:1521:XE|sa" ,
"Generic MS SQL Server 2000|com.microsoft.jdbc.sqlserver.SQLServerDriver|jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=sqlexpress|sa", "Generic MS SQL Server 2000|com.microsoft.jdbc.sqlserver.SQLServerDriver|" +
"Generic MS SQL Server 2005|com.microsoft.sqlserver.jdbc.SQLServerDriver|jdbc:sqlserver://localhost;DatabaseName=test|sa", "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=sqlexpress|sa",
"Generic MS SQL Server 2005|com.microsoft.sqlserver.jdbc.SQLServerDriver|" +
"jdbc:sqlserver://localhost;DatabaseName=test|sa",
"Generic PostgreSQL|org.postgresql.Driver|jdbc:postgresql:test|" , "Generic PostgreSQL|org.postgresql.Driver|jdbc:postgresql:test|" ,
"Generic MySQL|com.mysql.jdbc.Driver|jdbc:mysql://localhost:3306/test|" , "Generic MySQL|com.mysql.jdbc.Driver|jdbc:mysql://localhost:3306/test|" ,
"Generic HSQLDB|org.hsqldb.jdbcDriver|jdbc:hsqldb:test;hsqldb.default_table_type=cached|sa" , "Generic HSQLDB|org.hsqldb.jdbcDriver|jdbc:hsqldb:test;hsqldb.default_table_type=cached|sa" ,
......
...@@ -95,12 +95,18 @@ public class LobStorage { ...@@ -95,12 +95,18 @@ public class LobStorage {
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
// stat.execute("SET UNDO_LOG 0"); // stat.execute("SET UNDO_LOG 0");
// stat.execute("SET REDO_LOG_BINARY 0"); // stat.execute("SET REDO_LOG_BINARY 0");
stat.execute("CREATE TABLE IF NOT EXISTS " + LOBS + "(ID BIGINT PRIMARY KEY, BYTE_COUNT BIGINT, TABLE INT) HIDDEN"); stat.execute("CREATE TABLE IF NOT EXISTS " + LOBS +
stat.execute("CREATE INDEX IF NOT EXISTS INFORMATION_SCHEMA.INDEX_LOB_TABLE ON " + LOBS + "(TABLE)"); "(ID BIGINT PRIMARY KEY, BYTE_COUNT BIGINT, TABLE INT) HIDDEN");
stat.execute("CREATE TABLE IF NOT EXISTS " + LOB_MAP + "(LOB BIGINT, SEQ INT, OFFSET BIGINT, HASH INT, BLOCK BIGINT, PRIMARY KEY(LOB, SEQ)) HIDDEN"); stat.execute("CREATE INDEX IF NOT EXISTS " +
stat.execute("ALTER TABLE " + LOB_MAP + " ADD IF NOT EXISTS OFFSET BIGINT BEFORE HASH"); "INFORMATION_SCHEMA.INDEX_LOB_TABLE ON " + LOBS + "(TABLE)");
stat.execute("CREATE INDEX IF NOT EXISTS INFORMATION_SCHEMA.INDEX_LOB_MAP_DATA_LOB ON " + LOB_MAP + "(BLOCK, LOB)"); stat.execute("CREATE TABLE IF NOT EXISTS " + LOB_MAP +
stat.execute("CREATE TABLE IF NOT EXISTS " + LOB_DATA + "(BLOCK BIGINT PRIMARY KEY, COMPRESSED INT, DATA BINARY) HIDDEN"); "(LOB BIGINT, SEQ INT, OFFSET BIGINT, HASH INT, BLOCK BIGINT, PRIMARY KEY(LOB, SEQ)) HIDDEN");
stat.execute("ALTER TABLE " + LOB_MAP +
" ADD IF NOT EXISTS OFFSET BIGINT BEFORE HASH");
stat.execute("CREATE INDEX IF NOT EXISTS " +
"INFORMATION_SCHEMA.INDEX_LOB_MAP_DATA_LOB ON " + LOB_MAP + "(BLOCK, LOB)");
stat.execute("CREATE TABLE IF NOT EXISTS " + LOB_DATA +
"(BLOCK BIGINT PRIMARY KEY, COMPRESSED INT, DATA BINARY) HIDDEN");
ResultSet rs; ResultSet rs;
rs = stat.executeQuery("SELECT MAX(BLOCK) FROM " + LOB_DATA); rs = stat.executeQuery("SELECT MAX(BLOCK) FROM " + LOB_DATA);
rs.next(); rs.next();
......
...@@ -1699,7 +1699,9 @@ public class PageStore implements CacheWriter { ...@@ -1699,7 +1699,9 @@ public class PageStore implements CacheWriter {
int key = index.getId() + 1; int key = index.getId() + 1;
Row row = metaIndex.getRow(session, key); Row row = metaIndex.getRow(session, key);
if (row.getKey() != key) { if (row.getKey() != key) {
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, "key: " + key + " index: " + index + " table: " + index.getTable() + " row: " + row); throw DbException.get(ErrorCode.FILE_CORRUPTED_1,
"key: " + key + " index: " + index +
" table: " + index.getTable() + " row: " + row);
} }
metaIndex.remove(session, row); metaIndex.remove(session, row);
} }
......
...@@ -27,7 +27,8 @@ class FileObjectMemoryData { ...@@ -27,7 +27,8 @@ class FileObjectMemoryData {
private static final byte[] BUFFER = new byte[BLOCK_SIZE * 2]; private static final byte[] BUFFER = new byte[BLOCK_SIZE * 2];
private static final byte[] COMPRESSED_EMPTY_BLOCK; private static final byte[] COMPRESSED_EMPTY_BLOCK;
private static final Cache<CompressItem, CompressItem> COMPRESS_LATER = new Cache<CompressItem, CompressItem>(CACHE_SIZE); private static final Cache<CompressItem, CompressItem> COMPRESS_LATER =
new Cache<CompressItem, CompressItem>(CACHE_SIZE);
private String name; private String name;
private final boolean compress; private final boolean compress;
......
...@@ -75,7 +75,9 @@ public class RangeTable extends Table { ...@@ -75,7 +75,9 @@ public class RangeTable extends Table {
return false; return false;
} }
public Index addIndex(Session session, String indexName, int indexId, IndexColumn[] cols, IndexType indexType, boolean create, String indexComment) { public Index addIndex(Session session, String indexName,
int indexId, IndexColumn[] cols, IndexType indexType,
boolean create, String indexComment) {
throw DbException.getUnsupportedException("SYSTEM_RANGE"); throw DbException.getUnsupportedException("SYSTEM_RANGE");
} }
......
...@@ -89,7 +89,10 @@ public class RegularTable extends TableBase { ...@@ -89,7 +89,10 @@ public class RegularTable extends TableBase {
} }
} }
if (data.persistData && database.isPersistent()) { if (data.persistData && database.isPersistent()) {
mainIndex = new PageDataIndex(this, data.id, IndexColumn.wrap(getColumns()), IndexType.createScan(data.persistData), data.create, data.session); mainIndex = new PageDataIndex(this, data.id,
IndexColumn.wrap(getColumns()),
IndexType.createScan(data.persistData),
data.create, data.session);
scanIndex = mainIndex; scanIndex = mainIndex;
} else { } else {
scanIndex = new ScanIndex(this, data.id, IndexColumn.wrap(getColumns()), IndexType.createScan(data.persistData)); scanIndex = new ScanIndex(this, data.id, IndexColumn.wrap(getColumns()), IndexType.createScan(data.persistData));
...@@ -172,7 +175,9 @@ public class RegularTable extends TableBase { ...@@ -172,7 +175,9 @@ public class RegularTable extends TableBase {
if (!(index instanceof PageDelegateIndex)) { if (!(index instanceof PageDelegateIndex)) {
long rc = index.getRowCount(session); long rc = index.getRowCount(session);
if (rc != rowCount + offset) { if (rc != rowCount + offset) {
DbException.throwInternalError("rowCount expected " + (rowCount + offset) + " got " + rc + " " + getName() + "." + index.getName()); DbException.throwInternalError(
"rowCount expected " + (rowCount + offset) +
" got " + rc + " " + getName() + "." + index.getName());
} }
} }
} }
...@@ -600,7 +605,8 @@ public class RegularTable extends TableBase { ...@@ -600,7 +605,8 @@ public class RegularTable extends TableBase {
private void traceLock(Session session, boolean exclusive, String s) { private void traceLock(Session session, boolean exclusive, String s) {
if (traceLock.isDebugEnabled()) { if (traceLock.isDebugEnabled()) {
traceLock.debug("{0} {1} {2} {3}", session.getId(), exclusive ? "exclusive write lock" : "shared read lock", s, getName()); traceLock.debug("{0} {1} {2} {3}", session.getId(),
exclusive ? "exclusive write lock" : "shared read lock", s, getName());
} }
} }
......
...@@ -40,7 +40,9 @@ public class TableLinkConnection { ...@@ -40,7 +40,9 @@ public class TableLinkConnection {
*/ */
private int useCounter; private int useCounter;
private TableLinkConnection(HashMap<TableLinkConnection, TableLinkConnection> map, String driver, String url, String user, String password) { private TableLinkConnection(
HashMap<TableLinkConnection, TableLinkConnection> map,
String driver, String url, String user, String password) {
this.map = map; this.map = map;
this.driver = driver; this.driver = driver;
this.url = url; this.url = url;
...@@ -60,7 +62,9 @@ public class TableLinkConnection { ...@@ -60,7 +62,9 @@ public class TableLinkConnection {
* @param shareLinkedConnections if connections should be shared * @param shareLinkedConnections if connections should be shared
* @return a connection * @return a connection
*/ */
public static TableLinkConnection open(HashMap<TableLinkConnection, TableLinkConnection> map, String driver, String url, String user, String password, boolean shareLinkedConnections) { public static TableLinkConnection open(
HashMap<TableLinkConnection, TableLinkConnection> map,
String driver, String url, String user, String password, boolean shareLinkedConnections) {
TableLinkConnection t = new TableLinkConnection(map, driver, url, user, password); TableLinkConnection t = new TableLinkConnection(map, driver, url, user, password);
if (!shareLinkedConnections) { if (!shareLinkedConnections) {
t.open(); t.open();
......
...@@ -83,7 +83,8 @@ public class TableView extends Table { ...@@ -83,7 +83,8 @@ public class TableView extends Table {
} }
} }
private void init(String querySQL, ArrayList<Parameter> params, String[] columnNames, Session session, boolean recursive) { private void init(String querySQL, ArrayList<Parameter> params,
String[] columnNames, Session session, boolean recursive) {
this.querySQL = querySQL; this.querySQL = querySQL;
this.columnNames = columnNames; this.columnNames = columnNames;
this.recursive = recursive; this.recursive = recursive;
......
...@@ -121,7 +121,8 @@ public class ChangeFileEncryption extends Tool { ...@@ -121,7 +121,8 @@ public class ChangeFileEncryption extends Tool {
* @param quiet don't print progress information * @param quiet don't print progress information
* @throws SQLException * @throws SQLException
*/ */
public static void execute(String dir, String db, String cipher, char[] decryptPassword, char[] encryptPassword, boolean quiet) throws SQLException { public static void execute(String dir, String db, String cipher,
char[] decryptPassword, char[] encryptPassword, boolean quiet) throws SQLException {
try { try {
new ChangeFileEncryption().process(dir, db, cipher, decryptPassword, encryptPassword, quiet); new ChangeFileEncryption().process(dir, db, cipher, decryptPassword, encryptPassword, quiet);
} catch (Exception e) { } catch (Exception e) {
...@@ -129,7 +130,8 @@ public class ChangeFileEncryption extends Tool { ...@@ -129,7 +130,8 @@ public class ChangeFileEncryption extends Tool {
} }
} }
private void process(String dir, String db, String cipher, char[] decryptPassword, char[] encryptPassword, boolean quiet) throws SQLException { private void process(String dir, String db, String cipher,
char[] decryptPassword, char[] encryptPassword, boolean quiet) throws SQLException {
dir = FileLister.getDir(dir); dir = FileLister.getDir(dir);
ChangeFileEncryption change = new ChangeFileEncryption(); ChangeFileEncryption change = new ChangeFileEncryption();
if (encryptPassword != null) { if (encryptPassword != null) {
......
...@@ -110,9 +110,12 @@ public class ConvertTraceFile extends Tool { ...@@ -110,9 +110,12 @@ public class ConvertTraceFile extends Tool {
* @throws IOException * @throws IOException
*/ */
private void convertFile(String traceFileName, String javaClassName, String script) throws IOException { private void convertFile(String traceFileName, String javaClassName, String script) throws IOException {
LineNumberReader reader = new LineNumberReader(IOUtils.getBufferedReader(IOUtils.openFileInputStream(traceFileName))); LineNumberReader reader = new LineNumberReader(IOUtils.getBufferedReader(
PrintWriter javaWriter = new PrintWriter(IOUtils.getBufferedWriter(IOUtils.openFileOutputStream(javaClassName + ".java", false))); IOUtils.openFileInputStream(traceFileName)));
PrintWriter scriptWriter = new PrintWriter(IOUtils.getBufferedWriter(IOUtils.openFileOutputStream(script, false))); PrintWriter javaWriter = new PrintWriter(IOUtils.getBufferedWriter(
IOUtils.openFileOutputStream(javaClassName + ".java", false)));
PrintWriter scriptWriter = new PrintWriter(IOUtils.getBufferedWriter(
IOUtils.openFileOutputStream(script, false)));
javaWriter.println("import java.io.*;"); javaWriter.println("import java.io.*;");
javaWriter.println("import java.sql.*;"); javaWriter.println("import java.sql.*;");
javaWriter.println("import java.math.*;"); javaWriter.println("import java.math.*;");
......
...@@ -91,11 +91,13 @@ public class CreateCluster extends Tool { ...@@ -91,11 +91,13 @@ public class CreateCluster extends Tool {
* @param serverList the server list * @param serverList the server list
* @throws SQLException * @throws SQLException
*/ */
public void execute(String urlSource, String urlTarget, String user, String password, String serverList) throws SQLException { public void execute(String urlSource, String urlTarget,
String user, String password, String serverList) throws SQLException {
process(urlSource, urlTarget, user, password, serverList); process(urlSource, urlTarget, user, password, serverList);
} }
private void process(String urlSource, String urlTarget, String user, String password, String serverList) throws SQLException { private void process(String urlSource, String urlTarget,
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;
String scriptFile = "backup.sql"; String scriptFile = "backup.sql";
...@@ -106,7 +108,9 @@ public class CreateCluster extends Tool { ...@@ -106,7 +108,9 @@ public class CreateCluster extends Tool {
// or if it exists (an old cluster instance), it is deleted // or if it exists (an old cluster instance), it is deleted
boolean exists = true; boolean exists = true;
try { try {
connTarget = DriverManager.getConnection(urlTarget + ";IFEXISTS=TRUE;CLUSTER=" + Constants.CLUSTERING_ENABLED, user, password); connTarget = DriverManager.getConnection(urlTarget +
";IFEXISTS=TRUE;CLUSTER=" + Constants.CLUSTERING_ENABLED,
user, password);
Statement stat = connTarget.createStatement(); Statement stat = connTarget.createStatement();
stat.execute("DROP ALL OBJECTS DELETE FILES"); stat.execute("DROP ALL OBJECTS DELETE FILES");
stat.close(); stat.close();
......
...@@ -575,7 +575,8 @@ public class Recover extends Tool implements DataHandler { ...@@ -575,7 +575,8 @@ public class Recover extends Tool implements DataHandler {
} }
} }
private void dumpPageLogStream(PrintWriter writer, int logKey, int logFirstTrunkPage, int logFirstDataPage) throws IOException { private void dumpPageLogStream(PrintWriter writer, int logKey,
int logFirstTrunkPage, int logFirstDataPage) throws IOException {
Data s = Data.create(this, pageSize); Data s = Data.create(this, pageSize);
DataReader in = new DataReader( DataReader in = new DataReader(
new PageInputStream(writer, this, store, logKey, logFirstTrunkPage, logFirstDataPage, pageSize) new PageInputStream(writer, this, store, logKey, logFirstTrunkPage, logFirstDataPage, pageSize)
......
...@@ -172,7 +172,8 @@ public class RunScript extends Tool { ...@@ -172,7 +172,8 @@ public class RunScript extends Tool {
return rs; return rs;
} }
private void process(Connection conn, String fileName, boolean continueOnError, String charsetName) throws SQLException, IOException { private void process(Connection conn, String fileName,
boolean continueOnError, String charsetName) throws SQLException, IOException {
InputStream in = IOUtils.openFileInputStream(fileName); InputStream in = IOUtils.openFileInputStream(fileName);
String path = IOUtils.getParent(fileName); String path = IOUtils.getParent(fileName);
try { try {
...@@ -184,7 +185,8 @@ public class RunScript extends Tool { ...@@ -184,7 +185,8 @@ public class RunScript extends Tool {
} }
} }
private void process(Connection conn, boolean continueOnError, String path, Reader reader, String charsetName) throws SQLException, IOException { private void process(Connection conn, boolean continueOnError,
String path, Reader reader, String charsetName) throws SQLException, IOException {
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
ScriptReader r = new ScriptReader(reader); ScriptReader r = new ScriptReader(reader);
while (true) { while (true) {
...@@ -256,7 +258,8 @@ public class RunScript extends Tool { ...@@ -256,7 +258,8 @@ public class RunScript extends Tool {
} }
} }
private static void processRunscript(String url, String user, String password, String fileName, String options) throws SQLException { private static void processRunscript(String url, String user, String password,
String fileName, String options) throws SQLException {
Connection conn = null; Connection conn = null;
Statement stat = null; Statement stat = null;
try { try {
...@@ -281,7 +284,8 @@ public class RunScript extends Tool { ...@@ -281,7 +284,8 @@ public class RunScript extends Tool {
* @param charsetName the character set name or null for UTF-8 * @param charsetName the character set name or null for UTF-8
* @param continueOnError if execution should be continued if an error occurs * @param continueOnError if execution should be continued if an error occurs
*/ */
public static void execute(String url, String user, String password, String fileName, String charsetName, boolean continueOnError) throws SQLException { public static void execute(String url, String user, String password,
String fileName, String charsetName, boolean continueOnError) throws SQLException {
new RunScript().process(url, user, password, fileName, charsetName, continueOnError); new RunScript().process(url, user, password, fileName, charsetName, continueOnError);
} }
...@@ -295,7 +299,9 @@ public class RunScript extends Tool { ...@@ -295,7 +299,9 @@ public class RunScript extends Tool {
* @param charsetName the character set name or null for UTF-8 * @param charsetName the character set name or null for UTF-8
* @param continueOnError if execution should be continued if an error occurs * @param continueOnError if execution should be continued if an error occurs
*/ */
void process(String url, String user, String password, String fileName, String charsetName, boolean continueOnError) throws SQLException { void process(String url, String user, String password,
String fileName, String charsetName,
boolean continueOnError) throws SQLException {
try { try {
org.h2.Driver.load(); org.h2.Driver.load();
Connection conn = DriverManager.getConnection(url, user, password); Connection conn = DriverManager.getConnection(url, user, password);
......
...@@ -101,7 +101,8 @@ public class Script extends Tool { ...@@ -101,7 +101,8 @@ public class Script extends Tool {
} }
} }
private static void processScript(String url, String user, String password, String fileName, String options1, String options2) throws SQLException { private static void processScript(String url, String user, String password,
String fileName, String options1, String options2) throws SQLException {
Connection conn = null; Connection conn = null;
Statement stat = null; Statement stat = null;
try { try {
......
...@@ -356,7 +356,9 @@ public class DateTimeUtils { ...@@ -356,7 +356,9 @@ public class DateTimeUtils {
} }
} }
private static long getTime(boolean lenient, TimeZone tz, int year, int month, int day, int hour, int minute, int second, boolean setMillis, int nano) { private static long getTime(boolean lenient, TimeZone tz,
int year, int month, int day, int hour, int minute, int second,
boolean setMillis, int nano) {
Calendar c; Calendar c;
if (tz == null) { if (tz == null) {
c = getCalendar(); c = getCalendar();
......
...@@ -481,7 +481,9 @@ public class IOUtils { ...@@ -481,7 +481,9 @@ public class IOUtils {
if (directory.isDirectory()) { if (directory.isDirectory()) {
return; return;
} }
throw new IOException("Could not create directory, because a file with the same name already exists: " + directory.getAbsolutePath()); throw new IOException("Could not create directory, " +
"because a file with the same name already exists: " +
directory.getAbsolutePath());
} }
if (directory.mkdirs()) { if (directory.mkdirs()) {
return; return;
......
...@@ -515,11 +515,17 @@ public class Utils { ...@@ -515,11 +515,17 @@ public class Utils {
* @param params the method parameters * @param params the method parameters
* @return the return value from this call * @return the return value from this call
*/ */
public static Object callMethod(Object instance, String methodName, Object... params) throws Exception { public static Object callMethod(
Object instance,
String methodName,
Object... params) throws Exception {
return classMethodInternal(methodName, instance.getClass(), instance, params); return classMethodInternal(methodName, instance.getClass(), instance, params);
} }
private static Object classMethodInternal(String methodName, Class<?> clazz, Object instance, Object... params) throws Exception { private static Object classMethodInternal(
String methodName, Class<?> clazz,
Object instance,
Object... params) throws Exception {
Method best = null; Method best = null;
int bestMatch = 0; int bestMatch = 0;
boolean isStatic = instance == null; boolean isStatic = instance == null;
......
...@@ -241,44 +241,52 @@ public class DataType { ...@@ -241,44 +241,52 @@ public class DataType {
20 20
); );
add(Value.INT, Types.INTEGER, "Int", add(Value.INT, Types.INTEGER, "Int",
createDecimal(ValueInt.PRECISION, ValueInt.PRECISION, 0, ValueInt.DISPLAY_SIZE, false, false), createDecimal(ValueInt.PRECISION, ValueInt.PRECISION, 0,
ValueInt.DISPLAY_SIZE, false, false),
new String[]{"INTEGER", "INT", "MEDIUMINT", "INT4", "SIGNED"}, new String[]{"INTEGER", "INT", "MEDIUMINT", "INT4", "SIGNED"},
// in many cases the value is in the cache // in many cases the value is in the cache
20 20
); );
add(Value.LONG, Types.BIGINT, "Long", add(Value.LONG, Types.BIGINT, "Long",
createDecimal(ValueLong.PRECISION, ValueLong.PRECISION, 0, ValueLong.DISPLAY_SIZE, false, false), createDecimal(ValueLong.PRECISION, ValueLong.PRECISION, 0,
ValueLong.DISPLAY_SIZE, false, false),
new String[]{"BIGINT", "INT8", "LONG"}, new String[]{"BIGINT", "INT8", "LONG"},
24 24
); );
add(Value.LONG, Types.BIGINT, "Long", add(Value.LONG, Types.BIGINT, "Long",
createDecimal(ValueLong.PRECISION, ValueLong.PRECISION, 0, ValueLong.DISPLAY_SIZE, false, true), createDecimal(ValueLong.PRECISION, ValueLong.PRECISION, 0,
ValueLong.DISPLAY_SIZE, false, true),
new String[]{"IDENTITY", "SERIAL"}, new String[]{"IDENTITY", "SERIAL"},
24 24
); );
add(Value.DECIMAL, Types.DECIMAL, "BigDecimal", add(Value.DECIMAL, Types.DECIMAL, "BigDecimal",
createDecimal(Integer.MAX_VALUE, ValueDecimal.DEFAULT_PRECISION, ValueDecimal.DEFAULT_SCALE, ValueDecimal.DEFAULT_DISPLAY_SIZE, true, false), createDecimal(Integer.MAX_VALUE, ValueDecimal.DEFAULT_PRECISION,
ValueDecimal.DEFAULT_SCALE, ValueDecimal.DEFAULT_DISPLAY_SIZE, true, false),
new String[]{"DECIMAL", "DEC"}, new String[]{"DECIMAL", "DEC"},
// 40 for ValueDecimal, // 40 for ValueDecimal,
64 64
); );
add(Value.DECIMAL, Types.NUMERIC, "BigDecimal", add(Value.DECIMAL, Types.NUMERIC, "BigDecimal",
createDecimal(Integer.MAX_VALUE, ValueDecimal.DEFAULT_PRECISION, ValueDecimal.DEFAULT_SCALE, ValueDecimal.DEFAULT_DISPLAY_SIZE, true, false), createDecimal(Integer.MAX_VALUE, ValueDecimal.DEFAULT_PRECISION,
ValueDecimal.DEFAULT_SCALE, ValueDecimal.DEFAULT_DISPLAY_SIZE, true, false),
new String[]{"NUMERIC", "NUMBER"}, new String[]{"NUMERIC", "NUMBER"},
64 64
); );
add(Value.FLOAT, Types.REAL, "Float", add(Value.FLOAT, Types.REAL, "Float",
createDecimal(ValueFloat.PRECISION, ValueFloat.PRECISION, 0, ValueFloat.DISPLAY_SIZE, false, false), createDecimal(ValueFloat.PRECISION, ValueFloat.PRECISION,
0, ValueFloat.DISPLAY_SIZE, false, false),
new String[] {"REAL", "FLOAT4"}, new String[] {"REAL", "FLOAT4"},
24 24
); );
add(Value.DOUBLE, Types.DOUBLE, "Double", add(Value.DOUBLE, Types.DOUBLE, "Double",
createDecimal(ValueDouble.PRECISION, ValueDouble.PRECISION, 0, ValueDouble.DISPLAY_SIZE, false, false), createDecimal(ValueDouble.PRECISION, ValueDouble.PRECISION,
0, ValueDouble.DISPLAY_SIZE, false, false),
new String[] { "DOUBLE", "DOUBLE PRECISION" }, new String[] { "DOUBLE", "DOUBLE PRECISION" },
24 24
); );
add(Value.DOUBLE, Types.FLOAT, "Double", add(Value.DOUBLE, Types.FLOAT, "Double",
createDecimal(ValueDouble.PRECISION, ValueDouble.PRECISION, 0, ValueDouble.DISPLAY_SIZE, false, false), createDecimal(ValueDouble.PRECISION, ValueDouble.PRECISION,
0, ValueDouble.DISPLAY_SIZE, false, false),
new String[] {"FLOAT", "FLOAT8" }, new String[] {"FLOAT", "FLOAT8" },
24 24
); );
...@@ -396,7 +404,9 @@ public class DataType { ...@@ -396,7 +404,9 @@ public class DataType {
} }
} }
private static DataType createDecimal(int maxPrecision, int defaultPrecision, int defaultScale, int defaultDisplaySize, boolean needsPrecisionAndScale, boolean autoInc) { private static DataType createDecimal(int maxPrecision,
int defaultPrecision, int defaultScale, int defaultDisplaySize,
boolean needsPrecisionAndScale, boolean autoInc) {
DataType dataType = new DataType(); DataType dataType = new DataType();
dataType.maxPrecision = maxPrecision; dataType.maxPrecision = maxPrecision;
dataType.defaultPrecision = defaultPrecision; dataType.defaultPrecision = defaultPrecision;
......
...@@ -789,9 +789,15 @@ public abstract class Value { ...@@ -789,9 +789,15 @@ public abstract class Value {
case NULL: case NULL:
return ValueNull.INSTANCE; return ValueNull.INSTANCE;
case BOOLEAN: { case BOOLEAN: {
if (s.equalsIgnoreCase("true") || s.equalsIgnoreCase("t") || s.equalsIgnoreCase("yes") || s.equalsIgnoreCase("y")) { if (s.equalsIgnoreCase("true") ||
s.equalsIgnoreCase("t") ||
s.equalsIgnoreCase("yes") ||
s.equalsIgnoreCase("y")) {
return ValueBoolean.get(true); return ValueBoolean.get(true);
} else if (s.equalsIgnoreCase("false") || s.equalsIgnoreCase("f") || s.equalsIgnoreCase("no") || s.equalsIgnoreCase("n")) { } else if (s.equalsIgnoreCase("false") ||
s.equalsIgnoreCase("f") ||
s.equalsIgnoreCase("no") ||
s.equalsIgnoreCase("n")) {
return ValueBoolean.get(false); return ValueBoolean.get(false);
} else { } else {
// convert to a number, and if it is not 0 then it is true // convert to a number, and if it is not 0 then it is true
......
...@@ -87,7 +87,8 @@ public class ValueLob extends Value { ...@@ -87,7 +87,8 @@ public class ValueLob extends Value {
} }
private static ValueLob copy(ValueLob lob) { private static ValueLob copy(ValueLob lob) {
ValueLob copy = new ValueLob(lob.type, lob.handler, lob.fileName, lob.tableId, lob.objectId, lob.linked, lob.precision, lob.compression); ValueLob copy = new ValueLob(lob.type, lob.handler, lob.fileName,
lob.tableId, lob.objectId, lob.linked, lob.precision, lob.compression);
copy.small = lob.small; copy.small = lob.small;
copy.hash = lob.hash; copy.hash = lob.hash;
return copy; return copy;
...@@ -123,7 +124,8 @@ public class ValueLob extends Value { ...@@ -123,7 +124,8 @@ public class ValueLob extends Value {
* @param compression if compression is used * @param compression if compression is used
* @return the value object * @return the value object
*/ */
public static ValueLob open(int type, DataHandler handler, int tableId, int objectId, long precision, boolean compression) { public static ValueLob open(int type, DataHandler handler,
int tableId, int objectId, long precision, boolean compression) {
String fileName = getFileName(handler, tableId, objectId); String fileName = getFileName(handler, tableId, objectId);
return new ValueLob(type, handler, fileName, tableId, objectId, true, precision, compression); return new ValueLob(type, handler, fileName, tableId, objectId, true, precision, compression);
} }
......
...@@ -71,7 +71,8 @@ public class ValueLobDb extends Value implements Value.ValueClob, Value.ValueBlo ...@@ -71,7 +71,8 @@ public class ValueLobDb extends Value implements Value.ValueClob, Value.ValueBlo
* @param precision the precision (number of bytes / characters) * @param precision the precision (number of bytes / characters)
* @return the value * @return the value
*/ */
public static ValueLobDb create(int type, LobStorage lobStorage, String fileName, int tableId, long id, long precision) { public static ValueLobDb create(int type, LobStorage lobStorage,
String fileName, int tableId, long id, long precision) {
return new ValueLobDb(type, lobStorage, fileName, tableId, id, precision); return new ValueLobDb(type, lobStorage, fileName, tableId, id, precision);
} }
......
...@@ -29,9 +29,12 @@ public class FileFunctions { ...@@ -29,9 +29,12 @@ public class FileFunctions {
Class.forName("org.h2.Driver"); Class.forName("org.h2.Driver");
Connection conn = DriverManager.getConnection("jdbc:h2:mem:", "sa", ""); Connection conn = DriverManager.getConnection("jdbc:h2:mem:", "sa", "");
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
stat.execute("CREATE ALIAS READ_TEXT_FILE FOR \"org.h2.samples.FileFunctions.readTextFile\" "); stat.execute("CREATE ALIAS READ_TEXT_FILE " +
stat.execute("CREATE ALIAS READ_TEXT_FILE_WITH_ENCODING FOR \"org.h2.samples.FileFunctions.readTextFileWithEncoding\" "); "FOR \"org.h2.samples.FileFunctions.readTextFile\" ");
stat.execute("CREATE ALIAS READ_FILE FOR \"org.h2.samples.FileFunctions.readFile\" "); stat.execute("CREATE ALIAS READ_TEXT_FILE_WITH_ENCODING " +
"FOR \"org.h2.samples.FileFunctions.readTextFileWithEncoding\" ");
stat.execute("CREATE ALIAS READ_FILE " +
"FOR \"org.h2.samples.FileFunctions.readFile\" ");
ResultSet rs = stat.executeQuery("CALL READ_FILE('test.txt')"); ResultSet rs = stat.executeQuery("CALL READ_FILE('test.txt')");
rs.next(); rs.next();
byte[] data = rs.getBytes(1); byte[] data = rs.getBytes(1);
......
...@@ -749,7 +749,8 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1` ...@@ -749,7 +749,8 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
*/ */
public static void printSystemInfo() { public static void printSystemInfo() {
Properties prop = System.getProperties(); Properties prop = System.getProperties();
System.out.println("H2 " + Constants.getFullVersion() + " @ " + new java.sql.Timestamp(System.currentTimeMillis()).toString()); System.out.println("H2 " + Constants.getFullVersion() +
" @ " + new java.sql.Timestamp(System.currentTimeMillis()).toString());
System.out.println("Java " + System.out.println("Java " +
prop.getProperty("java.runtime.version") + ", " + prop.getProperty("java.runtime.version") + ", " +
prop.getProperty("java.vm.name")+", " + prop.getProperty("java.vm.name")+", " +
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论