Table of Contents

Class QueryText

Namespace
Rinku.Querying
Assembly
Rinku.dll

Renders a query template for one run. Use Parse(object?[]) to inspect the SQL that a set of values produces without running a command.

public abstract class QueryText : IQueryText
Inheritance
QueryText
Implements
Inherited Members
Extension Methods

Fields

Conditions

Gets the optional parts and their controlling keys.

public readonly Condition[] Conditions

Field Value

Condition[]

QueryString

Gets the template with conditional markers removed.

public readonly string QueryString

Field Value

string

RequiredVariablesLength

The number of key slots a run's values array must carry, checked by Parse(object?[]).

public readonly int RequiredVariablesLength

Field Value

int

Segments

Gets the literal text and handler parts of the template.

public readonly QuerySegment[] Segments

Field Value

QuerySegment[]

Properties

HandlerValuesLength

How many slots Parse(Span<bool>, ReadOnlySpan<object?>) reads values from.

public int HandlerValuesLength { get; }

Property Value

int

Methods

IsInCondition(int)

Whether a key controls any optional part of the template.

public bool IsInCondition(int varIndex)

Parameters

varIndex int

Returns

bool

Parse(object?[])

The SQL for one run, taking the values from an array. A part stays when its key has a value and drops when it does not. When nothing is optional the original template is returned untouched.

public abstract string Parse(object?[] variables)

Parameters

variables object[]

The values for this run, one slot per key.

Returns

string

The rendered SQL, or the original template when no part was dropped.

Exceptions

RequiredHandlerValueException

A required handler spot had no value.

Parse(Span<bool>, ReadOnlySpan<object?>)

The SQL for one run, taking which keys are present from usageMap and the values the handler spots render from handlerValues.

public abstract string Parse(Span<bool> usageMap, ReadOnlySpan<object?> handlerValues)

Parameters

usageMap Span<bool>

Which keys are present this run.

handlerValues ReadOnlySpan<object>

One slot per handled key, in key order from the first handled one, holding the value the binding pass left. Empty for a template with no handler, which needs no values at all.

Returns

string

The rendered SQL, or the original template when no part was dropped.

Exceptions

RequiredHandlerValueException

A required handler spot had no value.