Skip to content

Commit

Permalink
MONDRIAN: Patch for Ingres, contributed by Andy Grimm.
Browse files Browse the repository at this point in the history
[git-p4: depot-paths = "//open/mondrian/": change = 8788]
  • Loading branch information
julianhyde committed Feb 26, 2007
1 parent 7ece54c commit 4e8ccbd
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 23 deletions.
44 changes: 22 additions & 22 deletions src/main/mondrian/rolap/sql/SqlQuery.java
Expand Up @@ -77,28 +77,27 @@
* @author jhyde
* @version $Id$
*/
public class SqlQuery
{
/** This static variable controls the formatting of the sql string. */
public class SqlQuery {
/** Controls the formatting of the sql string. */
private static boolean generateFormattedSql =
MondrianProperties.instance().GenerateFormattedSql.get();
MondrianProperties.instance().GenerateFormattedSql.get();

static {
// Trigger is used to lookup and change the value of the
// variable that controls formatting.
// Using a trigger means we don't have to look up the property eveytime.
MondrianProperties.instance().GenerateFormattedSql.addTrigger(
new Trigger() {
public boolean isPersistent() {
return true;
}
public int phase() {
return Trigger.PRIMARY_PHASE;
}
public void execute(Property property, String value) {
generateFormattedSql = property.booleanValue();
}
new Trigger() {
public boolean isPersistent() {
return true;
}
public int phase() {
return Trigger.PRIMARY_PHASE;
}
public void execute(Property property, String value) {
generateFormattedSql = property.booleanValue();
}
}
);
}

Expand Down Expand Up @@ -1125,26 +1124,27 @@ public String generateInline(
List<String[]> valueList) {
if (isOracle()) {
return generateInlineGeneric(
columnNames, columnTypes, valueList,
"from dual");
columnNames, columnTypes, valueList,
"from dual");
} else if (isAccess()) {
// Fall back to using the FoodMart 'days' table, because
// Access SQL has no way to generate values not from a table.
return generateInlineGeneric(
columnNames, columnTypes, valueList,
"from [days] where [day] = 1");
} else if (isMySQL()) {
columnNames, columnTypes, valueList,
"from [days] where [day] = 1");
} else if (isMySQL() || isIngres()) {
return generateInlineGeneric(
columnNames, columnTypes, valueList, null);
} else if (isLucidDB()) {
// TODO jvs 26-Nov-2006: Eliminate this once LucidDB
// can support applying column names to a VALUES clause
// (needed by generateInlineForAnsi).
return generateInlineGeneric(
columnNames, columnTypes, valueList,
" from (values(0))");
columnNames, columnTypes, valueList,
" from (values(0))");
} else {
return generateInlineForAnsi("t", columnNames, columnTypes, valueList);
return generateInlineForAnsi(
"t", columnNames, columnTypes, valueList);
}
}

Expand Down
4 changes: 4 additions & 0 deletions testsrc/main/mondrian/test/TestContext.java
Expand Up @@ -836,6 +836,10 @@ public void assertSqlEquals(String expectedSql, String actualSql) {
expectedSql = expectedSql.replaceAll(
search,
"`customer`.`fullname`");
} else if (dialect.isIngres()) {
expectedSql = expectedSql.replaceAll(
search,
"fullname");
} else if (dialect.isDB2()) {
expectedSql = expectedSql.replaceAll(
search,
Expand Down
Expand Up @@ -2034,6 +2034,8 @@ String toPhysical(SqlQuery.Dialect dialect) {
if (this == Date) {
if (dialect.isMSSQL()) {
return "DATETIME";
} else if (dialect.isIngres()) {
return "INGRESDATE";
} else {
return name;
}
Expand All @@ -2043,7 +2045,7 @@ String toPhysical(SqlQuery.Dialect dialect) {
dialect.isMySQL()) {
return "DATETIME";
} else if (dialect.isIngres()) {
return "DATE";
return "INGRESDATE";
} else {
return name;
}
Expand Down

0 comments on commit 4e8ccbd

Please sign in to comment.