sdk/dotnet/src/Microsoft.Datasync.Client.SQLiteStore/Utils/SqlQueryFormatter.cs
/// <summary>
/// The CEILING function is not available in the SQLitePCL.raw package we use for SQLite
/// access (because it is needs to be compiled in), so we need to use a workaround.
/// </summary>
/// <remarks>
/// The conversion for ceil is <c>(CAST(x as INT) + (x > CAST(x as INT)))</c>
/// </remarks>
/// <param name="node">The node being processed.</param>
/// <returns>The processed node.</returns>
The CEILING function is not available in the SQLitePCL.raw package we use for SQLite
access (because it is needs to be compiled in), so we need to use a workaround.
The CEILING function is not available in the SQLitePCL . raw package we use for SQLite access ( because it is needs to be compiled in ) so we need to use a workaround .
private QueryNode FormatCeilingFunction(FunctionCallNode node)
        {
            var castToInt = new ConvertNode(node.Arguments[0], typeof(int));
            var comparison = new BinaryOperatorNode(BinaryOperatorKind.GreaterThan, node.Arguments[0], new ConvertNode(node.Arguments[0], typeof(int)));
            var ceiling = new BinaryOperatorNode(BinaryOperatorKind.Add, castToInt, comparison);
            ceiling.Accept(this);
            return node;
        }
private QueryNode FormatCeilingFunction ( FunctionCallNode node ) { var castToInt = new ConvertNode ( node . Arguments [ 0 ] , typeof ( int ) ) ; var comparison = new BinaryOperatorNode ( BinaryOperatorKind . GreaterThan , node . Arguments [ 0 ] , new ConvertNode ( node . Arguments [ 0 ] , typeof ( int ) ) ) ; var ceiling = new BinaryOperatorNode ( BinaryOperatorKind . Add , castToInt , comparison ) ; ceiling . Accept ( this ) ; return node ; }
The CEILING function is not available in the SQLitePCL.raw package we use for SQLite
access (because it is needs to be compiled in), so we need to use a workaround.
The CEILING function is not available in the SQLitePCL . raw package we use for SQLite access ( because it is needs to be compiled in ) so we need to use a workaround .
The processed node.
The processed node .
node
FunctionCallNode
The node being processed.
The node being processed .
remarks
The conversion for ceil is (CAST(x as INT) + (x > CAST(x as INT)))
The conversion for ceil is ( CAST ( x as INT ) + ( x > CAST ( x as INT )))