HHH-9894 - Support Informix Boolean Type

This commit is contained in:
Greg Jones 2015-07-06 12:24:04 +10:00 committed by Vlad Mihalcea
parent e1f783ca39
commit 3ef05dea2f
2 changed files with 43 additions and 4 deletions

View File

@ -6,6 +6,10 @@
*/ */
package org.hibernate.dialect; package org.hibernate.dialect;
import java.sql.SQLException;
import java.sql.Types;
import java.util.Locale;
import org.hibernate.dialect.function.VarArgsSQLFunction; import org.hibernate.dialect.function.VarArgsSQLFunction;
import org.hibernate.dialect.identity.IdentityColumnSupport; import org.hibernate.dialect.identity.IdentityColumnSupport;
import org.hibernate.dialect.identity.InformixIdentityColumnSupport; import org.hibernate.dialect.identity.InformixIdentityColumnSupport;
@ -23,10 +27,6 @@ import org.hibernate.internal.util.JdbcExceptionHelper;
import org.hibernate.internal.util.StringHelper; import org.hibernate.internal.util.StringHelper;
import org.hibernate.type.StandardBasicTypes; import org.hibernate.type.StandardBasicTypes;
import java.sql.SQLException;
import java.sql.Types;
import java.util.Locale;
/** /**
* Informix dialect.<br> * Informix dialect.<br>
* <br> * <br>
@ -277,4 +277,9 @@ public class InformixDialect extends Dialect {
public IdentityColumnSupport getIdentityColumnSupport() { public IdentityColumnSupport getIdentityColumnSupport() {
return new InformixIdentityColumnSupport(); return new InformixIdentityColumnSupport();
} }
@Override
public String toBooleanValueString(boolean bool) {
return bool ? "'t'" : "'f'";
}
} }

View File

@ -0,0 +1,34 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.dialect;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseUnitTestCase;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
/**
* Testing of patched support for Informix boolean type; see HHH-9894
*
* @author Greg Jones
*/
@TestForIssue( jiraKey = "HHH-9894" )
public class InformixDialectTestCase extends BaseUnitTestCase {
private final InformixDialect dialect = new InformixDialect();
@Test
public void testToBooleanValueStringTrue() {
assertEquals( "'t'", dialect.toBooleanValueString( true ) );
}
@Test
public void testToBooleanValueStringFalse() {
assertEquals( "'f'", dialect.toBooleanValueString( false ) );
}
}