提交 e9852b45 authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 4fc52e91
...@@ -46,6 +46,7 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch. ...@@ -46,6 +46,7 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
The old implementation does not work with multi-level nested temporary views The old implementation does not work with multi-level nested temporary views
(select * from (select * from (select * from test))). (select * from (select * from (select * from test))).
</li><li>The new view implementation did not work with &lt; and &lt;= comparison. Fixed. </li><li>The new view implementation did not work with &lt; and &lt;= comparison. Fixed.
</li><li>Both view implementations did not work with multiple levels of nested temporary views (FROM (SELECT...)). Fixed.
</li><li>The H2 Console can now be run as a standalone web application, </li><li>The H2 Console can now be run as a standalone web application,
or it can be embedded as a servlet into any existing web application. To build the or it can be embedded as a servlet into any existing web application. To build the
'H2 Console' web application, execute 'ant warConsole'. 'H2 Console' web application, execute 'ant warConsole'.
...@@ -1029,7 +1030,7 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch. ...@@ -1029,7 +1030,7 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
</li><li>Option to globally disable / enable referential integrity checks </li><li>Option to globally disable / enable referential integrity checks
</li><li>Support ISO 8601 timestamp / date / time with timezone </li><li>Support ISO 8601 timestamp / date / time with timezone
</li><li>Support TRANSFORM / PIVOT as in MS Access </li><li>Support TRANSFORM / PIVOT as in MS Access
</li><li>ALTER SEQUENCE ... RENAME TO ... (http://www.postgresql.org/docs/8.2/static/sql-altersequence.html) </li><li>Sequence: PostgreSQL compatibility (rename, create) (http://www.postgresql.org/docs/8.2/static/sql-altersequence.html)
</li><li>SELECT * FROM (VALUES (...), (...), ....) AS alias(f1, ...) </li><li>SELECT * FROM (VALUES (...), (...), ....) AS alias(f1, ...)
</li><li>Support updatable views with join on primary keys (to extend a table) </li><li>Support updatable views with join on primary keys (to extend a table)
</li><li>File_Read / File_Store funktionen: FILE_STORE('test.sql', ?), FILE_READ('test.sql') </li><li>File_Read / File_Store funktionen: FILE_STORE('test.sql', ?), FILE_READ('test.sql')
...@@ -1094,6 +1095,7 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch. ...@@ -1094,6 +1095,7 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
</li><li>Allow execution time prepare for SELECT * FROM CSVREAD(?, 'columnNameString') </li><li>Allow execution time prepare for SELECT * FROM CSVREAD(?, 'columnNameString')
</li><li>Support multiple directories (on different hard drives) for the same database </li><li>Support multiple directories (on different hard drives) for the same database
</li><li>Server protocol: use challenge response authentication, but client sends hash(user+password) encrypted with response </li><li>Server protocol: use challenge response authentication, but client sends hash(user+password) encrypted with response
</li><li>Support EXEC[UTE] (doesn't return a result set, compatible to MS SQL Server)
</li></ul> </li></ul>
<h3>Not Planned</h3> <h3>Not Planned</h3>
......
@java -cp "h2.jar;%H2DRIVERS%;%CLASSPATH%" org.h2.SysTray @java -cp "h2.jar;%H2DRIVERS%;%CLASSPATH%" org.h2.tools.Console
@if errorlevel 1 pause @if errorlevel 1 pause
\ No newline at end of file
...@@ -140,7 +140,7 @@ Section "All" ...@@ -140,7 +140,7 @@ Section "All"
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
SetOutPath "$INSTDIR\bin" SetOutPath "$INSTDIR\bin"
CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER" CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\H2 Console.lnk" "javaw" "-cp $\"$INSTDIR\bin\h2.jar;%H2DRIVERS%;%CLASSPATH%$\" org.h2.SysTray" "$INSTDIR\src\installer\favicon.ico" 0 SW_SHOWMINIMIZED "" "Start the Console" CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\H2 Console.lnk" "javaw" "-cp $\"$INSTDIR\bin\h2.jar;%H2DRIVERS%;%CLASSPATH%$\" org.h2.tools.Console" "$INSTDIR\src\installer\favicon.ico" 0 SW_SHOWMINIMIZED "" "Start the Console"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\H2 Console (Command Line).lnk" "cmd" "/c h2.bat" "$INSTDIR\src\installer\favicon.ico" 0 SW_SHOWMINIMIZED "" "Start the Console from command line (using h2.bat)" CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\H2 Console (Command Line).lnk" "cmd" "/c h2.bat" "$INSTDIR\src\installer\favicon.ico" 0 SW_SHOWMINIMIZED "" "Start the Console from command line (using h2.bat)"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\H2 Documentation.lnk" "$INSTDIR\docs\index.html" CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\H2 Documentation.lnk" "$INSTDIR\docs\index.html"
; CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe" ; CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
......
...@@ -95,10 +95,9 @@ public abstract class Command implements CommandInterface { ...@@ -95,10 +95,9 @@ public abstract class Command implements CommandInterface {
private void stop() throws SQLException { private void stop() throws SQLException {
session.setCurrentCommand(null); session.setCurrentCommand(null);
if (!isTransactional()) { if (!isTransactional()) {
// meta data changes need to commit in any case session.commit(true);
session.commit();
} else if (session.getAutoCommit()) { } else if (session.getAutoCommit()) {
session.commit(); session.commit(false);
} }
if (trace.info()) { if (trace.info()) {
long time = System.currentTimeMillis() - startTime; long time = System.currentTimeMillis() - startTime;
......
...@@ -742,11 +742,7 @@ public class Parser { ...@@ -742,11 +742,7 @@ public class Parser {
String querySQL = query.getSQL(); String querySQL = query.getSQL();
String tempViewName = session.getNextTempViewName(); String tempViewName = session.getNextTempViewName();
table = new TableView(mainSchema, 0, tempViewName, querySQL, query.getParameters(), null, session, false); table = new TableView(mainSchema, 0, tempViewName, querySQL, query.getParameters(), null, session, false);
int testing;
table.setOnCommitDrop(true); table.setOnCommitDrop(true);
//this.recompileAlways = true;
session.addLocalTempTable(table); session.addLocalTempTable(table);
read(")"); read(")");
} else { } else {
......
...@@ -31,7 +31,7 @@ public class AlterIndexRename extends SchemaCommand { ...@@ -31,7 +31,7 @@ public class AlterIndexRename extends SchemaCommand {
} }
public int update() throws SQLException { public int update() throws SQLException {
session.commit(); session.commit(true);
Database db = session.getDatabase(); Database db = session.getDatabase();
if(getSchema().findIndex(newIndexName) != null || newIndexName.equals(oldIndex.getName())) { if(getSchema().findIndex(newIndexName) != null || newIndexName.equals(oldIndex.getName())) {
throw Message.getSQLException(Message.INDEX_ALREADY_EXISTS_1, newIndexName); throw Message.getSQLException(Message.INDEX_ALREADY_EXISTS_1, newIndexName);
......
...@@ -42,7 +42,7 @@ public class AlterSequence extends DefineCommand { ...@@ -42,7 +42,7 @@ public class AlterSequence extends DefineCommand {
public int update() throws SQLException { public int update() throws SQLException {
// TODO rights: what are the rights required for a sequence? // TODO rights: what are the rights required for a sequence?
session.commit(); session.commit(true);
Database db = session.getDatabase(); Database db = session.getDatabase();
if(newStart) { if(newStart) {
sequence.setStartValue(start); sequence.setStartValue(start);
......
...@@ -59,7 +59,7 @@ public class AlterTableAddConstraint extends SchemaCommand { ...@@ -59,7 +59,7 @@ public class AlterTableAddConstraint extends SchemaCommand {
} }
public int update() throws SQLException { public int update() throws SQLException {
session.commit(); session.commit(true);
Database db = session.getDatabase(); Database db = session.getDatabase();
if(getSchema().findConstraint(constraintName)!=null) { if(getSchema().findConstraint(constraintName)!=null) {
throw Message.getSQLException(Message.CONSTRAINT_ALREADY_EXISTS_1, throw Message.getSQLException(Message.CONSTRAINT_ALREADY_EXISTS_1,
......
...@@ -56,7 +56,7 @@ public class AlterTableAlterColumn extends SchemaCommand { ...@@ -56,7 +56,7 @@ public class AlterTableAlterColumn extends SchemaCommand {
} }
public int update() throws SQLException { public int update() throws SQLException {
session.commit(); session.commit(true);
Database db = session.getDatabase(); Database db = session.getDatabase();
session.getUser().checkRight(table, Right.ALL); session.getUser().checkRight(table, Right.ALL);
table.checkSupportAlter(); table.checkSupportAlter();
......
...@@ -27,7 +27,7 @@ public class AlterTableDropConstraint extends SchemaCommand { ...@@ -27,7 +27,7 @@ public class AlterTableDropConstraint extends SchemaCommand {
} }
public int update() throws SQLException { public int update() throws SQLException {
session.commit(); session.commit(true);
Constraint constraint = getSchema().getConstraint(constraintName); Constraint constraint = getSchema().getConstraint(constraintName);
session.getUser().checkRight(constraint.getTable(), Right.ALL); session.getUser().checkRight(constraint.getTable(), Right.ALL);
session.getUser().checkRight(constraint.getRefTable(), Right.ALL); session.getUser().checkRight(constraint.getRefTable(), Right.ALL);
......
...@@ -35,7 +35,7 @@ public class AlterTableRename extends SchemaCommand { ...@@ -35,7 +35,7 @@ public class AlterTableRename extends SchemaCommand {
} }
public int update() throws SQLException { public int update() throws SQLException {
session.commit(); session.commit(true);
Database db = session.getDatabase(); Database db = session.getDatabase();
if(getSchema().findTableOrView(session, newTableName) != null || newTableName.equals(oldTable.getName())) { if(getSchema().findTableOrView(session, newTableName) != null || newTableName.equals(oldTable.getName())) {
throw Message.getSQLException(Message.TABLE_OR_VIEW_ALREADY_EXISTS_1, newTableName); throw Message.getSQLException(Message.TABLE_OR_VIEW_ALREADY_EXISTS_1, newTableName);
......
...@@ -37,7 +37,7 @@ public class AlterTableRenameColumn extends DefineCommand { ...@@ -37,7 +37,7 @@ public class AlterTableRenameColumn extends DefineCommand {
} }
public int update() throws SQLException { public int update() throws SQLException {
session.commit(); session.commit(true);
Database db = session.getDatabase(); Database db = session.getDatabase();
session.getUser().checkRight(table, Right.ALL); session.getUser().checkRight(table, Right.ALL);
table.checkSupportAlter(); table.checkSupportAlter();
......
...@@ -63,7 +63,7 @@ public class AlterUser extends DefineCommand { ...@@ -63,7 +63,7 @@ public class AlterUser extends DefineCommand {
} }
public int update() throws SQLException { public int update() throws SQLException {
session.commit(); session.commit(true);
Database db = session.getDatabase(); Database db = session.getDatabase();
switch(type) { switch(type) {
case SET_PASSWORD: case SET_PASSWORD:
......
...@@ -23,7 +23,7 @@ public class AlterView extends DefineCommand { ...@@ -23,7 +23,7 @@ public class AlterView extends DefineCommand {
} }
public int update() throws SQLException { public int update() throws SQLException {
session.commit(); session.commit(true);
session.getUser().checkRight(view, Right.ALL); session.getUser().checkRight(view, Right.ALL);
view.recompile(session); view.recompile(session);
return 0; return 0;
......
...@@ -26,7 +26,7 @@ public class Analyze extends DefineCommand { ...@@ -26,7 +26,7 @@ public class Analyze extends DefineCommand {
} }
public int update() throws SQLException { public int update() throws SQLException {
session.commit(); session.commit(true);
Database db = session.getDatabase(); Database db = session.getDatabase();
session.getUser().checkAdmin(); session.getUser().checkAdmin();
ObjectArray tables = db.getAllSchemaObjects(DbObject.TABLE_OR_VIEW); ObjectArray tables = db.getAllSchemaObjects(DbObject.TABLE_OR_VIEW);
......
...@@ -30,7 +30,7 @@ public class CreateConstant extends SchemaCommand { ...@@ -30,7 +30,7 @@ public class CreateConstant extends SchemaCommand {
} }
public int update() throws SQLException { public int update() throws SQLException {
session.commit(); session.commit(true);
session.getUser().checkAdmin(); session.getUser().checkAdmin();
Database db = session.getDatabase(); Database db = session.getDatabase();
if(getSchema().findConstant(constantName)!=null) { if(getSchema().findConstant(constantName)!=null) {
......
...@@ -22,7 +22,7 @@ public class CreateFunctionAlias extends DefineCommand { ...@@ -22,7 +22,7 @@ public class CreateFunctionAlias extends DefineCommand {
} }
public int update() throws SQLException { public int update() throws SQLException {
session.commit(); session.commit(true);
session.getUser().checkAdmin(); session.getUser().checkAdmin();
Database db = session.getDatabase(); Database db = session.getDatabase();
if(db.findFunctionAlias(aliasName) != null) { if(db.findFunctionAlias(aliasName) != null) {
......
...@@ -57,7 +57,7 @@ public class CreateIndex extends SchemaCommand { ...@@ -57,7 +57,7 @@ public class CreateIndex extends SchemaCommand {
public int update() throws SQLException { public int update() throws SQLException {
// TODO cancel: may support for index creation // TODO cancel: may support for index creation
session.commit(); session.commit(true);
Database db = session.getDatabase(); Database db = session.getDatabase();
boolean persistent = db.isPersistent(); boolean persistent = db.isPersistent();
Table table = getSchema().getTableOrView(session, tableName); Table table = getSchema().getTableOrView(session, tableName);
......
...@@ -59,7 +59,7 @@ public class CreateLinkedTable extends SchemaCommand { ...@@ -59,7 +59,7 @@ public class CreateLinkedTable extends SchemaCommand {
} }
public int update() throws SQLException { public int update() throws SQLException {
session.commit(); session.commit(true);
Database db = session.getDatabase(); Database db = session.getDatabase();
session.getUser().checkAdmin(); session.getUser().checkAdmin();
if(getSchema().findTableOrView(session, tableName)!=null) { if(getSchema().findTableOrView(session, tableName)!=null) {
......
...@@ -30,7 +30,7 @@ public class CreateRole extends DefineCommand { ...@@ -30,7 +30,7 @@ public class CreateRole extends DefineCommand {
public int update() throws SQLException { public int update() throws SQLException {
session.getUser().checkAdmin(); session.getUser().checkAdmin();
session.commit(); session.commit(true);
Database db = session.getDatabase(); Database db = session.getDatabase();
if(db.findUser(roleName)!=null) { if(db.findUser(roleName)!=null) {
if (ifNotExists) { if (ifNotExists) {
......
...@@ -28,7 +28,7 @@ public class CreateSchema extends DefineCommand { ...@@ -28,7 +28,7 @@ public class CreateSchema extends DefineCommand {
public int update() throws SQLException { public int update() throws SQLException {
session.getUser().checkAdmin(); session.getUser().checkAdmin();
session.commit(); session.commit(true);
Database db = session.getDatabase(); Database db = session.getDatabase();
User user = db.getUser(authorization); User user = db.getUser(authorization);
user.checkAdmin(); user.checkAdmin();
......
...@@ -33,7 +33,7 @@ public class CreateSequence extends SchemaCommand { ...@@ -33,7 +33,7 @@ public class CreateSequence extends SchemaCommand {
} }
public int update() throws SQLException { public int update() throws SQLException {
session.commit(); session.commit(true);
Database db = session.getDatabase(); Database db = session.getDatabase();
if(getSchema().findSequence(sequenceName)!=null) { if(getSchema().findSequence(sequenceName)!=null) {
if (ifNotExists) { if (ifNotExists) {
......
...@@ -81,7 +81,7 @@ public class CreateTable extends SchemaCommand { ...@@ -81,7 +81,7 @@ public class CreateTable extends SchemaCommand {
public int update() throws SQLException { public int update() throws SQLException {
// TODO rights: what rights are required to create a table? // TODO rights: what rights are required to create a table?
session.commit(); session.commit(true);
Database db = session.getDatabase(); Database db = session.getDatabase();
if(!db.isPersistent()) { if(!db.isPersistent()) {
persistent = false; persistent = false;
......
...@@ -74,7 +74,7 @@ public class CreateTrigger extends SchemaCommand { ...@@ -74,7 +74,7 @@ public class CreateTrigger extends SchemaCommand {
public int update() throws SQLException { public int update() throws SQLException {
// TODO rights: what rights are required to create a trigger? // TODO rights: what rights are required to create a trigger?
session.commit(); session.commit(true);
Database db = session.getDatabase(); Database db = session.getDatabase();
if(getSchema().findTrigger(triggerName)!=null) { if(getSchema().findTrigger(triggerName)!=null) {
if (ifNotExists) { if (ifNotExists) {
......
...@@ -42,7 +42,7 @@ public class CreateUser extends DefineCommand { ...@@ -42,7 +42,7 @@ public class CreateUser extends DefineCommand {
public int update() throws SQLException { public int update() throws SQLException {
session.getUser().checkAdmin(); session.getUser().checkAdmin();
session.commit(); session.commit(true);
Database db = session.getDatabase(); Database db = session.getDatabase();
if(db.findUser(userName)!=null) { if(db.findUser(userName)!=null) {
if (ifNotExists) { if (ifNotExists) {
......
...@@ -37,7 +37,7 @@ public class CreateUserDataType extends DefineCommand { ...@@ -37,7 +37,7 @@ public class CreateUserDataType extends DefineCommand {
public int update() throws SQLException { public int update() throws SQLException {
session.getUser().checkAdmin(); session.getUser().checkAdmin();
session.commit(); session.commit(true);
Database db = session.getDatabase(); Database db = session.getDatabase();
session.getUser().checkAdmin(); session.getUser().checkAdmin();
if(db.findUserDataType(typeName)!=null) { if(db.findUserDataType(typeName)!=null) {
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
public int update() throws SQLException { public int update() throws SQLException {
// TODO rights: what rights are required to create a view? // TODO rights: what rights are required to create a view?
session.commit(); session.commit(true);
Database db = session.getDatabase(); Database db = session.getDatabase();
if(getSchema().findTableOrView(session, viewName)!=null) { if(getSchema().findTableOrView(session, viewName)!=null) {
if (ifNotExists) { if (ifNotExists) {
......
...@@ -31,7 +31,7 @@ public class DropConstant extends SchemaCommand { ...@@ -31,7 +31,7 @@ public class DropConstant extends SchemaCommand {
public int update() throws SQLException { public int update() throws SQLException {
session.getUser().checkAdmin(); session.getUser().checkAdmin();
session.commit(); session.commit(true);
Database db = session.getDatabase(); Database db = session.getDatabase();
Constant constant = getSchema().findConstant(constantName); Constant constant = getSchema().findConstant(constantName);
if(constant == null) { if(constant == null) {
......
...@@ -36,7 +36,7 @@ public class DropDatabase extends DefineCommand { ...@@ -36,7 +36,7 @@ public class DropDatabase extends DefineCommand {
private void dropAllObjects() throws SQLException { private void dropAllObjects() throws SQLException {
session.getUser().checkAdmin(); session.getUser().checkAdmin();
session.commit(); session.commit(true);
Database db = session.getDatabase(); Database db = session.getDatabase();
ObjectArray list; ObjectArray list;
// TODO local temp tables are not removed // TODO local temp tables are not removed
......
...@@ -22,7 +22,7 @@ public class DropFunctionAlias extends DefineCommand { ...@@ -22,7 +22,7 @@ public class DropFunctionAlias extends DefineCommand {
public int update() throws SQLException { public int update() throws SQLException {
session.getUser().checkAdmin(); session.getUser().checkAdmin();
session.commit(); session.commit(true);
Database db = session.getDatabase(); Database db = session.getDatabase();
FunctionAlias functionAlias = db.findFunctionAlias(aliasName); FunctionAlias functionAlias = db.findFunctionAlias(aliasName);
if(functionAlias == null) { if(functionAlias == null) {
......
...@@ -37,7 +37,7 @@ public class DropIndex extends SchemaCommand { ...@@ -37,7 +37,7 @@ public class DropIndex extends SchemaCommand {
} }
public int update() throws SQLException { public int update() throws SQLException {
session.commit(); session.commit(true);
Database db = session.getDatabase(); Database db = session.getDatabase();
Index index = getSchema().findIndex(indexName); Index index = getSchema().findIndex(indexName);
if(index == null) { if(index == null) {
......
...@@ -27,7 +27,7 @@ public class DropRole extends DefineCommand { ...@@ -27,7 +27,7 @@ public class DropRole extends DefineCommand {
public int update() throws SQLException { public int update() throws SQLException {
session.getUser().checkAdmin(); session.getUser().checkAdmin();
session.commit(); session.commit(true);
Database db = session.getDatabase(); Database db = session.getDatabase();
if(roleName.equals(Constants.PUBLIC_ROLE_NAME)) { if(roleName.equals(Constants.PUBLIC_ROLE_NAME)) {
throw Message.getSQLException(Message.ROLE_CAN_NOT_BE_DROPPED_1, roleName); throw Message.getSQLException(Message.ROLE_CAN_NOT_BE_DROPPED_1, roleName);
......
...@@ -26,7 +26,7 @@ public class DropSchema extends DefineCommand { ...@@ -26,7 +26,7 @@ public class DropSchema extends DefineCommand {
public int update() throws SQLException { public int update() throws SQLException {
session.getUser().checkAdmin(); session.getUser().checkAdmin();
session.commit(); session.commit(true);
Database db = session.getDatabase(); Database db = session.getDatabase();
Schema schema = db.findSchema(schemaName); Schema schema = db.findSchema(schemaName);
if(schema == null) { if(schema == null) {
......
...@@ -32,7 +32,7 @@ public class DropSequence extends SchemaCommand { ...@@ -32,7 +32,7 @@ public class DropSequence extends SchemaCommand {
public int update() throws SQLException { public int update() throws SQLException {
// TODO rights: what are the rights required for a sequence? // TODO rights: what are the rights required for a sequence?
session.getUser().checkAdmin(); session.getUser().checkAdmin();
session.commit(); session.commit(true);
Database db = session.getDatabase(); Database db = session.getDatabase();
Sequence sequence = getSchema().findSequence(sequenceName); Sequence sequence = getSchema().findSequence(sequenceName);
if(sequence == null) { if(sequence == null) {
......
...@@ -79,7 +79,7 @@ public class DropTable extends SchemaCommand { ...@@ -79,7 +79,7 @@ public class DropTable extends SchemaCommand {
} }
public int update() throws SQLException { public int update() throws SQLException {
session.commit(); session.commit(true);
prepareDrop(); prepareDrop();
executeDrop(); executeDrop();
return 0; return 0;
......
...@@ -32,7 +32,7 @@ public class DropTrigger extends SchemaCommand { ...@@ -32,7 +32,7 @@ public class DropTrigger extends SchemaCommand {
} }
public int update() throws SQLException { public int update() throws SQLException {
session.commit(); session.commit(true);
Database db = session.getDatabase(); Database db = session.getDatabase();
TriggerObject trigger = getSchema().findTrigger(triggerName); TriggerObject trigger = getSchema().findTrigger(triggerName);
if(trigger == null) { if(trigger == null) {
......
...@@ -30,7 +30,7 @@ public class DropUser extends DefineCommand { ...@@ -30,7 +30,7 @@ public class DropUser extends DefineCommand {
public int update() throws SQLException { public int update() throws SQLException {
session.getUser().checkAdmin(); session.getUser().checkAdmin();
session.commit(); session.commit(true);
Database db = session.getDatabase(); Database db = session.getDatabase();
User user = db.findUser(userName); User user = db.findUser(userName);
if(user == null) { if(user == null) {
......
...@@ -26,7 +26,7 @@ public class DropUserDataType extends DefineCommand { ...@@ -26,7 +26,7 @@ public class DropUserDataType extends DefineCommand {
public int update() throws SQLException { public int update() throws SQLException {
session.getUser().checkAdmin(); session.getUser().checkAdmin();
session.commit(); session.commit(true);
Database db = session.getDatabase(); Database db = session.getDatabase();
UserDataType type = db.findUserDataType(typeName); UserDataType type = db.findUserDataType(typeName);
if(type == null) { if(type == null) {
......
...@@ -31,7 +31,7 @@ public class DropView extends SchemaCommand { ...@@ -31,7 +31,7 @@ public class DropView extends SchemaCommand {
public int update() throws SQLException { public int update() throws SQLException {
// TODO rights: what rights are required to drop a view? // TODO rights: what rights are required to drop a view?
session.commit(); session.commit(true);
Table view = getSchema().findTableOrView(session, viewName); Table view = getSchema().findTableOrView(session, viewName);
if(view == null) { if(view == null) {
if(!ifExists) { if(!ifExists) {
......
...@@ -57,7 +57,7 @@ public class GrantRevoke extends DefineCommand { ...@@ -57,7 +57,7 @@ public class GrantRevoke extends DefineCommand {
public int update() throws SQLException { public int update() throws SQLException {
session.getUser().checkAdmin(); session.getUser().checkAdmin();
session.commit(); session.commit(true);
Database db = session.getDatabase(); Database db = session.getDatabase();
if(roleNames != null) { if(roleNames != null) {
for(int i=0; i<roleNames.size(); i++) { for(int i=0; i<roleNames.size(); i++) {
......
...@@ -28,7 +28,7 @@ public class SetComment extends DefineCommand { ...@@ -28,7 +28,7 @@ public class SetComment extends DefineCommand {
} }
public int update() throws SQLException { public int update() throws SQLException {
session.commit(); session.commit(true);
Database db = session.getDatabase(); Database db = session.getDatabase();
session.getUser().checkAdmin(); session.getUser().checkAdmin();
DbObject object = null; DbObject object = null;
......
...@@ -25,7 +25,7 @@ public class TruncateTable extends SchemaCommand { ...@@ -25,7 +25,7 @@ public class TruncateTable extends SchemaCommand {
} }
public int update() throws SQLException { public int update() throws SQLException {
session.commit(); session.commit(true);
Table table = getSchema().getTableOrView(session, tableName); Table table = getSchema().getTableOrView(session, tableName);
if(!table.canTruncate()) { if(!table.canTruncate()) {
throw Message.getSQLException(Message.CANNOT_TRUNCATE_1, tableName); throw Message.getSQLException(Message.CANNOT_TRUNCATE_1, tableName);
......
...@@ -56,7 +56,7 @@ public class RunScriptCommand extends ScriptBase { ...@@ -56,7 +56,7 @@ public class RunScriptCommand extends ScriptBase {
command.update(); command.update();
} }
if(session.getAutoCommit()) { if(session.getAutoCommit()) {
session.commit(); session.commit(false);
} }
} catch(SQLException e) { } catch(SQLException e) {
throw Message.addSQL(e, sql); throw Message.addSQL(e, sql);
......
...@@ -52,7 +52,7 @@ public class TransactionCommand extends Prepared { ...@@ -52,7 +52,7 @@ public class TransactionCommand extends Prepared {
session.setAutoCommit(false); session.setAutoCommit(false);
break; break;
case COMMIT: case COMMIT:
session.commit(); session.commit(false);
break; break;
case ROLLBACK: case ROLLBACK:
session.rollback(); session.rollback();
...@@ -93,7 +93,7 @@ public class TransactionCommand extends Prepared { ...@@ -93,7 +93,7 @@ public class TransactionCommand extends Prepared {
break; break;
case SHUTDOWN: { case SHUTDOWN: {
session.getUser().checkAdmin(); session.getUser().checkAdmin();
session.commit(); session.commit(false);
// close the database, but don't update the persistent setting // close the database, but don't update the persistent setting
session.getDatabase().setCloseDelay(0); session.getDatabase().setCloseDelay(0);
Database db = session.getDatabase(); Database db = session.getDatabase();
......
...@@ -156,7 +156,6 @@ public class Constants { ...@@ -156,7 +156,6 @@ public class Constants {
public static final String PUBLIC_ROLE_NAME = "PUBLIC"; public static final String PUBLIC_ROLE_NAME = "PUBLIC";
public static final String TEMP_TABLE_PREFIX = "TEMP_TABLE_"; public static final String TEMP_TABLE_PREFIX = "TEMP_TABLE_";
public static final String TEMP_TABLE_TRANSACTION_PREFIX = "TEMP_TRANS_TABLE_";
public static final int BIG_DECIMAL_SCALE_MAX = 100000; public static final int BIG_DECIMAL_SCALE_MAX = 100000;
......
...@@ -522,7 +522,7 @@ public class Database implements DataHandler { ...@@ -522,7 +522,7 @@ public class Database implements DataHandler {
addDefaultSetting(SetTypes.CLUSTER, Constants.CLUSTERING_DISABLED, 0); addDefaultSetting(SetTypes.CLUSTER, Constants.CLUSTERING_DISABLED, 0);
addDefaultSetting(SetTypes.WRITE_DELAY, null, Constants.DEFAULT_WRITE_DELAY); addDefaultSetting(SetTypes.WRITE_DELAY, null, Constants.DEFAULT_WRITE_DELAY);
removeUnusedStorages(); removeUnusedStorages();
systemSession.commit(); systemSession.commit(true);
if(!readOnly) { if(!readOnly) {
emergencyReserve = openFile(createTempFile(), "rw", false); emergencyReserve = openFile(createTempFile(), "rw", false);
emergencyReserve.autoDelete(); emergencyReserve.autoDelete();
...@@ -832,22 +832,18 @@ public class Database implements DataHandler { ...@@ -832,22 +832,18 @@ public class Database implements DataHandler {
} }
private void closeOpenFilesAndUnlock() throws SQLException { private void closeOpenFilesAndUnlock() throws SQLException {
int testing;
if (persistent && lock == null && fileLockMethod != FileLock.LOCK_NO) {
// everything already closed (maybe in checkPowerOff)
// don't delete temp files in this case because
// the database could be open now (even from within another process)
System.out.println("lock = null!");
// return;
}
if (log != null) { if (log != null) {
stopWriter(); stopWriter();
log.close(); log.close();
log = null; log = null;
} }
closeFiles(); closeFiles();
if (persistent && lock == null && fileLockMethod != FileLock.LOCK_NO) {
// everything already closed (maybe in checkPowerOff)
// don't delete temp files in this case because
// the database could be open now (even from within another process)
return;
}
deleteOldTempFiles(); deleteOldTempFiles();
if(systemSession != null) { if(systemSession != null) {
systemSession.close(); systemSession.close();
...@@ -1175,7 +1171,7 @@ public class Database implements DataHandler { ...@@ -1175,7 +1171,7 @@ public class Database implements DataHandler {
public void setMasterUser(User user) throws SQLException { public void setMasterUser(User user) throws SQLException {
synchronized(this) { synchronized(this) {
addDatabaseObject(systemSession, user); addDatabaseObject(systemSession, user);
systemSession.commit(); systemSession.commit(true);
} }
} }
......
...@@ -117,7 +117,7 @@ public class Engine { ...@@ -117,7 +117,7 @@ public class Engine {
} }
} }
session.setAllowLiterals(false); session.setAllowLiterals(false);
session.commit(); session.commit(true);
session.getDatabase().getTrace(Trace.SESSION).info("connected #" + session.getId()); session.getDatabase().getTrace(Trace.SESSION).info("connected #" + session.getId());
return session; return session;
} }
......
...@@ -39,11 +39,8 @@ public class Session implements SessionInterface { ...@@ -39,11 +39,8 @@ public class Session implements SessionInterface {
private int id; private int id;
private Database database; private Database database;
private ObjectArray locks = new ObjectArray(); private ObjectArray locks = new ObjectArray();
// TODO big transactions: rollback log should be a sorted result set,
// so that big transactions are possible (delete or update huge tables)
private UndoLog undoLog; private UndoLog undoLog;
private boolean autoCommit = true; private boolean autoCommit = true;
// TODO function RANDOM: use a own implementation, making it system independent
private Random random; private Random random;
private LogSystem logSystem; private LogSystem logSystem;
private int lockTimeout; private int lockTimeout;
...@@ -62,6 +59,9 @@ public class Session implements SessionInterface { ...@@ -62,6 +59,9 @@ public class Session implements SessionInterface {
private HashSet unlinkSet; private HashSet unlinkSet;
private int tempViewIndex; private int tempViewIndex;
public Session() {
}
public Table findLocalTempTable(String name) { public Table findLocalTempTable(String name) {
Table t = null; Table t = null;
if(t == null && localTempTables != null) { if(t == null && localTempTables != null) {
...@@ -78,17 +78,6 @@ public class Session implements SessionInterface { ...@@ -78,17 +78,6 @@ public class Session implements SessionInterface {
return list; return list;
} }
public String getNewLocalTempTransactionTableName() {
// TODO this is current not used
String name = Constants.TEMP_TABLE_TRANSACTION_PREFIX;
for(int i=0; ; i++) {
String n = name + i;
if(findLocalTempTable(n) == null) {
return n;
}
}
}
public void addLocalTempTable(Table table) throws SQLException { public void addLocalTempTable(Table table) throws SQLException {
if(localTempTables == null) { if(localTempTables == null) {
localTempTables = new HashMap(); localTempTables = new HashMap();
...@@ -133,10 +122,6 @@ public class Session implements SessionInterface { ...@@ -133,10 +122,6 @@ public class Session implements SessionInterface {
this.lockTimeout = lockTimeout; this.lockTimeout = lockTimeout;
} }
public Session() {
}
public SessionInterface createSession(ConnectionInfo ci) throws SQLException { public SessionInterface createSession(ConnectionInfo ci) throws SQLException {
return Engine.getInstance().getSession(ci); return Engine.getInstance().getSession(ci);
} }
...@@ -188,13 +173,15 @@ public class Session implements SessionInterface { ...@@ -188,13 +173,15 @@ public class Session implements SessionInterface {
} }
} }
public void commit() throws SQLException { public void commit(boolean ddl) throws SQLException {
if(containsUncommitted()) { if(containsUncommitted()) {
// need to commit even if rollback is not possible (create/drop table and so on) // need to commit even if rollback is not possible (create/drop table and so on)
logSystem.commit(this); logSystem.commit(this);
} }
if(undoLog.size() > 0) { if(undoLog.size() > 0) {
undoLog.clear(); undoLog.clear();
}
if(!ddl) {
// do not clean the temp tables if the last command was a create/drop // do not clean the temp tables if the last command was a create/drop
cleanTempTables(false); cleanTempTables(false);
} }
......
...@@ -42,11 +42,6 @@ public class ViewIndex extends Index { ...@@ -42,11 +42,6 @@ public class ViewIndex extends Index {
public ViewIndex(TableView view, ViewIndex index, Session session, int[] masks) throws SQLException { public ViewIndex(TableView view, ViewIndex index, Session session, int[] masks) throws SQLException {
super(view, 0, null, null, IndexType.createNonUnique(false)); super(view, 0, null, null, IndexType.createNonUnique(false));
int testing;
if(index == null) {
System.out.println("top");
}
this.querySQL = index.querySQL; this.querySQL = index.querySQL;
this.originalParameters = index.originalParameters; this.originalParameters = index.originalParameters;
this.recursive = index.recursive; this.recursive = index.recursive;
......
...@@ -2799,7 +2799,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet { ...@@ -2799,7 +2799,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
private UpdatableRow getUpdatableRow() throws SQLException { private UpdatableRow getUpdatableRow() throws SQLException {
UpdatableRow row = new UpdatableRow(conn, result, session); UpdatableRow row = new UpdatableRow(conn, result, session);
if(!row.isUpdatable()) { if(!row.isUpdatable()) {
throw Message.getSQLException(Message.NOT_ON_UPDATABLE_ROW); throw Message.getSQLException(Message.RESULT_SET_NOT_UPDATABLE);
} }
return row; return row;
} }
......
...@@ -338,6 +338,7 @@ public class Message { ...@@ -338,6 +338,7 @@ public class Message {
public static final int FILE_NOT_FOUND_1 = 90124; public static final int FILE_NOT_FOUND_1 = 90124;
public static final int INVALID_CLASS_2 = 90125; public static final int INVALID_CLASS_2 = 90125;
public static final int DATABASE_IS_NOT_PERSISTENT = 90126; public static final int DATABASE_IS_NOT_PERSISTENT = 90126;
public static final int RESULT_SET_NOT_UPDATABLE = 90127;
public static SQLException addSQL(SQLException e, String sql) { public static SQLException addSQL(SQLException e, String sql) {
if(e.getMessage().indexOf("SQL")>=0) { if(e.getMessage().indexOf("SQL")>=0) {
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
42000=Syntax error in SQL statement {0} 42000=Syntax error in SQL statement {0}
42001=Syntax error in SQL statement {0}; expected {1} 42001=Syntax error in SQL statement {0}; expected {1}
42S01=Table {0} already exists 42S01=Table {0} already exists
42S02=Table {0} not found. 42S02=Table {0} not found
42S11=Index {0} already exists 42S11=Index {0} already exists
42S12=Index {0} not found 42S12=Index {0} not found
42S21=Duplicate column name {0} 42S21=Duplicate column name {0}
...@@ -147,6 +147,7 @@ ...@@ -147,6 +147,7 @@
90124=File not found: {0} 90124=File not found: {0}
90125=Invalid class, expected {0} but got {1} 90125=Invalid class, expected {0} but got {1}
90126=Database is not persistent 90126=Database is not persistent
90127=The result set is not updatable. The query must select all columns from a unique key. Only one table may be selected.
HY000=General error: {0} HY000=General error: {0}
HY004=Unknown data type: {0} HY004=Unknown data type: {0}
......
...@@ -96,7 +96,7 @@ public class Sequence extends SchemaObject { ...@@ -96,7 +96,7 @@ public class Sequence extends SchemaObject {
value = realValue; value = realValue;
} }
} }
s.commit(); s.commit(false);
} }
public void close() throws SQLException { public void close() throws SQLException {
......
...@@ -698,7 +698,7 @@ public class MetaTable extends Table { ...@@ -698,7 +698,7 @@ public class MetaTable extends Table {
add(rows, new String[]{"h2.clientTraceDirectory", Constants.CLIENT_TRACE_DIRECTORY}); add(rows, new String[]{"h2.clientTraceDirectory", Constants.CLIENT_TRACE_DIRECTORY});
add(rows, new String[]{"h2.scriptDirectory", Constants.SCRIPT_DIRECTORY}); add(rows, new String[]{"h2.scriptDirectory", Constants.SCRIPT_DIRECTORY});
add(rows, new String[]{"h2.maxFileRetry", "" + Constants.MAX_FILE_RETRY}); add(rows, new String[]{"h2.maxFileRetry", "" + Constants.MAX_FILE_RETRY});
add(rows, new String[]{"h2.lobAlwaysClose", "" + Constants.LOB_CLOSE_BETWEEN_READS}); add(rows, new String[]{"h2.lobCloseBetweenReads", "" + Constants.LOB_CLOSE_BETWEEN_READS});
break; break;
} }
case TYPE_INFO: { case TYPE_INFO: {
......
...@@ -94,7 +94,7 @@ public class Console implements ActionListener, MouseListener { ...@@ -94,7 +94,7 @@ public class Console implements ActionListener, MouseListener {
icon = Toolkit.getDefaultToolkit().createImage(imageData); icon = Toolkit.getDefaultToolkit().createImage(imageData);
} }
if(!createTrayIcon()) { if(!createTrayIcon()) {
showWindow(); showWindow(true);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
...@@ -127,9 +127,9 @@ public class Console implements ActionListener, MouseListener { ...@@ -127,9 +127,9 @@ public class Console implements ActionListener, MouseListener {
itemConsole.setFont(font); itemConsole.setFont(font);
menuConsole.add(itemConsole); menuConsole.add(itemConsole);
MenuItem itemStatus = new MenuItem("Status"); MenuItem itemStatus = new MenuItem("Status");
itemConsole.setActionCommand("status"); itemStatus.setActionCommand("status");
itemConsole.addActionListener(this); itemStatus.addActionListener(this);
itemConsole.setFont(font); itemStatus.setFont(font);
menuConsole.add(itemStatus); menuConsole.add(itemStatus);
MenuItem itemExit = new MenuItem("Exit"); MenuItem itemExit = new MenuItem("Exit");
itemExit.setFont(font); itemExit.setFont(font);
...@@ -163,11 +163,15 @@ public class Console implements ActionListener, MouseListener { ...@@ -163,11 +163,15 @@ public class Console implements ActionListener, MouseListener {
} }
} }
private void showWindow() { private void showWindow(final boolean exit) {
Frame frame = new Frame("H2 Console"); final Frame frame = new Frame("H2 Console");
frame.addWindowListener(new WindowAdapter() { frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) { public void windowClosing(WindowEvent we) {
System.exit(0); if(exit) {
System.exit(0);
} else {
frame.dispose();
}
} }
}); });
if(icon != null) { if(icon != null) {
...@@ -232,7 +236,7 @@ public class Console implements ActionListener, MouseListener { ...@@ -232,7 +236,7 @@ public class Console implements ActionListener, MouseListener {
} else if ("console".equals(command)) { } else if ("console".equals(command)) {
startBrowser(); startBrowser();
} else if ("status".equals(command)) { } else if ("status".equals(command)) {
showWindow(); showWindow(false);
} }
} }
......
...@@ -93,64 +93,12 @@ java -Xmx512m -Xrunhprof:cpu=samples,depth=8 org.h2.tools.RunScript -url jdbc:h2 ...@@ -93,64 +93,12 @@ java -Xmx512m -Xrunhprof:cpu=samples,depth=8 org.h2.tools.RunScript -url jdbc:h2
test.printSystem(); test.printSystem();
/* /*
create local temporary table a(id int) on commit drop; make sure INDEX_LOOKUP_NEW = is true by default.
select * from a; Test Console (batch, javaw, different platforms)
create local temporary table b(id int) on commit drop;
select * from a;
select * from b;
commit;
dropping session temp views doesn't work, why?
create table t1 (i int);
create table t2 (i int);
create table t3 (i int);
select a.i from t1 a inner join (select a.i from t2 a inner join (select i from t3) b on a.i=b.i) b on a.i=b.i;
SELECT A.I FROM T2 A INNER JOIN TEMP_VIEW_0 B WHERE (A.I = B.I) AND (A.I = 1)
create table t1 (i int);
create table t2 (i int);
create table t3 (i int);
select a.i
from t1 a
inner join (
select a.i
from t2 a
inner join (
select i
from t3) b on a.i=b.i
) b on a.i=b.i;
Wre es nicht besser, unabhngig von DB_CLOSE_DELAY eine Datenbank offen
zu halten, solange dafr offene PooledConnections vorhanden sind?
Change documentation and default database for H2 Console: jdbc:h2:~/test
public static final boolean INDEX_LOOKUP_NEW = getBooleanSetting("h2.indexLookupNew", false);
"com.mysql.jdbc.NotUpdatable: Result Set not updatable.This result set must come from a statement that was created with a result set type of ResultSet.CONCUR_UPDATABLE, the query must select only one table, and must select all primary keys from that table. See the JDBC 2.1 API Specification, section 5.6 for more details."
set new console to be the default (still support old)
set new index mechanism to be the default (still support old)
add test case:
create table test1(id int);
insert into test1 values(1);
insert into test1 values(1);
insert into test1 values(2);
insert into test1 values(3);
select sum(C0) from (
select count(*) AS C0 from (select distinct * from
test1) as temp
)
todo: challenge response authentication
h2 console system tray: menu item to open window backup.sql / lob file problem
Set h2.indexNew to false Change documentation and default database for H2 Console: jdbc:h2:~/test
testHalt testHalt
...@@ -173,8 +121,6 @@ MySQL, PostgreSQL ...@@ -173,8 +121,6 @@ MySQL, PostgreSQL
http://semmle.com/ http://semmle.com/
try out, find bugs try out, find bugs
Mail P2P
Currently there is no such feature, however it is quite simple to add a user defined function Currently there is no such feature, however it is quite simple to add a user defined function
READ_TEXT(fileName String) returning a CLOB. The performance would probably not be optimal, READ_TEXT(fileName String) returning a CLOB. The performance would probably not be optimal,
but it should work. I am not sure if this will read the CLOB in memory however. but it should work. I am not sure if this will read the CLOB in memory however.
...@@ -201,10 +147,6 @@ Automate real power off tests ...@@ -201,10 +147,6 @@ Automate real power off tests
how to make -baseDir work for H2 Console? how to make -baseDir work for H2 Console?
Maybe add a little bit AdSense
Custom Captcha for the forum, to protect against spam bots (required for Google Code?)
http://db.apache.org/ddlutils/ (write a H2 driver) http://db.apache.org/ddlutils/ (write a H2 driver)
Negative dictionary: Negative dictionary:
...@@ -212,14 +154,14 @@ Please note that ...@@ -212,14 +154,14 @@ Please note that
timer test timer test
PostgreSQL compatibility:
--SET search_path = public, pg_catalog;
--id serial NOT NULL,
CREATE [ TEMPORARY | TEMP ] SEQUENCE name [ INCREMENT [ BY ] increment ]
[ MINVALUE minvalue | NO MINVALUE ] [ MAXVALUE maxvalue | NO MAXVALUE ]
[ START [ WITH ] start ] [ CACHE cache ] [ [ NO ] CYCLE ]
support translated exceptions (english + translated) support translated exceptions (english + translated)
select * from H2.PUBLIC.ORDERS
Wre es nicht besser, unabhngig von DB_CLOSE_DELAY eine Datenbank offen
zu halten, solange dafr offene PooledConnections vorhanden sind?
*/ */
/* /*
......
--- special grammar and test cases --------------------------------------------------------------------------------------------- --- special grammar and test cases ---------------------------------------------------------------------------------------------
create table t1 (i int);
> ok
create table t2 (i int);
> ok
create table t3 (i int);
> ok
select a.i from t1 a inner join (select a.i from t2 a inner join (select i from t3) b on a.i=b.i) b on a.i=b.i;
> I
> -
> rows: 0
drop table t1, t2, t3;
> ok
create table d(d double, r real); create table d(d double, r real);
> ok > ok
......
create table test1(id int);
insert into test1 values(1), (1), (2), (3);
select sum(C0) from (select count(*) AS C0 from (select distinct * from test1) as temp);
> 3;
drop table test1;
create table test(id int primary key check id>1); create table test(id int primary key check id>1);
drop table test; drop table test;
create table table1(f1 int not null primary key); create table table1(f1 int not null primary key);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论