Class MsSqlDialect

Namespace: redb.MSSql.Sql
Assembly: redb.MSSql.dll

MS SQL Server implementation of ISqlDialect.
Uses SQL Server 2016+ features (JSON, STRING_SPLIT, sequences).
Parameters use , format (converted from $1, $2 in SqlRedbConnection).

public class MsSqlDialect : ISqlDialect

Inheritance

Object→MsSqlDialect

Implements

Derived

Properties

ProviderName

Provider name (PostgreSQL, SqlServer, MySql)

public string ProviderName { get; }

Methods

FoldCase(string)

Returns the expression unchanged, and unlike SQLite this is not a gap being papered over.

public string FoldCase(string expression)

FormatArrayContains(string, string)

MSSQL uses IN with STRING_SPLIT for array containment.

public string FormatArrayContains(string column, string paramName)

FormatCaseInsensitiveLike(string, string)

Case-insensitive LIKE: ILIKE for PostgreSQL, LIKE for MSSQL (CI collation)

public string FormatCaseInsensitiveLike(string column, string parameter)

FormatDateTimeLiteral(DateTime)

Format DateTime as SQL literal. PostgreSQL: '...'::timestamptz, MSSQL: '...' (parsed natively)

public string FormatDateTimeLiteral(DateTime dt)

FormatDateTimeOffsetLiteral(DateTimeOffset)

Format DateTimeOffset as SQL literal. PostgreSQL: '...'::timestamptz, MSSQL: '...' (parsed natively)

public string FormatDateTimeOffsetLiteral(DateTimeOffset dto)

FormatPagination(int?, int?)

MSSQL pagination: OFFSET n ROWS FETCH NEXT m ROWS ONLY.

public string FormatPagination(int? limit, int? offset)

FormatParameter(int)

MSSQL parameter format (, , etc.).

public string FormatParameter(int index)

FormatPvtColumn(long, string, string)

