Skip to content

Commit

Permalink
0004874: SQL Server and Sybase dialects should make sure that SET
Browse files Browse the repository at this point in the history
NOCOUNT OFF is set on each database connection
  • Loading branch information
catherinequamme committed Oct 24, 2022
1 parent ab45670 commit ef781be
Showing 1 changed file with 11 additions and 0 deletions.
Expand Up @@ -63,11 +63,22 @@
public class MsSqlSymmetricDialect extends AbstractSymmetricDialect implements ISymmetricDialect {
static final protected String SQL_DROP_FUNCTION = "drop function dbo.$(functionName)";
static final protected String SQL_FUNCTION_INSTALLED = "select count(object_name(object_id('$(functionName)')))";
static final String SQL_NOCOUNT = "select @@OPTIONS & 512";
protected Boolean supportsDisableTriggers = null;
protected int noCount = 0;

public MsSqlSymmetricDialect(IParameterService parameterService, IDatabasePlatform platform) {
super(parameterService, platform);
this.triggerTemplate = new MsSqlTriggerTemplate(this);
try {
noCount = platform.getSqlTemplate().queryForInt(SQL_NOCOUNT);
} catch (Exception se) {
log.warn("Unable to query nocount", se);
}
if (noCount != 0) {
throw new SymmetricException("Incompatible setting for nocount detected. Add the following to your\r\n"
+ "engine properties file: db.init.sql=set no count off");
}
}

@Override
Expand Down

0 comments on commit ef781be

Please sign in to comment.