提交 8e75a3cb authored 作者: noelgrandin's avatar noelgrandin

Issue 274: Sybase/MSSQLServer compatibility - support index clause e.g. "select…

Issue 274: Sybase/MSSQLServer compatibility - support index clause e.g. "select * from test (index table1_index)"
上级 da652fde
......@@ -32,6 +32,7 @@ Change Log
</li><li>Fix Issue 305: Implement SELECT ... FOR FETCH ONLY
</li><li>Issue 274: Sybase/MSSQLServer compatibility - Add GETDATE and CHARINDEX system functions
</li><li>Issue 274: Sybase/MSSQLServer compatibility - swap parameters of CONVERT function.
</li><li>Issue 274: Sybase/MSSQLServer compatibility - support index clause e.g. "select * from test (index table1_index)"
</li></ul>
<h2>Version 1.3.171 (2013-03-17)</h2>
......
......@@ -1065,7 +1065,14 @@ public class Parser {
} else {
String tableName = readIdentifierWithSchema(null);
Schema schema = getSchema();
if (readIf("(")) {
boolean foundLeftBracket = readIf("(");
if (foundLeftBracket && readIf("INDEX")) {
// Sybase compatibility with "select * from test (index table1_index)"
readIdentifierWithSchema(null);
read(")");
foundLeftBracket = false;
}
if (foundLeftBracket) {
Schema mainSchema = database.getSchema(Constants.SCHEMA_MAIN);
if (equalsToken(tableName, RangeTable.NAME)) {
Expression min = readExpression();
......
......@@ -309,6 +309,10 @@ public class TestCompatibility extends TestBase {
rs.next();
assertEquals(10, rs.getInt(1));
rs.close();
// make sure we're ignoring the index part of the statement
rs = stat.executeQuery("select * from test (index table1_index)");
rs.close();
}
private void testDB2() throws SQLException {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论