SqlFunctionExprExtensions

Class to provide extension methods for the SqlFunctionExpr AST

CastArgument

Description

Creates a copy of the current SqlFunctionExpr with the argument at the given index casted to the given type.

public static SqlFunctionExpr CastArgument(
    this SqlFunctionExpr node, 
    int index,
    SqlDataType type);

Parameters

  1. node: The current SqlFunctionExpr.

  2. index: The index of the argument to cast.

  3. type: The type to use in the casting.

Returns

A new SqlFunctionExpr with the same name but with the specified argument casted.

CastArguments

Description

Creates a copy of the current SqlFunctionExpr with the arguments at the given indexes casted to the given types. Assumes indexes are within bounds of the argument list.

public static SqlFunctionExpr CastArguments(
    this SqlFunctionExpr node,
    int[] indexes,
    SqlDataType[] types);

Parameters

  1. node: The current SqlFunctionExpr.

  2. indexes: The array of indexes of arguments to cast.

  3. type: The array of types to cast each arguments.

Returns

A new SqlFunctionExpr with the same name but with arguments casted.

GetFunctionName

Description

Gets the name of the function as a string

public static string GetFunctionName(
    this SqlFunctionExpr node); 

Parameters

  1. node: The current SqlFunctionExpr.

Returns

The name of the function as a string

RemoveArguments

Description

Creates a copy of the current SqlFunctionExpr without the specified arguments.

public static SqlFunctionExpr RemoveArguments(
    this SqlFunctionExpr node,
    params int[] indexesToRemove);

Parameters

  1. node: The current SqlFunctionExpr.

  2. indexesToRemove: 0-based indexes of argument to remove.

Returns

A new SqlFunctionExpr without the specified arguments.

RenameFunction

public static SqlFunctionExpr RenameFunction(
    this SqlFunctionExpr node,
    string newFunctionName);

Description

Creates a new SqlFunctionExpr with the given new name. Keeps the same arguments.

Parameters

  1. node: The current SqlFunctionExpr.

  2. newFunctionName: The new name for the function

Returns

A new SqlFunctionExpr with the given new name.

Last updated