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

--no commit message

--no commit message
上级 003d1ab8
......@@ -323,7 +323,6 @@ Roadmap
</li><li>Translated .pdf
</li><li>Cluster: hot deploy (adding a node on runtime)
</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>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
......@@ -356,6 +355,9 @@ Roadmap
</li><li>Support flashback queries as in Oracle.
</li><li>Import / Export of fixed with text files.
</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>
<h2>Not Planned</h2>
......
......@@ -74,7 +74,7 @@ public class CommandRemote implements CommandInterface {
for (int j = 0; j < paramCount; j++) {
if (readParams) {
ParameterRemote p = new ParameterRemote(j);
p.read(transfer);
p.readMetaData(transfer);
parameters.add(p);
} else {
parameters.add(new ParameterRemote(j));
......
......@@ -3072,8 +3072,10 @@ public class Parser {
Expression defaultExpression = readExpression();
column.setDefaultExpression(session, defaultExpression);
} else if (readIf("GENERATED")) {
read("BY");
read("DEFAULT");
if (!readIf("ALWAYS")) {
read("BY");
read("DEFAULT");
}
read("AS");
read("IDENTITY");
long start = 1, increment = 1;
......
......@@ -89,7 +89,7 @@ public class BackupCommand extends Prepared {
ArrayList fileList = FileLister.getDatabaseFiles(dir, name, true);
for (int i = 0; i < fileList.size(); 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);
}
}
......
......@@ -93,10 +93,22 @@ public class Comment extends DbObjectBase {
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) {
return getTypeName(obj.getType()) + " " + obj.getSQL();
}
/**
* Set the comment text.
*
* @param comment the text
*/
public void setCommentText(String comment) {
this.commentText = comment;
}
......
......@@ -44,7 +44,7 @@ public class Engine {
// if it is required to call it twice
String name = ci.getName();
Database database;
if (ci.isUnnamed()) {
if (ci.isUnnamedInMemory()) {
database = null;
} else {
database = (Database) databases.get(name);
......@@ -65,7 +65,7 @@ public class Engine {
user.setUserPasswordHash(ci.getUserPasswordHash());
database.setMasterUser(user);
}
if (!ci.isUnnamed()) {
if (!ci.isUnnamedInMemory()) {
databases.put(name, database);
}
database.opened();
......
......@@ -22,7 +22,37 @@ import org.h2.value.ValueString;
* A mathematical expression, or string concatenation.
*/
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 Expression left, right;
private int dataType;
......
......@@ -64,14 +64,25 @@ public class ParameterRemote implements ParameterInterface {
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();
precision = transfer.readLong();
scale = 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.writeLong(p.getPrecision());
transfer.writeInt(p.getScale());
......
......@@ -42,10 +42,6 @@ public class SequenceValue extends Expression {
// nothing to do
}
public void checkMapped() {
// nothing to do
}
public Expression optimize(Session session) {
return this;
}
......
......@@ -68,6 +68,12 @@ public class TableFunction extends Function implements FunctionCall {
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 {
int len = columnList.length;
int rowCount = 0;
......
......@@ -23,14 +23,29 @@ import org.h2.value.ValueNull;
public class ValueExpression extends Expression {
private Value value;
/**
* The expression represents 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 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 new ValueExpression(v);
return new ValueExpression(value);
}
private ValueExpression(Value value) {
......
......@@ -146,14 +146,16 @@ public class BtreeIndex extends BaseIndex implements RecordReader {
lastChange = 0;
if (storage != null) {
storage.flushFile();
deletePage(session, head);
// if we log index changes now, then the index is consistent
// if we don't log index changes, then the index is only consistent
// if there are no in doubt transactions
if (database.getLogIndexChanges() || !database.getLog().containsInDoubtTransactions()) {
head.setConsistent(true);
if (!database.getReadOnly()) {
deletePage(session, head);
// if we log index changes now, then the index is consistent
// if we don't log index changes, then the index is only consistent
// if there are no in doubt transactions
if (database.getLogIndexChanges() || !database.getLog().containsInDoubtTransactions()) {
head.setConsistent(true);
}
flushHead(session);
}
flushHead(session);
}
}
......
......@@ -215,7 +215,7 @@ public class TcpServerThread implements Runnable {
if (operation == SessionRemote.SESSION_PREPARE_READ_PARAMS) {
for (int i = 0; i < paramCount; i++) {
Parameter p = (Parameter) params.get(i);
ParameterRemote.write(transfer, p);
ParameterRemote.writeMetaData(transfer, p);
}
}
transfer.flush();
......
......@@ -197,7 +197,7 @@ public class PgServerThread implements Runnable {
ci.setOriginalURL("jdbc:h2:" + databaseName + ";MODE=PostgreSQL");
ci.setUserName(userName);
ci.setProperty("PASSWORD", password);
ci.readPasswords();
ci.convertPasswords();
conn = new JdbcConnection(ci, false);
// can not do this because when called inside
// DriverManager.getConnection, a deadlock occurs
......
......@@ -58,8 +58,6 @@ public class FileLister {
ok = true;
} else if (f.endsWith(Constants.SUFFIX_LOG_FILE)) {
ok = true;
} else if (f.endsWith(Constants.SUFFIX_HASH_FILE)) {
ok = true;
} else if (f.endsWith(Constants.SUFFIX_LOBS_DIRECTORY)) {
files.addAll(getDatabaseFiles(f, null, all));
ok = true;
......
......@@ -294,10 +294,10 @@ public class Shell {
private String readPassword() throws IOException {
try {
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]);
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);
} catch (Throwable t) {
// ignore, use the default solution
......
......@@ -160,7 +160,6 @@ java org.h2.test.TestAll timer
/*
improve javadocs
upload jazoon
......@@ -222,6 +221,8 @@ History:
(when using remote connections).
The Shell tool now uses java.io.Console to read the password
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:
......
......@@ -509,4 +509,4 @@ worldwide everyone additions expense lawsuit checksums jazoon flashback
dieguez dfile mvn dversion dgroup dpackaging dartifact durl dpom pom
subpackages slowed deactivate throttled noindex expired arizona export
intentional knowing jcl plug facade deployment logback confusion visited
pickle
pickle associate subtraction negation multiplication
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论