Skip to content

Commit

Permalink
Fix from review
Browse files Browse the repository at this point in the history
  • Loading branch information
kbeaugrand committed Jun 4, 2024
1 parent cc496d9 commit 260f720
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 116 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
using System.Threading;
using System.Threading.Tasks;

namespace Microsoft.SemanticKernel.Connectors.MssqlServer;
namespace Microsoft.SemanticKernel.Connectors.MssqlServer.Core;

/// <summary>
/// Represents a client for interacting with a SQL Server database for storing semantic memories and embeddings.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Security", "CA2100:Review SQL queries for security vulnerabilities",
Justification = "We need to build the full table name using schema and collection, it does not support parameterized passing.")]
public sealed class SqlServerClient : ISqlServerClient
internal sealed class SqlServerClient
{
private readonly string _connectionString;
private readonly SqlServerConfig _configuration;
Expand Down Expand Up @@ -148,7 +148,7 @@ public async Task DeleteCollectionAsync(string collectionName, CancellationToken
{
collectionName = NormalizeIndexName(collectionName);

if (!(await this.DoesCollectionExistsAsync(collectionName, cancellationToken).ConfigureAwait(false)))
if (!await this.DoesCollectionExistsAsync(collectionName, cancellationToken).ConfigureAwait(false))
{
// Collection does not exist
return;
Expand Down Expand Up @@ -433,12 +433,12 @@ private async Task<SqlServerMemoryEntry> ReadEntryAsync(SqlDataReader dataReader
entry.Id = dataReader.GetGuid(dataReader.GetOrdinal("id"));
entry.Key = dataReader.GetString(dataReader.GetOrdinal("key"));

if (!(await dataReader.IsDBNullAsync(dataReader.GetOrdinal("metadata"), cancellationToken).ConfigureAwait(false)))
if (!await dataReader.IsDBNullAsync(dataReader.GetOrdinal("metadata"), cancellationToken).ConfigureAwait(false))
{
entry.MetadataString = dataReader.GetString(dataReader.GetOrdinal("metadata"));
}

if (!(await dataReader.IsDBNullAsync(dataReader.GetOrdinal("timestamp"), cancellationToken).ConfigureAwait(false)))
if (!await dataReader.IsDBNullAsync(dataReader.GetOrdinal("timestamp"), cancellationToken).ConfigureAwait(false))
{
entry.Timestamp = await dataReader.GetFieldValueAsync<DateTimeOffset?>(dataReader.GetOrdinal("timestamp"), cancellationToken).ConfigureAwait(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

using System;

namespace Microsoft.SemanticKernel.Connectors.MssqlServer;
namespace Microsoft.SemanticKernel.Connectors.MssqlServer.Core;

/// <summary>
/// A sql memory entry.
/// </summary>
public record struct SqlServerMemoryEntry
internal struct SqlServerMemoryEntry
{
/// <summary>
/// The unique identitfier of the memory entry.
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) Kevin BEAUGRAND. All rights reserved.

using Microsoft.SemanticKernel.Connectors.MssqlServer.Core;
using Microsoft.SemanticKernel.Memory;
using System;
using System.Collections.Generic;
Expand All @@ -20,7 +21,7 @@ namespace Microsoft.SemanticKernel.Connectors.MssqlServer;
#pragma warning disable SKEXP0001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
public sealed class SqlServerMemoryStore : IMemoryStore, IDisposable
{
private ISqlServerClient _dbClient;
private SqlServerClient _dbClient;

/// <summary>
/// Connects to a SQL Server database using the provided connection string and schema, and returns a new instance of <see cref="SqlServerMemoryStore"/>.
Expand All @@ -41,7 +42,7 @@ public static async Task<SqlServerMemoryStore> ConnectAsync(string connectionStr
/// <summary>
/// Represents a memory store implementation that uses a SQL Server database as its backing store.
/// </summary>
public SqlServerMemoryStore(ISqlServerClient dbClient)
internal SqlServerMemoryStore(SqlServerClient dbClient)
{
this._dbClient = dbClient;
}
Expand Down

0 comments on commit 260f720

Please sign in to comment.