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:
[Test]
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>();
TestContext.WriteLine(statement);
Assert.Throws(Is.InstanceOf<Exception>(),
() => 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"
FROM "LRARICHIESTE"
While the expected should be:
SELECT 1 AS "Param", "COMMENTO" AS "Descr", 'ciao' AS "Str", '27/11/2018 14:06:44' AS "Date"
FROM "LRARICHIESTE"
Note that the some of the static values are missing their aliases.