Skip to content

Commit

Permalink
0004964: Sybase: change trigger to be more efficient and to allow use of
Browse files Browse the repository at this point in the history
tx_id_expression in sym_trigger
  • Loading branch information
Philip Marzullo committed Apr 28, 2021
1 parent b1e9a1f commit c450f5e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
Expand Up @@ -214,7 +214,7 @@ public boolean supportsTransactionId() {

@Override
public boolean isTransactionIdOverrideSupported() {
return false;
return true;
}

public void cleanDatabase() {
Expand Down
Expand Up @@ -63,14 +63,13 @@ public AseTriggerTemplate(ISymmetricDialect symmetricDialect) {
"create trigger $(triggerName) on $(schemaName)$(tableName) for insert " + getOrderClause() + " as\n" +
" begin \n" +
" set nocount on \n" +
" declare @clientapplname varchar(50) \n" +
" select @clientapplname = clientapplname from master.dbo.sysprocesses where spid = @@spid \n" +
" declare @txid varchar(50) \n" +
" if (@@TRANCOUNT > 0) begin \n" +
" select @txid = $(txIdExpression) \n" +
" end \n" +
" declare @clientapplname varchar(50) \n" +
" declare @clientname varchar(50) \n" +
" select @clientname = clientname from master.dbo.sysprocesses where spid = @@spid and clientapplname = 'SymmetricDS' \n" +
" select @clientapplname = clientapplname, @clientname = case when clientapplname = 'SymmetricDS' then clientname else null end from master.dbo.sysprocesses where spid = @@spid \n" +
" declare @DataRow varchar(16384) \n" +
" declare @ChannelId varchar(128) \n" +
" $(declareNewKeyVariables) \n" +
Expand Down Expand Up @@ -106,15 +105,14 @@ public AseTriggerTemplate(ISymmetricDialect symmetricDialect) {
" declare @DataRow varchar(16384) \n" +
" declare @OldPk varchar(2000) \n" +
" declare @OldDataRow varchar(16384) \n" +
" declare @clientapplname varchar(50) \n" +
" declare @ChannelId varchar(128) \n" +
" select @clientapplname = clientapplname from master.dbo.sysprocesses where spid = @@spid \n" +
" declare @txid varchar(50) \n" +
" if (@@TRANCOUNT > 0) begin \n" +
" select @txid = $(txIdExpression) \n" +
" end \n" +
" declare @clientapplname varchar(50) \n" +
" declare @clientname varchar(50) \n" +
" select @clientname = clientname from master.dbo.sysprocesses where spid = @@spid and clientapplname = 'SymmetricDS' \n" +
" select @clientapplname = clientapplname, @clientname = case when clientapplname = 'SymmetricDS' then clientname else null end from master.dbo.sysprocesses where spid = @@spid \n" +
" $(declareOldKeyVariables) \n" +
" $(declareNewKeyVariables) \n" +
" $(custom_before_update_text) \n" +
Expand Down Expand Up @@ -147,10 +145,9 @@ public AseTriggerTemplate(ISymmetricDialect symmetricDialect) {
" declare @DataRow varchar(16384) \n" +
" declare @OldPk varchar(2000) \n" +
" declare @OldDataRow varchar(16384) \n" +
" declare @clientapplname varchar(50) \n" +
" select @clientapplname = clientapplname from master.dbo.sysprocesses where spid = @@spid \n" +
" declare @clientname varchar(50) \n" +
" select @clientname = clientname from master.dbo.sysprocesses where spid = @@spid and clientapplname = 'SymmetricDS' \n" +
" declare @clientapplname varchar(50) \n" +
" declare @clientname varchar(50) \n" +
" select @clientapplname = clientapplname, @clientname = case when clientapplname = 'SymmetricDS' then clientname else null end from master.dbo.sysprocesses where spid = @@spid \n" +
" declare @ChannelId varchar(128) \n" +
" $(declareOldKeyVariables) \n" +
" $(declareNewKeyVariables) \n" +
Expand Down Expand Up @@ -197,15 +194,14 @@ public AseTriggerTemplate(ISymmetricDialect symmetricDialect) {
" set nocount on \n" +
" declare @OldPk varchar(2000) \n" +
" declare @OldDataRow varchar(16384) \n" +
" declare @clientapplname varchar(50) \n" +
" declare @ChannelId varchar(128) \n" +
" select @clientapplname = clientapplname from master.dbo.sysprocesses where spid = @@spid \n" +
" declare @txid varchar(50) \n" +
" if (@@TRANCOUNT > 0) begin \n" +
" select @txid = $(txIdExpression) \n" +
" end \n" +
" declare @clientapplname varchar(50) \n" +
" declare @clientname varchar(50) \n" +
" select @clientname = clientname from master.dbo.sysprocesses where spid = @@spid and clientapplname = 'SymmetricDS' \n" +
" select @clientapplname = clientapplname, @clientname = case when clientapplname = 'SymmetricDS' then clientname else null end from master.dbo.sysprocesses where spid = @@spid \n" +
" $(declareOldKeyVariables) \n" +
" $(custom_before_delete_text) \n" +
" if ($(syncOnIncomingBatchCondition)) begin \n" +
Expand Down

0 comments on commit c450f5e

Please sign in to comment.