Fix index creation for MySQL.
This commit is contained in:
@@ -545,9 +545,7 @@ public abstract class BuildVisitor implements ExpressionVisitor
|
|||||||
}
|
}
|
||||||
comma = true;
|
comma = true;
|
||||||
|
|
||||||
_builder.append("(");
|
appendIndexComponent(field.left);
|
||||||
field.left.accept(this);
|
|
||||||
_builder.append(")");
|
|
||||||
if (field.right == Order.DESC) {
|
if (field.right == Order.DESC) {
|
||||||
// ascending is default, print nothing unless explicitly descending
|
// ascending is default, print nothing unless explicitly descending
|
||||||
_builder.append(" desc");
|
_builder.append(" desc");
|
||||||
@@ -704,6 +702,15 @@ public abstract class BuildVisitor implements ExpressionVisitor
|
|||||||
"Persistent field has no definition [class=" + type + ", field=" + field + "]");
|
"Persistent field has no definition [class=" + type + ", field=" + field + "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// output one of potentially many fields in an index expression
|
||||||
|
protected void appendIndexComponent (SQLExpression expression)
|
||||||
|
{
|
||||||
|
// the standard builder wraps each field in its own parens
|
||||||
|
_builder.append("(");
|
||||||
|
expression.accept(this);
|
||||||
|
_builder.append(")");
|
||||||
|
}
|
||||||
|
|
||||||
protected BuildVisitor (DepotTypes types)
|
protected BuildVisitor (DepotTypes types)
|
||||||
{
|
{
|
||||||
_types = types;
|
_types = types;
|
||||||
|
|||||||
@@ -140,6 +140,13 @@ public class MySQLBuilder
|
|||||||
_builder.append(field);
|
_builder.append(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void appendIndexComponent (SQLExpression expression)
|
||||||
|
{
|
||||||
|
// MySQL is never given complex expressions and hates parens, so just recurse
|
||||||
|
expression.accept(this);
|
||||||
|
}
|
||||||
|
|
||||||
protected void renderMatch (FullText fullText)
|
protected void renderMatch (FullText fullText)
|
||||||
{
|
{
|
||||||
_builder.append("match(");
|
_builder.append("match(");
|
||||||
|
|||||||
Reference in New Issue
Block a user