Hi!
I have implemented MySQL USE clause support and created a corresponding
patch.
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.
### Eclipse Workspace Patch 1.0
#P h2
Index: src/docsrc/help/help.csv
===================================================================
--- src/docsrc/help/help.csv (revision 4116)
+++ src/docsrc/help/help.csv (working copy)
@@ -1401,7 +1401,7 @@
"
"Commands (Other)","SET SCHEMA","
-SET SCHEMA schemaName
+{ SET SCHEMA | USE } schemaName
","
Changes the default schema of the current connection. The default schema is
used
in statements where no schema is set explicitly. The default schema for new
Index: src/test/org/h2/test/test-1.3.txt
===================================================================
--- src/test/org/h2/test/test-1.3.txt (revision 4118)
+++ src/test/org/h2/test/test-1.3.txt (working copy)
@@ -9908,3 +9908,23 @@
drop table word;
> ok
+create schema test_schema;
+> ok
+
+use test_schema;
+> ok
+
+create sequence test_sequence;
+> ok
+
+SELECT SEQUENCE_NAME, SEQUENCE_SCHEMA FROM INFORMATION_SCHEMA.SEQUENCES WHERE
SEQUENCE_NAME = 'TEST_SEQUENCE' AND SEQUENCE_SCHEMA = 'TEST_SCHEMA';
+> SEQUENCE_NAME SEQUENCE_SCHEMA
+> ------------- ---------------
+> TEST_SEQUENCE TEST_SCHEMA
+> rows: 1
+
+drop sequence test_sequence;
+> ok
+
+drop schema test_schema;
+> ok
\ No newline at end of file
Index: src/main/org/h2/command/Parser.java
===================================================================
--- src/main/org/h2/command/Parser.java (revision 4118)
+++ src/main/org/h2/command/Parser.java (working copy)
@@ -425,6 +425,8 @@
case 'U':
if (readIf("UPDATE")) {
c = parseUpdate();
+ } else if (readIf("USE")) {
+ c = parseUse();
}
break;
case 'v':
@@ -705,6 +707,13 @@
return command;
}
+ private Set parseUse() {
+ readIf("=");
+ Set command = new Set(session, SetTypes.SCHEMA);
+ command.setString(readAliasIdentifier());
+ return command;
+ }
+
private TableFilter readSimpleTableFilter() {
Table table = readTableOrView();
String alias = null;