Defect #12693

MSSQL column quotations

Added by Martin Valensky almost 5 years ago. Updated almost 5 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Database
Target version:-
Resolution:Fixed Affected version:2.1.4

Description

If I create new role the workflows are copied. The problem is in SQL query because no quotation is used for column names and in MSSQL the RULE and TYPE are reserved words. So I suggest to use quotation on every column according to SQL defintion.
I have had to modify the worflow_rule.rb like this:

delete_all :tracker_id => target_tracker.id, :role_id => target_role.id
        connection.insert "INSERT INTO #{WorkflowRule.table_name} (tracker_id, role_id, old_status_id, new_status_id, author, assignee, field_name, [rule], [type])" +
                          " SELECT #{target_tracker.id}, #{target_role.id}, old_status_id, new_status_id, author, assignee, field_name, [rule], [type]" +
                          " FROM #{WorkflowRule.table_name}" +
                          " WHERE tracker_id = #{source_tracker.id} AND role_id = #{source_role.id}" 

I have used square brackets but you can use double quotations accoring to SQL definition.
I'm running 2.2.0


Related issues

Related to Redmine - Feature #12713: Microsoft SQLServer support Closed

History

#1 Updated by Jean-Philippe Lang almost 5 years ago

  • Status changed from New to Closed
  • Resolution set to Wont fix

I'm closing it, MSSQL is not supported.

#2 Updated by Jean-Philippe Lang almost 5 years ago

[column] is MSSQL specific. I think that #quote_column_name should be used instead.

#3 Updated by Jean-Philippe Lang almost 5 years ago

  • Resolution changed from Wont fix to Fixed

Fixed in r11099, see #12713.

Also available in: Atom PDF