提交 16325f3d authored 作者: Thomas Mueller's avatar Thomas Mueller

MS SQL Server: the CONVERT method did not work in views and derrived tables.

上级 52e9d252
...@@ -20,7 +20,9 @@ Change Log ...@@ -20,7 +20,9 @@ Change Log
<h1>Change Log</h1> <h1>Change Log</h1>
<h2>Next Version (unreleased)</h2> <h2>Next Version (unreleased)</h2>
<ul><li>Java 8 compatibility for "regexp_replace". <ul><li>MS SQL Server: the CONVERT method did not work in views
and derrived tables.
</li><li>Java 8 compatibility for "regexp_replace".
</li></ul> </li></ul>
<h2>Version 1.4.187 Beta (2015-04-10)</h2> <h2>Version 1.4.187 Beta (2015-04-10)</h2>
......
...@@ -2479,9 +2479,15 @@ public class Function extends Expression implements FunctionCall { ...@@ -2479,9 +2479,15 @@ public class Function extends Expression implements FunctionCall {
break; break;
} }
case CONVERT: { case CONVERT: {
buff.append(args[0].getSQL()).append(','). if (database.getMode().swapConvertFunctionParameters) {
append(new Column(null, dataType, precision, buff.append(new Column(null, dataType, precision,
scale, displaySize).getCreateSQL()).
append(',').append(args[0].getSQL());
} else {
buff.append(args[0].getSQL()).append(',').
append(new Column(null, dataType, precision,
scale, displaySize).getCreateSQL()); scale, displaySize).getCreateSQL());
}
break; break;
} }
case EXTRACT: { case EXTRACT: {
......
...@@ -399,6 +399,10 @@ public class TestCompatibility extends TestBase { ...@@ -399,6 +399,10 @@ public class TestCompatibility extends TestBase {
rs.next(); rs.next();
assertEquals(10, rs.getInt(1)); assertEquals(10, rs.getInt(1));
rs.close(); rs.close();
rs = stat.executeQuery("SELECT X FROM (SELECT CONVERT(INT, '10') AS X)");
rs.next();
assertEquals(10, rs.getInt(1));
rs.close();
// make sure we're ignoring the index part of the statement // make sure we're ignoring the index part of the statement
rs = stat.executeQuery("select * from test (index table1_index)"); rs = stat.executeQuery("select * from test (index table1_index)");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论