Using any string or DateTime constant in a SelectList, leads to syntax error

As title, if I specify a non-numeric constant field or a value generated before executing the query (like DateTime.Now), OrmLite does not quote those kind of values leading to a syntax error.

Here is a NUnit Test that shows the issue:

public void Check_SelectInto()
    var q = Db.From<LRARichiesta>()
        .Select(t => new
            Param = 1,
            Descr = t.Commento,
            Str = "ciao",
            Date = DateTime.UtcNow

    var statement = q.SelectInto<object>();


        () => Db.Select(q));

The test complete with success, and the output is the following:

SELECT 1, "COMMENTO" AS "Descr", ciao, 27/11/2018 14:06:44 AS "Date" 

While the expected should be:

SELECT 1 AS "Param", "COMMENTO" AS "Descr", 'ciao' AS "Str", '27/11/2018 14:06:44' AS "Date" 

Note that the some of the static values are missing their aliases.

This should now be resolved from this commit.

This change is available from v5.4.1 that’s now available on MyGet.