System.Data.SQLite
Check-in [b999c9c818]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:In the LINQ assembly, when surrounding single quotes are required for a formatted DateTime value, be sure to escape contained single quotes.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | tkt-8d928c3e88
Files: files | file ages | folders
SHA1:b999c9c81852687b901d94c6163df8ab6ef39b23
User & Date: mistachkin 2015-01-13 03:39:10
Context
2015-01-13
04:08
Fix extra single quotes around the formatted DateTime values in the LINQ assembly. Use GetSettingValue to access the new environment variables. Closed-Leaf check-in: 45312da90e user: mistachkin tags: tkt-8d928c3e88
03:39
In the LINQ assembly, when surrounding single quotes are required for a formatted DateTime value, be sure to escape contained single quotes. check-in: b999c9c818 user: mistachkin tags: tkt-8d928c3e88
03:34
Merge updates from trunk. check-in: a15efc1fd5 user: mistachkin tags: tkt-8d928c3e88
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to System.Data.SQLite.Linq/SQL Generation/SqlGenerator.cs.

885
886
887
888
889
890
891
892
893
894
895
896
897
898
899

900


901




902
903
904
905
906
907
908
          case PrimitiveTypeKind.Byte:
            result.Append(e.Value.ToString());
            break;

          case PrimitiveTypeKind.DateTime:
            bool needQuotes = NeedSingleQuotes(_manifest._dateTimeFormat);

            if (needQuotes)
                result.Append("\'");

            result.Append(SQLiteConvert.ToString(
                (System.DateTime)e.Value, _manifest._dateTimeFormat,
                _manifest._dateTimeKind, _manifest._dateTimeFormatString));

            if (needQuotes)

                result.Append("\'");







            break;

          case PrimitiveTypeKind.Decimal:
            string strDecimal = ((Decimal)e.Value).ToString(CultureInfo.InvariantCulture);
            // if the decimal value has no decimal part, cast as decimal to preserve type
            // if the number has precision > int64 max precision, it will be handled as decimal by sql server
            // and does not need cast. if precision is lest then 20, then cast using Max(literal precision, sql default precision)







<
<
<
|

|


>

>
>
|
>
>
>
>







885
886
887
888
889
890
891



892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
          case PrimitiveTypeKind.Byte:
            result.Append(e.Value.ToString());
            break;

          case PrimitiveTypeKind.DateTime:
            bool needQuotes = NeedSingleQuotes(_manifest._dateTimeFormat);




            string dateString = SQLiteConvert.ToString(
                (System.DateTime)e.Value, _manifest._dateTimeFormat,
                _manifest._dateTimeKind, _manifest._dateTimeFormatString);

            if (needQuotes)
            {
                result.Append("\'");
                result.Append(EscapeSingleQuote(dateString, false /* IsUnicode */));
                result.Append("\'");
            }
            else
            {
                result.Append(dateString);
            }
            break;

          case PrimitiveTypeKind.Decimal:
            string strDecimal = ((Decimal)e.Value).ToString(CultureInfo.InvariantCulture);
            // if the decimal value has no decimal part, cast as decimal to preserve type
            // if the number has precision > int64 max precision, it will be handled as decimal by sql server
            // and does not need cast. if precision is lest then 20, then cast using Max(literal precision, sql default precision)