PVT via subquery with TOP 1 (MSSQL doesn't have array_agg FILTER).

public string FormatPvtColumn(long structureId, string dbColumn, string alias)

GetDbTypeName(string)

Mapping of redb types to SQL types

public string GetDbTypeName(string redbType)

LazyLoader_GetObjectJson()

Get object as JSON via get_object_json. Params: $1=objectId, $2=maxDepth

public string LazyLoader_GetObjectJson()

LazyLoader_GetObjectJsonBatch()

Batch load Props JSON for multiple objects. Uses function call directly in SELECT.

public string LazyLoader_GetObjectJsonBatch()

LazyLoader_SelectObjectBase()

Get object base fields (without Props). Params: $1=objectId

public string LazyLoader_SelectObjectBase()

LazyLoader_SelectObjectHash()

Get object hash for cache validation. Params: $1=objectId

public string LazyLoader_SelectObjectHash()

ListItems_Delete()

DELETE list item by ID. Params: $1=itemId

public string ListItems_Delete()

ListItems_Insert()

INSERT list item. Params: $1=id, $2=idList, $3=value, $4=alias, $5=idObject

public string ListItems_Insert()

ListItems_SelectById()

SELECT list item by ID. Params: $1=itemId

public string ListItems_SelectById()

ListItems_SelectByIds()

SELECT list items by their ids. Params: $1=itemIds (long[])

public string ListItems_SelectByIds()

ListItems_SelectByListId()

SELECT list items by list ID. Params: $1=listId

public string ListItems_SelectByListId()

ListItems_SelectByListIdAndValue()

SELECT list item by list ID and value. Params: $1=listId, $2=value

public string ListItems_SelectByListIdAndValue()

ListItems_SelectByObjectId()

SELECT list items by object reference. Params: $1=objectId

public string ListItems_SelectByObjectId()

ListItems_Update()

UPDATE list item. Params: $1=value, $2=alias, $3=idObject, $4=id

public string ListItems_Update()

ListItems_UpdateAliasAndObject()

UPDATE list item alias and idObject. Params: $1=alias, $2=idObject, $3=id

public string ListItems_UpdateAliasAndObject()

Lists_Delete()

DELETE list by ID. Params: $1=listId

public string Lists_Delete()

Lists_Insert()

INSERT new list. Params: $1=id, $2=name, $3=alias

public string Lists_Insert()

Lists_IsUsedInStructures()

Check if list is used in structures. Params: $1=listId

public string Lists_IsUsedInStructures()

Lists_SelectAll()

SELECT all lists ordered by name.

public string Lists_SelectAll()

Lists_SelectById()

SELECT list by ID. Params: $1=listId

public string Lists_SelectById()

Lists_SelectByName()

SELECT list by name. Params: $1=name

public string Lists_SelectByName()

Lists_Update()

UPDATE list. Params: $1=name, $2=alias, $3=id

public string Lists_Update()

Maintenance_Analyze(int)

Refresh planner statistics. analysisLimit bounds SQLite's ANALYZE

public string Maintenance_Analyze(int analysisLimit)

Maintenance_AnalyzeTable(string?, string, int)

Refresh planner statistics of ONE table. The identifier arrives already checked against

public string Maintenance_AnalyzeTable(string? schema, string table, int analysisLimit)

Maintenance_SelectIndexStats()

Index statistics of user tables, normalized to the alias contract above.

public string Maintenance_SelectIndexStats()

Maintenance_SelectIndexStatsNoSize()

Fallback form for engines where the full form may be unavailable: SQLite without the dbstat

public string Maintenance_SelectIndexStatsNoSize()

Maintenance_SelectStatisticsWindow()

The window the usage counters cover: aliases CountersSince and IsReplica, both null where

public string Maintenance_SelectStatisticsWindow()

Maintenance_SelectTableExists()

Does the table exist? Params: table name, then schema (null = the engine's default).

public string Maintenance_SelectTableExists()

Maintenance_SelectTableStats()

Table statistics, normalized to the TableStatistics alias contract: Schema, Table,

public string Maintenance_SelectTableStats()

Maintenance_SelectTableStatsForms()

The table-stats forms in decreasing capability, tried in order until one runs. SQLite needs

public IReadOnlyList<string> Maintenance_SelectTableStatsForms()

ObjectStorage_CheckObjectExists()

Check if object exists by ID. Params: $1=objectId

public string ObjectStorage_CheckObjectExists()

ObjectStorage_ClearValueUniqueByIds(IEnumerable<long>)

UPDATE the listed objects to _value_unique = NULL (P7: release before take inside the batch

public string ObjectStorage_ClearValueUniqueByIds(IEnumerable<long> ids)

ObjectStorage_DeleteById()

DELETE object by ID. Params: $1=objectId

public string ObjectStorage_DeleteById()

ObjectStorage_DeleteByIds()

DELETE objects by IDs (bulk). Params: $1=objectIds (array)

public string ObjectStorage_DeleteByIds()

ObjectStorage_DeleteValuesByObjectId()

DELETE all values for object. Params: $1=objectId

public string ObjectStorage_DeleteValuesByObjectId()

ObjectStorage_GetObjectJson()

SELECT object as JSON. Params: $1=objectId, $2=depth

public string ObjectStorage_GetObjectJson()

ObjectStorage_GetObjectsJsonBulk()

Bulk get object JSON. Uses function call directly in SELECT.

public string ObjectStorage_GetObjectsJsonBulk()

ObjectStorage_InsertObject()

INSERT new object with all fields.

public string ObjectStorage_InsertObject()

ObjectStorage_LockObjectsForUpdate()

Lock objects for update (row locking) and RETURN THE LOCKED IDS. Params: $1=objectIds (array)

public string ObjectStorage_LockObjectsForUpdate()

ObjectStorage_SelectAllTypes()

SELECT all types (for cache preload). No params.

public string ObjectStorage_SelectAllTypes()

ObjectStorage_SelectExistingCreateDates()

SELECT id + stored creation date of existing objects. Params: $1=objectIds (array).

public string ObjectStorage_SelectExistingCreateDates()

ObjectStorage_SelectExistingIds()

SELECT existing object IDs from array. Params: $1=objectIds (array)

public string ObjectStorage_SelectExistingIds()

ObjectStorage_SelectIdBySchemeValueUnique()

SELECT _id of the object holding a unique key in a scheme. Params: $1=schemeId, $2=valueUnique.

public string ObjectStorage_SelectIdBySchemeValueUnique()

ObjectStorage_SelectIdHash()

SELECT only Id and Hash for object. Params: $1=objectId

public string ObjectStorage_SelectIdHash()

ObjectStorage_SelectIdHashPairs()

SELECT id + persisted content hash of existing objects. Params: $1=objectIds (array).

public string ObjectStorage_SelectIdHashPairs()

ObjectStorage_SelectIdHashScheme()

SELECT Id, Hash, IdScheme for cache check. Params: $1=objectId

public string ObjectStorage_SelectIdHashScheme()

ObjectStorage_SelectObjectById()

SELECT all base fields for object by ID. Params: $1=objectId

public string ObjectStorage_SelectObjectById()

ObjectStorage_SelectObjectsByIds()

SELECT all base fields for objects by IDs. Params: $1=objectIds (array)

public string ObjectStorage_SelectObjectsByIds()

ObjectStorage_SelectSchemeById()

SELECT scheme by ID. Params: $1=schemeId

public string ObjectStorage_SelectSchemeById()

ObjectStorage_SelectSchemeIdByObjectId()

SELECT scheme ID for object. Params: $1=objectId

public string ObjectStorage_SelectSchemeIdByObjectId()

ObjectStorage_SelectSchemeIdsForObjects()

SELECT scheme IDs for objects. Params: $1=objectIds (array)

public string ObjectStorage_SelectSchemeIdsForObjects()

ObjectStorage_SelectSchemesByIds()

SELECT schemes by IDs. Params: $1=schemeIds (array)

public string ObjectStorage_SelectSchemesByIds()

ObjectStorage_SelectStructuresWithMetadata()

SELECT structure metadata by scheme ID. Params: $1=schemeId

public string ObjectStorage_SelectStructuresWithMetadata()

ObjectStorage_SelectStructureTypes()

SELECT structure types by IDs. Params: $1=structureIds (array)

public string ObjectStorage_SelectStructureTypes()

ObjectStorage_SelectTypeById()

SELECT type info by ID. Params: $1=typeId

public string ObjectStorage_SelectTypeById()

ObjectStorage_SelectValueById()

SELECT single value by ID. Params: $1=valueId

public string ObjectStorage_SelectValueById()

ObjectStorage_SelectValuesForObjects()

SELECT all values for object IDs (ChangeTracking). Params: $1=objectIds (array)

public string ObjectStorage_SelectValuesForObjects()

ObjectStorage_SelectValuesWithTypes()

SELECT existing values with types. Params: $1=objectId, $2=structureIds (array)

public string ObjectStorage_SelectValuesWithTypes()

ObjectStorage_UpdateObject()

UPDATE object with all fields.

public string ObjectStorage_UpdateObject()

Permissions_Count()

SELECT COUNT of all permissions

public string Permissions_Count()

Permissions_CountByRole()

SELECT COUNT of permissions by role. Params: $1=roleId

public string Permissions_CountByRole()

Permissions_CountByUser()

SELECT COUNT of permissions by user. Params: $1=userId

public string Permissions_CountByUser()

Permissions_CountFrom()

SELECT COUNT(*) FROM _permissions (no WHERE). Used for dynamic count queries.

public string Permissions_CountFrom()

Permissions_Delete()

DELETE permission by ID. Params: $1=permissionId

public string Permissions_Delete()

Permissions_DeleteByRole()

DELETE permissions by role. Params: $1=roleId

public string Permissions_DeleteByRole()

Permissions_DeleteByUser()

DELETE all permissions by user. Params: $1=userId

public string Permissions_DeleteByUser()

Permissions_DeleteByUserRoleObject()

DELETE permission by user/role/object. Params: $1=userId, $2=roleId, $3=objectId

public string Permissions_DeleteByUserRoleObject()

Permissions_GetEffectiveForObject()

Uses MSSQL function get_user_permissions_for_object() from redb_permissions.sql.

public string Permissions_GetEffectiveForObject()

Permissions_GetEffectiveForObjects()

The rows of for many objects in one statement, by the same rule

public string Permissions_GetEffectiveForObjects()

Permissions_Insert()

INSERT new permission. Params: $1=id, $2=userId, $3=roleId, $4=refId, $5=select, $6=insert, $7=update, $8=delete

public string Permissions_Insert()

Permissions_SelectAllColumns()

SELECT all permission columns FROM _permissions (no WHERE). Used for dynamic queries.

public string Permissions_SelectAllColumns()

Permissions_SelectById()

SELECT permission by ID. Params: $1=permissionId

public string Permissions_SelectById()

Permissions_SelectByObject()

SELECT permissions by object. Params: $1=objectId

public string Permissions_SelectByObject()

Permissions_SelectByRole()

SELECT permissions by role. Params: $1=roleId

public string Permissions_SelectByRole()

Permissions_SelectByUser()

SELECT permissions by user. Params: $1=userId

public string Permissions_SelectByUser()

Permissions_SelectByUserRoleObject()

MSSQL equivalent of IS NOT DISTINCT FROM.

public string Permissions_SelectByUserRoleObject()

Permissions_SelectReadableObjectIds()

SELECT readable object IDs for user. Params: $1=userId

public string Permissions_SelectReadableObjectIds()

Permissions_SelectUserRoleIds()

SELECT user's role IDs. Params: $1=userId

public string Permissions_SelectUserRoleIds()

Permissions_Update()

UPDATE permission flags. Params: $1=select, $2=insert, $3=update, $4=delete, $5=permissionId

public string Permissions_Update()

Query_AggregateArrayGroupedSql()

SQL for array grouped aggregation.

public string Query_AggregateArrayGroupedSql()

Query_AggregateBatchPreviewSql()

SQL for aggregate batch preview.

public string Query_AggregateBatchPreviewSql()

Query_AggregateBatchSql()

SQL for aggregate batch function.

public string Query_AggregateBatchSql()

Query_AggregateFieldSql()

SQL for aggregate field.

public string Query_AggregateFieldSql()

Query_AggregateGroupedSql()

SQL for grouped aggregation.

public string Query_AggregateGroupedSql()

Query_BigintArrayCast()

Bigint array cast. PostgreSQL: "::bigint[]"

public string Query_BigintArrayCast()

Query_BuildPvtProjectionSqlFunction()

Bare SQL function name returning the projection SELECT string.

public string? Query_BuildPvtProjectionSqlFunction()

Query_BuildPvtProjectionSqlInvocation(long, int?, int, int, bool, string, long[]?, bool)

Builds the full SELECT statement that invokes

public string? Query_BuildPvtProjectionSqlInvocation(long schemeId, int? limit, int offset, int maxDepth, bool distinct, string sourceMode, long[]? treeIds, bool hasDistinctOn = false)

Query_BuildPvtSqlFunction()

Bare SQL function name returning the inner _id-list SQL string.

public string? Query_BuildPvtSqlFunction()

Query_BuildPvtSqlInvocation(long, int?, int, int, bool, string, long[]?, bool)

Builds the full SELECT statement that invokes pvt_build_query_sql.

public string? Query_BuildPvtSqlInvocation(long schemeId, int? limit, int offset, int maxDepth, bool distinct, string sourceMode, long[]? treeIds, bool hasDistinctOn = false)

Query_CheckPermissionSql()

SQL for checking user permission on object.

public string Query_CheckPermissionSql()

Query_CountTemplate()

MSSQL uses EXEC and OPENJSON for JSON parameters.

public string Query_CountTemplate()

Query_GetDescendantIdsFromAncestorsSql(string, int)

MSSQL: the descendants of the given objects down to depthLimit levels below them (WITH, without RECURSIVE).

public string Query_GetDescendantIdsFromAncestorsSql(string idsString, int depthLimit)

Query_GetIdsWithAncestorsSql(string)

MSSQL: Get all IDs with their ancestors using recursive CTE.

public string Query_GetIdsWithAncestorsSql(string idsString)

Query_GetParentIdsFromDescendantsSql(string, int)

MSSQL: WITH (without RECURSIVE) for traversing ancestors.

public string Query_GetParentIdsFromDescendantsSql(string idsString, int depthLimit)

Query_HasAncestorNormalSql(string)

HasAncestor with normal function (6 params) - MSSQL captures EXEC result in temp table.

public string Query_HasAncestorNormalSql(string functionName)

Query_HasAncestorTreeSql(string)

HasAncestor with tree function (8 params) - MSSQL captures EXEC result in temp table.

public string Query_HasAncestorTreeSql(string functionName)

Query_HasDescendantSql(string)

HasDescendant with normal function (6 params) - MSSQL captures EXEC result in temp table.

public string Query_HasDescendantSql(string functionName)

Query_JsonCast()

MSSQL doesn't need explicit JSON cast - it's handled by function signature.

public string Query_JsonCast()

Query_LoadObjectsByIdsSql(string, int)

MSSQL: Load objects by IDs as JSON using get_object_json function.

public string Query_LoadObjectsByIdsSql(string idsString, int maxDepth)

Query_ProjectionByIdsTemplate(string)

SQL for projection by structure IDs query.

public string Query_ProjectionByIdsTemplate(string structureIdsArray)

Query_ProjectionByPathsTemplate()

SQL for projection by paths query.

public string Query_ProjectionByPathsTemplate()

Query_PvtModuleCompatFunction()

Bare SQL function name returning what a deployed module still serves: '<oldest package module version>|<redb

public string? Query_PvtModuleCompatFunction()

Query_PvtModuleVersionFunction()

Bare SQL function name returning the deployed v2-pvt module

public string? Query_PvtModuleVersionFunction()

Query_PvtRequiredVersion()

Semver string the shipped v2-pvt bundle for this dialect declares.

public string? Query_PvtRequiredVersion()

Query_SearchFullTemplate()

MSSQL always uses the _base version; the C# side passes 8 params (the include_facets slot stays).

public string Query_SearchFullTemplate()

Query_SearchObjectsBaseFunction()

Name of the search function for objects base fields only (lazy loading).

public string Query_SearchObjectsBaseFunction()

Query_SearchObjectsFunction()

Name of the search function for objects with facets (eager loading).

public string Query_SearchObjectsFunction()

Query_SearchObjectsProjectionByIdsFunction()

Name of the search function with projection by IDs.

public string Query_SearchObjectsProjectionByIdsFunction()

Query_SearchObjectsProjectionByPathsFunction()

Name of the search function with projection by paths.

public string Query_SearchObjectsProjectionByPathsFunction()

Query_SearchObjectsSimpleSql()

Simple search for Delete operations - LEGACY. MSSql free must migrate to PVT pipeline.

public string Query_SearchObjectsSimpleSql()

Query_SearchTemplate()

MSSQL uses EXEC for stored procedures. Procedure returns 'result' column.

public string Query_SearchTemplate()

Query_SearchTreeObjectsBaseFunction()

Name of the tree search function base fields only (lazy loading).

public string Query_SearchTreeObjectsBaseFunction()

Query_SearchTreeObjectsFunction()

Name of the tree search function (eager loading).

public string Query_SearchTreeObjectsFunction()

Query_SearchWithDistinctTemplate()

SQL template for search query with distinct. Params: functionName

public string Query_SearchWithDistinctTemplate()

Query_SqlPreviewBaseFunction()

SQL preview function name for base (lazy loading) search.

public string Query_SqlPreviewBaseFunction()

Query_SqlPreviewFunction()

SQL preview function name for regular search.

public string Query_SqlPreviewFunction()

Query_SqlPreviewTemplate()

SQL for SQL preview function.

public string Query_SqlPreviewTemplate()

Query_TextArrayCast()

MSSQL uses STRING_SPLIT instead of array cast.

public string Query_TextArrayCast()

Query_TreeCountNormalSql(string)

For Tree procedures, we use temp table to capture EXEC result and extract total_count.

public string Query_TreeCountNormalSql(string functionName)

Query_TreeCountWithParentIdsSql(string)

MSSQL: capture EXEC result and extract total_count.

public string Query_TreeCountWithParentIdsSql(string functionName)

Query_TreeSearchNormalSql(string)

SQL for tree search query (normal search).

public string Query_TreeSearchNormalSql(string functionName)

Query_TreeSearchWithParentIdsSql(string)

Tree search with parent_ids array (8 params).

public string Query_TreeSearchWithParentIdsSql(string functionName)

Query_TreeSqlPreviewBaseFunction()

SQL preview function name for tree base (lazy loading) search.

public string Query_TreeSqlPreviewBaseFunction()

Query_TreeSqlPreviewFunction()

SQL preview function name for tree search.

public string Query_TreeSqlPreviewFunction()

Query_TreeSqlPreviewTemplate(string)

SQL for tree SQL preview.

public string Query_TreeSqlPreviewTemplate(string functionName)

Query_WindowSql()

SQL for window query.

public string Query_WindowSql()

Query_WrapPvtProjectionRowsAsJson(string, bool)

Wraps the projection inner SQL into a result-set of JSON rows

public string? Query_WrapPvtProjectionRowsAsJson(string innerSql, bool includeId)

Query_WrapPvtWithCount(string)

Wraps the inner _id-list SQL with COUNT(*).

public string? Query_WrapPvtWithCount(string innerSql)

Query_WrapPvtWithExists(string)

Wraps the inner _id-list SQL with EXISTS(...).

public string? Query_WrapPvtWithExists(string innerSql)

Query_WrapPvtWithObjectJson(string, int)

Wraps the inner _id-list SQL with the system materializer to

public string? Query_WrapPvtWithObjectJson(string innerSql, int maxDepth)

QuoteIdentifier(string)

Identifier escaping: "name" for PostgreSQL, [name] for MSSQL

public string QuoteIdentifier(string name)

Roles_Count()

SELECT COUNT of all roles

public string Roles_Count()

Roles_Delete()

DELETE role by ID. Params: $1=roleId

public string Roles_Delete()

Roles_ExistsById()

Check role exists by ID. Params: $1=roleId

public string Roles_ExistsById()

Roles_ExistsByName()

Check if role name exists (excluding role). Params: $1=name, $2=excludeId (optional)

public string Roles_ExistsByName()

Roles_ExistsByNameExcluding()

Check if role name exists excluding specific role. Params: $1=name, $2=excludeId

public string Roles_ExistsByNameExcluding()

Roles_Insert()

INSERT new role. Params: $1=id, $2=name

public string Roles_Insert()

Roles_SelectAll()

SELECT all roles ordered by name. Returns: Id, Name, IdConfiguration

public string Roles_SelectAll()

Roles_SelectById()

SELECT role by ID. Returns: Id, Name, IdConfiguration

public string Roles_SelectById()

Roles_SelectByName()

SELECT role by name. Returns: Id, Name, IdConfiguration

public string Roles_SelectByName()

Roles_SelectConfigurationId()

SELECT role configuration ID. Params: $1=roleId

public string Roles_SelectConfigurationId()

Roles_SelectIdByName()

SELECT role by name. Params: $1=roleName

public string Roles_SelectIdByName()

Roles_UpdateConfiguration()

UPDATE role configuration. Params: $1=configId, $2=roleId

public string Roles_UpdateConfiguration()

Roles_UpdateName()

UPDATE role name. Params: $1=newName, $2=roleId

public string Roles_UpdateName()

SchemaLock_Release()

Releases the application lock of the schema. Params: = resource name.

public string SchemaLock_Release()

SchemaLock_TryAcquire()

One attempt at the exclusive application lock of the schema, owned by the session, with no wait; returns the

public string SchemaLock_TryAcquire()

Schemes_CountMetadataCache()

SELECT the number of metadata cache rows of a scheme as BIGINT. Params: $1 = scheme id.

public string Schemes_CountMetadataCache()

Schemes_ExistsByName()

Check scheme exists by name. Params: $1=name

public string Schemes_ExistsByName()

Schemes_GetStructureTree()

Get structure tree JSON. Params: $1=schemeId

public string Schemes_GetStructureTree()

Schemes_Insert()

INSERT new scheme. Params: $1=id, $2=name, $3=alias, $4=type

public string Schemes_Insert()

Schemes_InsertIfAbsent()

INSERT a new scheme, doing nothing when the name is already taken.

public string Schemes_InsertIfAbsent()

Schemes_InsertObject()

INSERT Object scheme. Params: $1=id, $2=name, $3=type

public string Schemes_InsertObject()

Schemes_InsertObjectIfAbsent()

INSERT an Object scheme, doing nothing when the name is already taken.

public string Schemes_InsertObjectIfAbsent()

Schemes_MigrateStructureType()

Migrate structure type. Params: $1=structureId, $2=oldType, $3=newType, $4=dryRun

public string Schemes_MigrateStructureType()

Schemes_SelectAll()

SELECT all schemes.

public string Schemes_SelectAll()

Schemes_SelectById()

SELECT scheme by ID. Params: $1=schemeId

public string Schemes_SelectById()

Schemes_SelectByName()

SELECT scheme by name. Params: $1=name

public string Schemes_SelectByName()

Schemes_SelectHashById()

SELECT scheme hash by ID. Params: $1=schemeId

public string Schemes_SelectHashById()

Schemes_SelectObjectByName()

SELECT Object scheme by name and type. Params: $1=name, $2=type

public string Schemes_SelectObjectByName()

Schemes_SyncMetadataCache()

Sync metadata cache for scheme. Uses MSSQL stored procedure.

public string Schemes_SyncMetadataCache()

Schemes_UpdateAlias()

UPDATE scheme alias by ID. Params: $1=alias (nullable), $2=schemeId

public string Schemes_UpdateAlias()

Schemes_UpdateHash()

UPDATE scheme structure hash. Params: $1=hash, $2=schemeId

public string Schemes_UpdateHash()

Schemes_UpdateName()

Update scheme name by ID.

public string Schemes_UpdateName()

Schemes_UpdateNameSpace()

UPDATE scheme namespace by ID (V4, К7 — the ownership mark that gates short-name adoption).

public string Schemes_UpdateNameSpace()

Schemes_UpdateTags()

UPDATE the free-form _tags marker of a scheme. Params: $1=tags, $2=id

public string Schemes_UpdateTags()

Server_CurrentDatabase()

The name of the current database. No params.

public string Server_CurrentDatabase()

Server_EngineEdition()

SERVERPROPERTY('EngineEdition') as int (5 = Azure SQL Database). No params.

public string Server_EngineEdition()

Session_SetLazyRefs()

Set the session lazy-references flag the JSON builders read (V4, LAZY L2).

public string Session_SetLazyRefs()

SoftDelete_ClaimOrphanedTask()

Atomically claim an orphaned task for processing.

public string SoftDelete_ClaimOrphanedTask()

SoftDelete_GetDeletionProgress()

Gets deletion progress for a specific trash container.

public string SoftDelete_GetDeletionProgress()

SoftDelete_GetOrphanedTasks()

Gets orphaned deletion tasks for recovery at startup.

public string SoftDelete_GetOrphanedTasks()

SoftDelete_GetUserActiveDeletions()

Gets all active deletions for a user.

public string SoftDelete_GetUserActiveDeletions()

SoftDelete_MarkForDeletion()

Calls sp_mark_for_deletion procedure to soft-delete objects.

public string SoftDelete_MarkForDeletion()

SoftDelete_PurgeTrash()

Calls sp_purge_trash procedure to physically delete objects from trash.

public string SoftDelete_PurgeTrash()

SoftDelete_SelectLiveReferrersOfTrash()

Objects of a trash container referenced by live objects, with the referencing objects.

public string SoftDelete_SelectLiveReferrersOfTrash()

Structures_CreateRootKey()

CREATE the unique key of root structures. No params.

public string Structures_CreateRootKey()

Structures_DeleteById()

DELETE a structure; its children go by the cascade of _id_parent. Params: $1 = structure id.

public string Structures_DeleteById()

Structures_DeleteByIds(IEnumerable<long>)

DELETE structures by IDs. Params: dynamic IN clause

public string Structures_DeleteByIds(IEnumerable<long> ids)

Structures_DeleteSubtreeMetadataCache()

DELETE the metadata cache rows of a structure and every structure below it. Params: $1 = structure id.

public string Structures_DeleteSubtreeMetadataCache()

Structures_Insert()

INSERT new structure.

public string Structures_Insert()

Structures_LockSubtree()

Locks a structure and every structure below it against writers until the transaction ends, so that a value

public string? Structures_LockSubtree()

Structures_RootKeyExists()

SELECT returning a row when the unique key of root structures exists. No params. null: the engine needs

public string? Structures_RootKeyExists()

Structures_SelectById()

SELECT one structure by id (same columns as Structures_SelectByScheme). Params: $1=id

public string Structures_SelectById()

Structures_SelectByScheme()

SELECT full structures by scheme. Params: $1=schemeId

public string Structures_SelectByScheme()

Structures_SelectBySchemeCacheable()

SELECT structures with cache fields by scheme. Params: $1=schemeId

public string Structures_SelectBySchemeCacheable()

Structures_SelectBySchemeShort()

SELECT structures short fields by scheme. Params: $1=schemeId

public string Structures_SelectBySchemeShort()

Structures_SelectRootDuplicates()

SELECT the root structures whose (_id_scheme, _name) occurs more than once, as structure rows

public string Structures_SelectRootDuplicates()

Structures_SubtreeIsReferenced(bool)

SELECT 1 when anything points to a structure or a structure below it (a value, an overriding structure and, with

public string Structures_SubtreeIsReferenced(bool withMigrations)

Structures_UpdateAlias()

UPDATE structure alias. Params: $1=alias, $2=structureId

public string Structures_UpdateAlias()

Structures_UpdateAllowNotNull()

UPDATE structure allow_not_null. Params: $1=allowNotNull, $2=structureId

public string Structures_UpdateAllowNotNull()

Structures_UpdateCollectionType()

UPDATE structure collection type. Params: $1=collectionType, $2=structureId

public string Structures_UpdateCollectionType()

Structures_UpdateKeyType()

UPDATE structure key type. Params: $1=keyType, $2=structureId

public string Structures_UpdateKeyType()

Structures_UpdateLazy()

UPDATE the lazy-reference marker (V4, LAZY Л2). Params: $1=lazy, $2=structureId

public string Structures_UpdateLazy()

Structures_UpdateTags()

UPDATE the free-form _tags marker of a structure. Params: $1=tags, $2=id

public string Structures_UpdateTags()

Structures_UpdateType()

UPDATE structure type. Params: $1=typeId, $2=structureId

public string Structures_UpdateType()

Structures_UpdateUnique()

UPDATE the unique-key flag, encoder version and element-key scope of a structure.

public string Structures_UpdateUnique()

Transaction_SavepointBegin()

Savepoint trio for a save running inside the CALLER's transaction (bug report п.2,

public string Transaction_SavepointBegin()

Transaction_SavepointRelease()

RELEASE of the savepoint above; null when the engine needs none.

public string? Transaction_SavepointRelease()

Transaction_SavepointRollback()

ROLLBACK TO the savepoint above - the caller's transaction stays alive.

public string Transaction_SavepointRollback()

Tree_DeleteObjectsByIds()

DELETE objects by IDs. Params: $1=objectIds (array)

public string Tree_DeleteObjectsByIds()

Tree_DeleteValuesByObjectIds()

DELETE values by object IDs. Params: $1=objectIds (array)

public string Tree_DeleteValuesByObjectIds()

Tree_GetObjectJson()

Get object as JSON. Params: $1=objectId, $2=depth

public string Tree_GetObjectJson()

Tree_ObjectExists()

Check if object exists. Params: $1=objectId

public string Tree_ObjectExists()

Tree_SelectAncestorRows()

An object and its ancestors in one statement, as rows (Id, IdParent, IdScheme, Depth; the object itself has

public string Tree_SelectAncestorRows()

Tree_SelectChildrenBase()

SELECT all children base fields by parent (Pro PVT polymorphic mode).

public string Tree_SelectChildrenBase()

Tree_SelectChildrenBySchemeBase()

SELECT children base fields by parent and scheme (Pro PVT mode).

public string Tree_SelectChildrenBySchemeBase()

Tree_SelectChildrenIds()

SELECT direct child object ids only (no JSON materialization). Params: $1=parentId.

public string Tree_SelectChildrenIds()

Tree_SelectChildrenJson()

SELECT children with JSON by parent and scheme. Params: $1=parentId, $2=schemeId

public string Tree_SelectChildrenJson()

Tree_SelectIdsWithAncestors()

The ids of the given objects and of all their ancestors, each once, in one statement (ToTreeListAsync,

public string Tree_SelectIdsWithAncestors()

Tree_SelectParentId()

SELECT parent_id by object ID. Params: $1=objectId

public string Tree_SelectParentId()

Tree_SelectPolymorphicChildren()

SELECT polymorphic children with scheme. Params: $1=parentId

public string Tree_SelectPolymorphicChildren()

Tree_SelectSchemeAndJson()

SELECT scheme and JSON for object. Params: $1=objectId

public string Tree_SelectSchemeAndJson()

Tree_SelectSubtreeRows()

The subtree under an object in one statement: every descendant down to a depth, as rows

public string Tree_SelectSubtreeRows()

Tree_UpdateParent()

UPDATE object parent (move). Params: $1=newParentId, $2=dateModify, $3=whoChangeId, $4=objectId

public string Tree_UpdateParent()

Types_SelectAll()

SELECT all types. Returns: _id, _name, _db_type, _type

public string Types_SelectAll()

Types_SelectByName()

SELECT type by name. Params: $1=name

public string Types_SelectByName()

Users_Count()

SELECT COUNT of all users

public string Users_Count()

Users_CountEnabled()

SELECT COUNT of enabled users

public string Users_CountEnabled()

Users_CountFrom()

SELECT COUNT(*) FROM _users (no WHERE). Used for dynamic count queries.

public string Users_CountFrom()

Users_ExistsByEmail()

Check email exists. Params: $1=email

public string Users_ExistsByEmail()

Users_ExistsById()

Check if user exists by ID. Params: $1=userId

public string Users_ExistsById()

Users_ExistsByLogin()

Check login exists. Params: $1=login

public string Users_ExistsByLogin()

Users_ExistsByLoginExcluding()

Check login exists excluding user. Params: $1=login, $2=excludeUserId

public string Users_ExistsByLoginExcluding()

Users_Insert()

INSERT new user with all fields.

public string Users_Insert()

Users_SelectAllColumns()

SELECT all user columns FROM _users (no WHERE). Used for dynamic search queries.

public string Users_SelectAllColumns()

Users_SelectByEmail()

SELECT all user fields by email (case-insensitive, first match, active only).

public string Users_SelectByEmail()

Users_SelectById()

SELECT all user fields by ID. Params: $1=userId

public string Users_SelectById()

Users_SelectByIds()

SELECT all user fields by IDs (batch). Params: $1=userIds (array/csv)

public string Users_SelectByIds()

Users_SelectByLogin()

SELECT all user fields by login. Params: $1=login

public string Users_SelectByLogin()

Users_SelectConfigurationId()

SELECT user configuration ID. Params: $1=userId

public string Users_SelectConfigurationId()

Users_SelectIdByLogin()

SELECT user by login. Params: $1=login. Returns: Id

public string Users_SelectIdByLogin()

Users_SoftDelete()

UPDATE user for soft delete. Params: $1=newLogin, $2=newName, $3=enabled, $4=dateDismiss, $5=userId

public string Users_SoftDelete()

Users_Update()

UPDATE user fields.

public string Users_Update()

Users_UpdateConfiguration()

UPDATE user configuration. Params: $1=configId, $2=userId

public string Users_UpdateConfiguration()

Users_UpdatePassword()

UPDATE user password. Params: $1=hashedPassword, $2=userId

public string Users_UpdatePassword()

Users_UpdateStatus()

UPDATE user enabled status. Params: $1=enabled, $2=dateDismiss, $3=userId

public string Users_UpdateStatus()

UsersRoles_CountByRole()

SELECT COUNT of users for role. Params: $1=roleId

public string UsersRoles_CountByRole()

UsersRoles_Delete()

DELETE user-role assignment. Params: $1=userId, $2=roleId

public string UsersRoles_Delete()

UsersRoles_DeleteByRole()

DELETE all user-role assignments for role. Params: $1=roleId

public string UsersRoles_DeleteByRole()

UsersRoles_DeleteByUser()

DELETE all user-role assignments for user. Params: $1=userId

public string UsersRoles_DeleteByUser()

UsersRoles_Exists()

Check if user-role assignment exists. Params: $1=userId, $2=roleId

public string UsersRoles_Exists()

UsersRoles_Insert()

INSERT user-role assignment. Params: $1=id, $2=userId, $3=roleId

public string UsersRoles_Insert()

UsersRoles_SelectRolesByUser()

SELECT roles for user. Params: $1=userId. Returns: Id, Name, IdConfiguration

public string UsersRoles_SelectRolesByUser()

UsersRoles_SelectUsersByRole()

SELECT users for role. Params: $1=roleId. Returns user fields

public string UsersRoles_SelectUsersByRole()

Validation_SelectAllTypes()

SELECT all types for validation.

public string Validation_SelectAllTypes()

Validation_SelectSchemeByName()

SELECT scheme by name. Params: $1=schemeName

public string Validation_SelectSchemeByName()

Validation_SelectStructuresBySchemeId()

SELECT structures by scheme ID. Params: $1=schemeId

public string Validation_SelectStructuresBySchemeId()

Values_ClearUniqueByStructure()

UPDATE every row of a structure to _unique = NULL. Params: $1=structureId

public string Values_ClearUniqueByStructure()

Values_ClearUniqueByValueIds(IEnumerable<long>)

P7-аналог для ПОЛЕВЫХ ключей (Э2): освободить _values._unique у обновляемых строк перед

public string Values_ClearUniqueByValueIds(IEnumerable<long> ids)

Values_DeleteByteArrayElements()

DELETE the per-byte element rows of a legacy Array-of-Byte structure: rows of the structure

public string Values_DeleteByteArrayElements()

Values_ExistsUnhashedByStructure(string)

SELECT 1 if the structure has a root scalar row with a value in typedColumn

public string Values_ExistsUnhashedByStructure(string typedColumn)

Values_SelectByStructure()

SELECT every row of a structure (base and array-element rows alike) with RedbValue aliases.

public string Values_SelectByStructure()

Values_SelectElementRowsByStructure()

SELECT the ELEMENT rows of a collection structure — array index present — with their

public string Values_SelectElementRowsByStructure()

Values_SelectObjectIdByUnique()

SELECT _id_object of the root scalar row holding a key. Params: $1=structureId, $2=unique (Guid).

public string Values_SelectObjectIdByUnique()

Values_SelectRootScalarsByStructure()

SELECT the root scalar rows of a structure — no array parent, no array index — with their

public string Values_SelectRootScalarsByStructure()

Values_SetByteArrayScalar()

UPDATE one row into the scalar byte[] shape: _ByteArray = payload, _Guid and _Long cleared.

public string Values_SetByteArrayScalar()

Values_UpdateUnique()

UPDATE one row's key. Params: $1=unique (Guid, nullable), $2=id

public string Values_UpdateUnique()

Warmup_AllMetadataCaches()

MSSQL uses stored procedure, returns same columns as PostgreSQL function.

public string Warmup_AllMetadataCaches()

WrapSubquery(string, string)

Subquery wrapper: (subquery) AS alias

public string WrapSubquery(string subquery, string alias)