Unicode in MSSQL

Consider mssql database, table XXX with column AAA of type nvarchar(255). Lets take following changeSet fragment:

  1.      
Liquibase will translate this to something like:

  1. update XXX set AAA = ‘zaźółć gęślą jaźń’;
And you could expect that this exact string will be stored in the database, right?

Wrong.

Mssql will assume non-unicode string and you will end up with ‘zazólc gesla jazn’ in DB.
The correct SQL is:
  1. update XXX set AAA = N’zaźółć gęślą jaźń’;
with capital N before string. The problem is… I can’t see any support in Liquibase for that. Any idea?

(It’s version 2.0.3 BTW)

I can see that real string quoting is done manually in several places via something like:

  1. if (newValue instanceof String && database.shouldQuoteValue(((String) newValue))) {
  2.       sqlString = “’” + newValue + “’”;
  3. }
I think we could fix this by extracting it to AbstractDatabase function and MssqDatabasel would add extra “N”. What do you think about this, Nathan?