Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query : Adds WithParameterStream to QueryDefinition to pass in serialized values #2222

Merged
merged 16 commits into from
Mar 25, 2021

Conversation

kr-santosh
Copy link
Contributor

@kr-santosh kr-santosh commented Feb 17, 2021

Description

  • Expose an API which supports passing stream value as Query Parameter Values.
  • Disable call to custom serializer since the stream value would / expected to be generated out of a serialized value.

This is useful in cases like running a Query on Encrypted Values, where the value is generated post serialization and then encrypted and we don't want to change the cipher value due to a call to custom serializer again.

    /// <summary>
    /// Add parameters with Stream Value to the SQL query.       
    /// </summary>
    /// <param name="name">The name of the parameter.</param>
    /// <param name="valueStream">The stream value for the parameter.</param>
    /// <remarks>
    /// UseCase : This is useful in cases like running a Query on Encrypted Values, where the value is generated post serialization and then encrypted 
    /// and we don't want to change the cipher value due to a call to serializer again.
    /// If the same name is added again it will replace the original value.
    /// </remarks>        
    /// <example>
    /// <code language="c#">
    /// <![CDATA[
    /// QueryDefinition query = new QueryDefinition(
    ///     "select * from t where t.Account = @account")
    ///     .WithParameterStream("@account", streamValue);
    /// ]]>
    /// </code>
    /// </example>
    /// <returns>An instance of <see cref="QueryDefinition"/>.</returns>
    public QueryDefinition WithParameterStream(string name, Stream valueStream)

Type of change

  • [] New feature (non-breaking change which adds functionality)
  • [] This change requires a documentation update

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow the required format: "[Internal] Category: (Adds|Fixes|Refactors) Description"

Examples:
Diagnostics: Adds GetElapsedClientLatency to CosmosDiagnostics
PartitionKey: Fixes null reference when using default(PartitionKey)
[v4] Client Encryption: Refactors code to external project
[Internal] Query: Adds code generator for CosmosNumbers for easy additions in the future.

@kr-santosh kr-santosh added the feature-request New feature or request label Feb 17, 2021
@kr-santosh kr-santosh self-assigned this Feb 17, 2021
@kr-santosh kr-santosh changed the title Query : Provide stream support for Query Add Parameter and disable Call to Custom Serialization when using stream value. Query : Adds stream support for Query Add Parameter and disable Call to Custom Serialization when using stream value. Feb 17, 2021
@kr-santosh kr-santosh requested a review from j82w February 18, 2021 13:49
j82w
j82w previously approved these changes Feb 18, 2021
kirankumarkolli
kirankumarkolli previously approved these changes Mar 4, 2021
@kr-santosh kr-santosh requested a review from j82w March 4, 2021 16:19
@j82w j82w changed the title Query : Adds stream support for Query Add Parameter and disable Call to Custom Serialization when using stream value. Query : Adds WithParameterStream to QueryDefinition to pass in serialized values Mar 25, 2021
@j82w j82w merged commit ec8bf98 into master Mar 25, 2021
@j82w j82w deleted the users/sakulk/supportSerializedQueryValue branch March 25, 2021 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants