Repository: typeorm/typeorm
File: src/driver/sqlserver/SqlServerDriver.ts (TypeScript)

Code before:
                normalizedType as any,
                column.precision,
            )
        } else if (column.scale !== null && column.scale !== undefined) {
            return new MssqlParameter(
                value,
                normalizedType as any,
                column.scale,
            )
        }

        return new MssqlParameter(value, normalizedType as any)
    }

    parametrizeValues(column: ColumnMetadata, value: any) {
        if (value instanceof FindOperator) {
            if (Array.isArray(value.value)) {
                for (let parameterValueChild of value.value) {
                    parameterValueChild = this.parametrizeValues(
                        column,
                        parameterValueChild,
                    )
                }
            } else if (value.type !== "raw") {
                value.transformValue({
                    to: (v) => this.parametrizeValue(column, v),
                    from: (v) => v,
                })
            }
        } else {
            value = this.parametrizeValue(column, value)
        }

        return value
    }

    /**
     * Sql server's parameters needs to be wrapped into special object with type information about this value.
     * This method wraps all values of the given object into MssqlParameter based on their column definitions in the given table.
     */
    parametrizeMap(tablePath: string, map: ObjectLiteral): ObjectLiteral {
        // find metadata for the given table
        if (!this.connection.hasMetadata(tablePath))
            // if no metadata found then we can't proceed because we don't have columns and their types
            return map
        const metadata = this.connection.getMetadata(tablePath)

        return Object.keys(map).reduce((newMap, key) => {
            const value = map[key]

            // find column metadata

Review comment (suggestion):
This function would benefit from a comment explaining what it's intended to be used for and what it does.

Code after:
                normalizedType as any,
                column.precision,
            )
        } else if (column.scale !== null && column.scale !== undefined) {
            return new MssqlParameter(
                value,
                normalizedType as any,
                column.scale,
            )
        }

        return new MssqlParameter(value, normalizedType as any)
    }

    /**
     * Recursively wraps values (including those inside FindOperators) into MssqlParameter instances,
     * ensuring correct type metadata is passed to the SQL Server driver.
     *
     * - If the value is a FindOperator containing an array, all elements are individually parametrized.
     * - If the value is a non-raw FindOperator, a transformation is applied to its internal value.
     * - Otherwise, the value is passed directly to parametrizeValue for wrapping.
     *
     * This ensures SQL Server receives properly typed parameters for queries involving operators like
     * In, MoreThan, Between, etc.
     */
    parametrizeValues(column: ColumnMetadata, value: any) {
        if (value instanceof FindOperator) {
            if (Array.isArray(value.value)) {
                for (let i = 0; i < value.value.length; i++) {
                    value.value[i] = this.parametrizeValues(
                        column,
                        value.value[i],
                    )
                }
            } else if (value.type !== "raw") {
                value.transformValue({
                    to: (v) => this.parametrizeValue(column, v),
                    from: (v) => v,
                })
            }
        } else {
            value = this.parametrizeValue(column, value)
        }

        return value
    }

    /**
     * Sql server's parameters needs to be wrapped into special object with type information about this value.
     * This method wraps all values of the given object into MssqlParameter based on their column definitions in the given table.
     */