提交 814fb93c authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 73c1cc8c
<!--
Copyright 2004-2008 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
Initial Developer: H2 Group
-->
<html><script>
<!--
var line = 0, file = '';
var params = location.search.substring(1).split('&');
var build = 'trunk';
for (var i = 0; i<params.length; i++) {
var k = params[i].split('=');
var key = k[0], value = k[1];
if (key == 'line') {
line = value;
} else if (key == 'file') {
file = value;
} else if (key == 'build') {
build = 'tags/version-1.0.' + value;
}
}
-->
</script>
<pre>
<table width="100%">
<tr>
<td style="width: 50px">
<script>
<!--
for(var i = 1; i <= 5000; i++) {
if (line == i) {
document.write('<b>' + i + ' ></b><br />');
} else if (line <= 4 || i + 4 == line) {
document.write(i + '<a name="here"></a><br />');
} else {
document.write(i + '<br />');
}
}
-->
</script>
</td>
<td width="92%" style="vertical-align: top;">
<iframe id="source" frameborder="0" marginwidth="0" marginheight="0" width="100%" height="80000px" scrolling="no" src="">
</iframe>
</td>
</tr>
</table>
<a href="#here"></a>
<script>
<!--
var source = document.getElementById('source');
source.src = 'http://h2database.googlecode.com/svn/' + build + '/h2/src/main/' + file;
document.location = '#here';
-->
</script>
</pre></html>
......@@ -48,7 +48,7 @@ public class AlterTableAddConstraint extends SchemaCommand {
private Index index, refIndex;
private String comment;
private boolean checkExisting;
private boolean primaryKeyKash;
private boolean primaryKeyHash;
public AlterTableAddConstraint(Session session, Schema schema) {
super(session, schema);
......@@ -104,7 +104,7 @@ public class AlterTableAddConstraint extends SchemaCommand {
}
}
if (index == null) {
IndexType indexType = IndexType.createPrimaryKey(table.isPersistent(), primaryKeyKash);
IndexType indexType = IndexType.createPrimaryKey(table.isPersistent(), primaryKeyHash);
String indexName = getSchema().getUniqueIndexName(table, Constants.PREFIX_PRIMARY_KEY);
int id = getObjectId(true, false);
try {
......@@ -385,11 +385,11 @@ public class AlterTableAddConstraint extends SchemaCommand {
}
public void setPrimaryKeyHash(boolean b) {
this.primaryKeyKash = b;
this.primaryKeyHash = b;
}
public boolean getPrimaryKeyHash() {
return primaryKeyKash;
return primaryKeyHash;
}
}
......@@ -356,7 +356,7 @@ public class ErrorCode {
* INSERT INTO TEST VALUES(1, 'Hello');
* </pre>
*/
public static final int VALUE_TOO_LONG_1 = 90005;
public static final int VALUE_TOO_LONG_2 = 90005;
/**
* The error with code <code>90006</code> is thrown when
......
......@@ -25,7 +25,7 @@
90002=Methode nur zul\u00E4ssig for eine Abfrage. Erlaubt sind execute oder executeUpdate, nicht jedoch executeQuery
90003=Hexadezimal Zahl mit einer ungeraden Anzahl Zeichen\: {0}
90004=Hexadezimal Zahl enth\u00E4lt unerlaubtes Zeichen\: {0}
90005=Wert zu gross / lang f\u00FCr Feld {0}
90005=Wert zu gross / lang f\u00FCr Feld {0}\: {1}
90006=NULL nicht zul\u00E4ssig f\u00FCr Feld {0}
90007=Das Objekt wurde bereits geschlossen
90008=Unerlaubter Wert {0} f\u00FCr Parameter {1}
......
......@@ -25,7 +25,7 @@
90002=Method is only allowed for a query. Use execute or executeUpdate instead of executeQuery
90003=Hexadecimal string with odd number of characters\: {0}
90004=Hexadecimal string contains non-hex character\: {0}
90005=Value too long for column {0}
90005=Value too long for column {0}\: {1}
90006=NULL not allowed for column {0}
90007=The object is already closed
90008=Invalid value {0} for parameter {1}
......
......@@ -25,7 +25,7 @@
90002=\u30E1\u30BD\u30C3\u30C9\u306F\u30AF\u30A8\u30EA\u3057\u304B\u30B5\u30DD\u30FC\u30C8\u3057\u3066\u3044\u307E\u305B\u3093\u3002executeQuery\u306E\u304B\u308F\u308A\u306B\u3001excecute\u3001\u307E\u305F\u306FexecuteUpdate\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044
90003=\u6587\u5B57\u6570\u304C\u5947\u6570\u306E16\u9032\u6587\u5B57\u5217\u3067\u3059\: {0}
90004=16\u9032\u6587\u5B57\u5217\u306B\u4E0D\u6B63\u306A\u6587\u5B57\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\: {0}
90005=\u5217 {0} \u306E\u5024\u304C\u9577\u904E\u304E\u307E\u3059
90005=\u5217 {0} \u306E\u5024\u304C\u9577\u904E\u304E\u307E\u3059\: {1}
90006=\u5217 {0} \u306B\u306Fnull\u5024\u304C\u8A31\u3055\u308C\u3066\u3044\u307E\u305B\u3093
90007=\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306F\u3059\u3067\u306B\u9589\u3058\u3089\u308C\u3066\u3044\u307E\u3059
90008=\u30D1\u30E9\u30E1\u30FC\u30BF {1} \u306B\u5BFE\u3059\u308B\u5024 {0} \u304C\u4E0D\u6B63\u3067\u3059
......
......@@ -25,7 +25,7 @@
90002=Metoda jest dozwolona tylko w kwerendzie
90003=Hexadecimal string with odd number of characters\: {0}
90004=Hexadecimal string contains non hex character\: {0}
90005=Wartosc za dluga dla kolumny {0}
90005=Wartosc za dluga dla kolumny {0}\: {1}
90006=Pole nie moze byc puste {0}
90007=Objekt jest zamkniety
90008=Nieprawidlowa wartosc {0} parametru {1}
......
......@@ -25,7 +25,7 @@
90002=O m\u00E9todo \u00E9 apenas para consulta. Use o execute ou o executeUpdate em vez de executeQuery
90003=Sequ\u00EAncia Hexadecimal com n\u00FAmero \u00EDmpar de caracteres\: {0}
90004=Sequ\u00EAncia Hexadecimal cont\u00EAm caracteres inv\u00E1lidos\: {0}
90005=Valor muito longo para a coluna {0}
90005=Valor muito longo para a coluna {0}\: {1}
90006=NULL n\u00E3o \u00E9 permitido para a coluna {0}
90007=O objeto est\u00E1 fechado
90008=Valor inv\u00E1lido {0} para o par\u00E2metro {1}
......
......@@ -378,7 +378,7 @@ CREATE DOMAIN EMAIL AS VARCHAR(255) CHECK (POSITION('@', VALUE) > 1)
"Commands (DDL)","CREATE INDEX","
CREATE {[UNIQUE [HASH]] INDEX [[IF NOT EXISTS] newIndexName]
| PRIMARY KEY [HASH]} ON (columnName [,...])
| PRIMARY KEY [HASH]} ON tableName(columnName [,...])
","
Creates a new index.
","
......
......@@ -224,7 +224,7 @@ public class Column {
value = value.convertScale(mode.convertOnlyToSmallerScale, scale);
if (precision > 0) {
if (!value.checkPrecision(precision)) {
throw Message.getSQLException(ErrorCode.VALUE_TOO_LONG_1, name);
throw Message.getSQLException(ErrorCode.VALUE_TOO_LONG_2, new String[]{name, value.getSQL()});
}
}
updateSequenceIfRequired(session, value);
......
......@@ -273,7 +273,14 @@ ShutdownHandler {
frame.setSize(width, height);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
frame.setLocation((screenSize.width - width) / 2, (screenSize.height - height) / 2);
try {
frame.setVisible(true);
} catch (Throwable t) {
// some systems don't support this method, for example IKVM
// however it still works
// ignore
System.out.println("URL: " + web.getURL());
}
}
private void startBrowser() {
......
......@@ -5,6 +5,7 @@
package org.h2.value;
import org.h2.constant.SysProperties;
import org.h2.util.MathUtils;
import org.h2.util.StringCache;
/**
......@@ -56,6 +57,14 @@ public class ValueString extends ValueStringBase {
}
public Value convertPrecision(long precision) {
if (precision == 0 || value.length() <= precision) {
return this;
}
int p = MathUtils.convertLongToInt(precision);
return ValueString.get(value.substring(0, p));
}
public static ValueString get(String s) {
if (s.length() == 0) {
return EMPTY;
......
......@@ -7,7 +7,6 @@ package org.h2.value;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import org.h2.util.MathUtils;
import org.h2.util.StringUtils;
/**
......@@ -44,22 +43,16 @@ abstract class ValueStringBase extends Value {
prep.setString(parameterIndex, value);
}
public Value convertPrecision(long precision) {
if (precision == 0 || value.length() <= precision) {
return this;
}
int p = MathUtils.convertLongToInt(precision);
return ValueString.get(value.substring(0, p));
}
public int getDisplaySize() {
return value.length();
}
protected boolean isEqual(Value v) {
return v instanceof ValueString && value.equals(((ValueString) v).value);
return v instanceof ValueStringBase && value.equals(((ValueStringBase) v).value);
}
public abstract Value convertPrecision(long precision);
public int getMemory() {
return value.length() * 2 + 30;
}
......
......@@ -7,6 +7,7 @@ package org.h2.value;
import java.sql.SQLException;
import org.h2.constant.SysProperties;
import org.h2.util.MathUtils;
import org.h2.util.StringCache;
/**
......@@ -36,10 +37,6 @@ public class ValueStringFixed extends ValueStringBase {
return s;
}
protected boolean isEqual(Value v) {
return v instanceof ValueStringBase && value.equalsIgnoreCase(((ValueStringBase) v).value);
}
public int hashCode() {
// TODO hash performance: could build a quicker hash by hashing the size and a few characters
return value.hashCode();
......@@ -61,4 +58,12 @@ public class ValueStringFixed extends ValueStringBase {
return (ValueStringFixed) Value.cache(obj);
}
public Value convertPrecision(long precision) {
if (precision == 0 || value.length() <= precision) {
return this;
}
int p = MathUtils.convertLongToInt(precision);
return ValueStringFixed.get(value.substring(0, p));
}
}
......@@ -5,6 +5,7 @@
package org.h2.value;
import org.h2.constant.SysProperties;
import org.h2.util.MathUtils;
import org.h2.util.StringCache;
import org.h2.util.StringUtils;
......@@ -62,4 +63,12 @@ public class ValueStringIgnoreCase extends ValueStringBase {
}
}
public Value convertPrecision(long precision) {
if (precision == 0 || value.length() <= precision) {
return this;
}
int p = MathUtils.convertLongToInt(precision);
return ValueStringIgnoreCase.get(value.substring(0, p));
}
}
......@@ -153,20 +153,7 @@ java org.h2.test.TestAll timer
implement max_query_time and use it for TestCrashAPI
Value too long for column DESC. But which value?
org.h2.jdbc.JdbcSQLException: Value too long for column DESC
[90005-64]
at org.h2.message.Message.getSQLException(Message.java:89)
at org.h2.message.Message.getSQLException(Message.java:93)
at org.h2.message.Message.getSQLException(Message.java:71)
at org.h2.table.Column.validateConvertUpdateSequence(Column.java:226)
at org.h2.table.Table.validateConvertUpdateSequence(Table.java:331)
at org.h2.command.dml.Insert.update(Insert.java:111)
at org.h2.command.CommandContainer.update(CommandContainer.java:68)
CREATE {[UNIQUE [HASH]] INDEX [[IF NOT EXISTS] newIndexName]
| PRIMARY KEY [HASH]} ON (columnName [,...])
There is missing name of table
document IKVM
adjust cache memory usage
......@@ -189,8 +176,10 @@ Move Maven 2 repository from hsql.sf.net to h2database.sf.net
History:
Primary keys are now considered constraints and can have a constraint name.
H2 Console: stack traces are now links to the source code in the source repository (H2 database only)
H2 Console: stack traces are now links to the source code in the source repository (H2 database only).
CHAR data type equals comparison was case insensitive instead of case sensitive.
The exception 'Value too long for column' now includes the data.
The table name was missing in the documentation of CREATE INDEX.
Test Recovery with MAX_LOG_FILE_SIZE=1; test with various log file sizes
......
--- special grammar and test cases ---------------------------------------------------------------------------------------------
CREATE TABLE TEST(ID INT PRIMARY KEY, LABEL CHAR(20), LOOKUP CHAR(30));
> ok
INSERT INTO TEST VALUES (1, 'Mouse', 'MOUSE'), (2, 'MOUSE', 'Mouse');
> update count: 2
SELECT * FROM TEST;
> ID LABEL LOOKUP
> -- ----- ------
> 1 Mouse MOUSE
> 2 MOUSE Mouse
> rows: 2
DROP TABLE TEST;
> ok
call 'a' regexp '\Ho.*';
> exception
......
/*
* Copyright 2004-2008 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package org.h2.test.unit;
import java.io.ByteArrayInputStream;
......@@ -33,6 +37,10 @@ import org.h2.value.ValueTime;
import org.h2.value.ValueTimestamp;
import org.h2.value.ValueUuid;
/**
* Tests the memory consumption of values. Values can estimate how much memory they occupy,
* and this tests if this estimation is correct.
*/
public class TestValueMemory extends TestBase implements DataHandler {
private Random random = new Random(1);
......
......@@ -523,4 +523,4 @@ thousands ridvan incremented slots debugging inherit agar fulvio invisible biond
turkish fulfils iapi filesync
compares packets destroying echo homed hosts clock countries validated catches turning staging kills distance morning performs internationalization simulator constructed nicer
echo callablestatement procid homed getstart staging prices meantime qujd qujdra qui divided quaere restrictions hudson scoped design inverting newlines
violate verysmallint eremainder iee
violate verysmallint eremainder iee cgi adjust estimation consumption occupy ikvm
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论