提交 2dd76e97 authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 003d1ab8
...@@ -323,7 +323,6 @@ Roadmap ...@@ -323,7 +323,6 @@ Roadmap
</li><li>Translated .pdf </li><li>Translated .pdf
</li><li>Cluster: hot deploy (adding a node on runtime) </li><li>Cluster: hot deploy (adding a node on runtime)
</li><li>Test with PostgreSQL Version 8.2 </li><li>Test with PostgreSQL Version 8.2
</li><li>Submit again to http://www.docjar.com/
</li><li>Website: Don't use frames. </li><li>Website: Don't use frames.
</li><li>Try again with Lobo browser (pure Java) </li><li>Try again with Lobo browser (pure Java)
</li><li>Recovery tool: bad blocks should be converted to INSERT INTO SYSTEM_ERRORS(...), and things should go into the .trace.db file </li><li>Recovery tool: bad blocks should be converted to INSERT INTO SYSTEM_ERRORS(...), and things should go into the .trace.db file
...@@ -356,6 +355,9 @@ Roadmap ...@@ -356,6 +355,9 @@ Roadmap
</li><li>Support flashback queries as in Oracle. </li><li>Support flashback queries as in Oracle.
</li><li>Import / Export of fixed with text files. </li><li>Import / Export of fixed with text files.
</li><li>Support for OUT parameters in user-defined procedures. </li><li>Support for OUT parameters in user-defined procedures.
</li><li>Support getGeneratedKeys to return multiple rows when used with batch updates.
This is supported by MySQL, but not Derby. Both PostgreSQL and HSQLDB don't support getGeneratedKeys.
Also support it when using INSERT ... SELECT.
</li></ul> </li></ul>
<h2>Not Planned</h2> <h2>Not Planned</h2>
......
...@@ -74,7 +74,7 @@ public class CommandRemote implements CommandInterface { ...@@ -74,7 +74,7 @@ public class CommandRemote implements CommandInterface {
for (int j = 0; j < paramCount; j++) { for (int j = 0; j < paramCount; j++) {
if (readParams) { if (readParams) {
ParameterRemote p = new ParameterRemote(j); ParameterRemote p = new ParameterRemote(j);
p.read(transfer); p.readMetaData(transfer);
parameters.add(p); parameters.add(p);
} else { } else {
parameters.add(new ParameterRemote(j)); parameters.add(new ParameterRemote(j));
......
...@@ -3072,8 +3072,10 @@ public class Parser { ...@@ -3072,8 +3072,10 @@ public class Parser {
Expression defaultExpression = readExpression(); Expression defaultExpression = readExpression();
column.setDefaultExpression(session, defaultExpression); column.setDefaultExpression(session, defaultExpression);
} else if (readIf("GENERATED")) { } else if (readIf("GENERATED")) {
read("BY"); if (!readIf("ALWAYS")) {
read("DEFAULT"); read("BY");
read("DEFAULT");
}
read("AS"); read("AS");
read("IDENTITY"); read("IDENTITY");
long start = 1, increment = 1; long start = 1, increment = 1;
......
...@@ -89,7 +89,7 @@ public class BackupCommand extends Prepared { ...@@ -89,7 +89,7 @@ public class BackupCommand extends Prepared {
ArrayList fileList = FileLister.getDatabaseFiles(dir, name, true); ArrayList fileList = FileLister.getDatabaseFiles(dir, name, true);
for (int i = 0; i < fileList.size(); i++) { for (int i = 0; i < fileList.size(); i++) {
fn = (String) fileList.get(i); fn = (String) fileList.get(i);
if (fn.endsWith(Constants.SUFFIX_HASH_FILE) || fn.endsWith(Constants.SUFFIX_LOB_FILE)) { if (fn.endsWith(Constants.SUFFIX_LOB_FILE)) {
backupFile(out, base, fn); backupFile(out, base, fn);
} }
} }
......
...@@ -93,10 +93,22 @@ public class Comment extends DbObjectBase { ...@@ -93,10 +93,22 @@ public class Comment extends DbObjectBase {
throw Message.getInternalError(); throw Message.getInternalError();
} }
/**
* Get the comment key name for the given database object. This key name is
* used internally to associate the comment to the object.
*
* @param obj the object
* @return the key name
*/
public static String getKey(DbObject obj) { public static String getKey(DbObject obj) {
return getTypeName(obj.getType()) + " " + obj.getSQL(); return getTypeName(obj.getType()) + " " + obj.getSQL();
} }
/**
* Set the comment text.
*
* @param comment the text
*/
public void setCommentText(String comment) { public void setCommentText(String comment) {
this.commentText = comment; this.commentText = comment;
} }
......
...@@ -44,7 +44,7 @@ public class Engine { ...@@ -44,7 +44,7 @@ public class Engine {
// if it is required to call it twice // if it is required to call it twice
String name = ci.getName(); String name = ci.getName();
Database database; Database database;
if (ci.isUnnamed()) { if (ci.isUnnamedInMemory()) {
database = null; database = null;
} else { } else {
database = (Database) databases.get(name); database = (Database) databases.get(name);
...@@ -65,7 +65,7 @@ public class Engine { ...@@ -65,7 +65,7 @@ public class Engine {
user.setUserPasswordHash(ci.getUserPasswordHash()); user.setUserPasswordHash(ci.getUserPasswordHash());
database.setMasterUser(user); database.setMasterUser(user);
} }
if (!ci.isUnnamed()) { if (!ci.isUnnamedInMemory()) {
databases.put(name, database); databases.put(name, database);
} }
database.opened(); database.opened();
......
...@@ -22,7 +22,37 @@ import org.h2.value.ValueString; ...@@ -22,7 +22,37 @@ import org.h2.value.ValueString;
* A mathematical expression, or string concatenation. * A mathematical expression, or string concatenation.
*/ */
public class Operation extends Expression { public class Operation extends Expression {
public static final int CONCAT = 0, PLUS = 1, MINUS = 2, MULTIPLY = 3, DIVIDE = 4, NEGATE = 5;
/**
* This operation represents a string concatenation as in 'Hello' || 'World'.
*/
public static final int CONCAT = 0;
/**
* This operation represents an addition as in 1 + 2.
*/
public static final int PLUS = 1;
/**
* This operation represents a subtraction as in 2 - 1.
*/
public static final int MINUS = 2;
/**
* This operation represents a multiplication as in 2 * 3.
*/
public static final int MULTIPLY = 3;
/**
* This operation represents a division as in 4 * 2.
*/
public static final int DIVIDE = 4;
/**
* This operation represents a negation as in - ID.
*/
public static final int NEGATE = 5;
private int opType; private int opType;
private Expression left, right; private Expression left, right;
private int dataType; private int dataType;
......
...@@ -64,14 +64,25 @@ public class ParameterRemote implements ParameterInterface { ...@@ -64,14 +64,25 @@ public class ParameterRemote implements ParameterInterface {
return nullable; return nullable;
} }
public void read(Transfer transfer) throws IOException { /**
* Write the parameter meta data from the transfer object.
*
* @param transfer the transfer object
*/
public void readMetaData(Transfer transfer) throws IOException {
dataType = transfer.readInt(); dataType = transfer.readInt();
precision = transfer.readLong(); precision = transfer.readLong();
scale = transfer.readInt(); scale = transfer.readInt();
nullable = transfer.readInt(); nullable = transfer.readInt();
} }
public static void write(Transfer transfer, ParameterInterface p) throws IOException { /**
* Write the parameter meta data to the transfer object.
*
* @param transfer the transfer object
* @param p the parameter
*/
public static void writeMetaData(Transfer transfer, ParameterInterface p) throws IOException {
transfer.writeInt(p.getType()); transfer.writeInt(p.getType());
transfer.writeLong(p.getPrecision()); transfer.writeLong(p.getPrecision());
transfer.writeInt(p.getScale()); transfer.writeInt(p.getScale());
......
...@@ -42,10 +42,6 @@ public class SequenceValue extends Expression { ...@@ -42,10 +42,6 @@ public class SequenceValue extends Expression {
// nothing to do // nothing to do
} }
public void checkMapped() {
// nothing to do
}
public Expression optimize(Session session) { public Expression optimize(Session session) {
return this; return this;
} }
......
...@@ -68,6 +68,12 @@ public class TableFunction extends Function implements FunctionCall { ...@@ -68,6 +68,12 @@ public class TableFunction extends Function implements FunctionCall {
return distinct ? "TABLE_DISTINCT" : "TABLE"; return distinct ? "TABLE_DISTINCT" : "TABLE";
} }
/**
* Get the row count of the table.
*
* @param session the session
* @return the row count
*/
public int getRowCount(Session session) throws SQLException { public int getRowCount(Session session) throws SQLException {
int len = columnList.length; int len = columnList.length;
int rowCount = 0; int rowCount = 0;
......
...@@ -23,14 +23,29 @@ import org.h2.value.ValueNull; ...@@ -23,14 +23,29 @@ import org.h2.value.ValueNull;
public class ValueExpression extends Expression { public class ValueExpression extends Expression {
private Value value; private Value value;
/**
* The expression represents ValueNull.INSTANCE.
*/
public static final ValueExpression NULL = new ValueExpression(ValueNull.INSTANCE); public static final ValueExpression NULL = new ValueExpression(ValueNull.INSTANCE);
/**
* This special expression represents the default value. It is used for
* UPDATE statements of the form SET COLUMN = DEFAULT. The value is
* ValueNull.INSTANCE, but should never be accessed.
*/
public static final ValueExpression DEFAULT = new ValueExpression(ValueNull.INSTANCE); public static final ValueExpression DEFAULT = new ValueExpression(ValueNull.INSTANCE);
public static ValueExpression get(Value v) { /**
if (v == ValueNull.INSTANCE) { * Create a new expression with the given value.
*
* @param value the value
* @return the expression
*/
public static ValueExpression get(Value value) {
if (value == ValueNull.INSTANCE) {
return ValueExpression.NULL; return ValueExpression.NULL;
} }
return new ValueExpression(v); return new ValueExpression(value);
} }
private ValueExpression(Value value) { private ValueExpression(Value value) {
......
...@@ -146,14 +146,16 @@ public class BtreeIndex extends BaseIndex implements RecordReader { ...@@ -146,14 +146,16 @@ public class BtreeIndex extends BaseIndex implements RecordReader {
lastChange = 0; lastChange = 0;
if (storage != null) { if (storage != null) {
storage.flushFile(); storage.flushFile();
deletePage(session, head); if (!database.getReadOnly()) {
// if we log index changes now, then the index is consistent deletePage(session, head);
// if we don't log index changes, then the index is only consistent // if we log index changes now, then the index is consistent
// if there are no in doubt transactions // if we don't log index changes, then the index is only consistent
if (database.getLogIndexChanges() || !database.getLog().containsInDoubtTransactions()) { // if there are no in doubt transactions
head.setConsistent(true); if (database.getLogIndexChanges() || !database.getLog().containsInDoubtTransactions()) {
head.setConsistent(true);
}
flushHead(session);
} }
flushHead(session);
} }
} }
......
...@@ -215,7 +215,7 @@ public class TcpServerThread implements Runnable { ...@@ -215,7 +215,7 @@ public class TcpServerThread implements Runnable {
if (operation == SessionRemote.SESSION_PREPARE_READ_PARAMS) { if (operation == SessionRemote.SESSION_PREPARE_READ_PARAMS) {
for (int i = 0; i < paramCount; i++) { for (int i = 0; i < paramCount; i++) {
Parameter p = (Parameter) params.get(i); Parameter p = (Parameter) params.get(i);
ParameterRemote.write(transfer, p); ParameterRemote.writeMetaData(transfer, p);
} }
} }
transfer.flush(); transfer.flush();
......
...@@ -197,7 +197,7 @@ public class PgServerThread implements Runnable { ...@@ -197,7 +197,7 @@ public class PgServerThread implements Runnable {
ci.setOriginalURL("jdbc:h2:" + databaseName + ";MODE=PostgreSQL"); ci.setOriginalURL("jdbc:h2:" + databaseName + ";MODE=PostgreSQL");
ci.setUserName(userName); ci.setUserName(userName);
ci.setProperty("PASSWORD", password); ci.setProperty("PASSWORD", password);
ci.readPasswords(); ci.convertPasswords();
conn = new JdbcConnection(ci, false); conn = new JdbcConnection(ci, false);
// can not do this because when called inside // can not do this because when called inside
// DriverManager.getConnection, a deadlock occurs // DriverManager.getConnection, a deadlock occurs
......
...@@ -58,8 +58,6 @@ public class FileLister { ...@@ -58,8 +58,6 @@ public class FileLister {
ok = true; ok = true;
} else if (f.endsWith(Constants.SUFFIX_LOG_FILE)) { } else if (f.endsWith(Constants.SUFFIX_LOG_FILE)) {
ok = true; ok = true;
} else if (f.endsWith(Constants.SUFFIX_HASH_FILE)) {
ok = true;
} else if (f.endsWith(Constants.SUFFIX_LOBS_DIRECTORY)) { } else if (f.endsWith(Constants.SUFFIX_LOBS_DIRECTORY)) {
files.addAll(getDatabaseFiles(f, null, all)); files.addAll(getDatabaseFiles(f, null, all));
ok = true; ok = true;
......
...@@ -294,10 +294,10 @@ public class Shell { ...@@ -294,10 +294,10 @@ public class Shell {
private String readPassword() throws IOException { private String readPassword() throws IOException {
try { try {
Method getConsole = System.class.getMethod("console", new Class[0]); Method getConsole = System.class.getMethod("console", new Class[0]);
Object console = getConsole.invoke(null, null); Object console = getConsole.invoke(null, (Object[]) null);
Method readPassword = console.getClass().getMethod("readPassword", new Class[0]); Method readPassword = console.getClass().getMethod("readPassword", new Class[0]);
System.out.print("Password "); System.out.print("Password ");
char[] password = (char[]) readPassword.invoke(console, null); char[] password = (char[]) readPassword.invoke(console, (Object[]) null);
return password == null ? null : new String(password); return password == null ? null : new String(password);
} catch (Throwable t) { } catch (Throwable t) {
// ignore, use the default solution // ignore, use the default solution
......
...@@ -160,7 +160,6 @@ java org.h2.test.TestAll timer ...@@ -160,7 +160,6 @@ java org.h2.test.TestAll timer
/* /*
improve javadocs improve javadocs
upload jazoon upload jazoon
...@@ -222,6 +221,8 @@ History: ...@@ -222,6 +221,8 @@ History:
(when using remote connections). (when using remote connections).
The Shell tool now uses java.io.Console to read the password The Shell tool now uses java.io.Console to read the password
when using JDK 1.6 when using JDK 1.6
When using read-only databases and setting LOG=2, an exception
was written to the trace file when closing the database. Fixed.
Roadmap: Roadmap:
......
...@@ -509,4 +509,4 @@ worldwide everyone additions expense lawsuit checksums jazoon flashback ...@@ -509,4 +509,4 @@ worldwide everyone additions expense lawsuit checksums jazoon flashback
dieguez dfile mvn dversion dgroup dpackaging dartifact durl dpom pom dieguez dfile mvn dversion dgroup dpackaging dartifact durl dpom pom
subpackages slowed deactivate throttled noindex expired arizona export subpackages slowed deactivate throttled noindex expired arizona export
intentional knowing jcl plug facade deployment logback confusion visited intentional knowing jcl plug facade deployment logback confusion visited
pickle pickle associate subtraction negation multiplication
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论