mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-15 17:23:32 -05:00
Adding sr.strings file and removing hard-coded strings (#52)
* Strings sweep for connection service * String sweep for credentials service * String sweep for hosting * String sweep for query execution service * String sweep for Workspace service * Renaming utility namespace to match standards Renaming Microsoft.SqlTools.EditorServices.Utility to Microsoft.SqlTools.ServiceLayer.Utility to match the naming changes done a while back. Also renaming them on the files that use them * Namespace change on reliable connection * Adding the new resx and designer files * Final bug fixes for srgen Fixing flakey moq package name * Removing todo as per @kevcunnane * Adding using statements as per @llali's comment * Fixing issues from broken unit tests Note: This feature contains changes that will break the contract for saving as CSV and JSON. On success, null is returned as a message instead of "Success". Changes will be made to the vscode component to handle this change.
This commit is contained in:
@@ -14,6 +14,7 @@ using Microsoft.SqlTools.ServiceLayer.Connection.ReliableConnection;
|
||||
using Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.QueryExecution.DataStorage;
|
||||
using Microsoft.SqlTools.ServiceLayer.SqlContext;
|
||||
using Microsoft.SqlTools.ServiceLayer.Utility;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
|
||||
{
|
||||
@@ -67,22 +68,10 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
|
||||
public Query(string queryText, ConnectionInfo connection, QueryExecutionSettings settings, IFileStreamFactory outputFactory)
|
||||
{
|
||||
// Sanity check for input
|
||||
if (string.IsNullOrEmpty(queryText))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(queryText), "Query text cannot be null");
|
||||
}
|
||||
if (connection == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(connection), "Connection cannot be null");
|
||||
}
|
||||
if (settings == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(settings), "Settings cannot be null");
|
||||
}
|
||||
if (outputFactory == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(outputFactory), "Output file factory cannot be null");
|
||||
}
|
||||
Validate.IsNotNullOrEmptyString(nameof(queryText), queryText);
|
||||
Validate.IsNotNull(nameof(connection), connection);
|
||||
Validate.IsNotNull(nameof(settings), settings);
|
||||
Validate.IsNotNull(nameof(outputFactory), outputFactory);
|
||||
|
||||
// Initialize the internal state
|
||||
QueryText = queryText;
|
||||
@@ -165,7 +154,7 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
|
||||
// Make sure that the query hasn't completed execution
|
||||
if (HasExecuted)
|
||||
{
|
||||
throw new InvalidOperationException("The query has already completed, it cannot be cancelled.");
|
||||
throw new InvalidOperationException(SR.QueryServiceCancelAlreadyCompleted);
|
||||
}
|
||||
|
||||
// Issue the cancellation token for the query
|
||||
@@ -218,7 +207,7 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
|
||||
SqlConnection conn = sender as SqlConnection;
|
||||
if (conn == null)
|
||||
{
|
||||
throw new InvalidOperationException("Sender for OnInfoMessage event must be a SqlConnection");
|
||||
throw new InvalidOperationException(SR.QueryServiceMessageSenderNotSql);
|
||||
}
|
||||
|
||||
foreach(SqlError error in args.Errors)
|
||||
@@ -244,14 +233,13 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
|
||||
// Sanity check that the results are available
|
||||
if (!HasExecuted)
|
||||
{
|
||||
throw new InvalidOperationException("The query has not completed, yet.");
|
||||
throw new InvalidOperationException(SR.QueryServiceSubsetNotCompleted);
|
||||
}
|
||||
|
||||
// Sanity check to make sure that the batch is within bounds
|
||||
if (batchIndex < 0 || batchIndex >= Batches.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(batchIndex), "Result set index cannot be less than 0" +
|
||||
"or greater than the number of result sets");
|
||||
throw new ArgumentOutOfRangeException(nameof(batchIndex), SR.QueryServiceSubsetBatchOutOfRange);
|
||||
}
|
||||
|
||||
return Batches[batchIndex].GetSubset(resultSetIndex, startRow, rowCount);
|
||||
|
||||
Reference in New Issue
Block a user