Skip to content

Commit

Permalink
Revert changes to public class names.
Browse files Browse the repository at this point in the history
Version 3.0.2
  • Loading branch information
Grauenwolf committed Jun 21, 2022
1 parent 3c35d87 commit c6edb36
Show file tree
Hide file tree
Showing 56 changed files with 976 additions and 976 deletions.
4 changes: 2 additions & 2 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

Refactoring efforts complete. First NuGet drop.

## Version 3.0.1
## Version 3.0.2

Revert names of public classes to `SnowflakeXxx` insead of `SFXxxx`. This was a bad idea that makes adoption from the legacy version harder than necessary for minimal gains.
Revert names of public classes to `SnowflakeDbXxx` insead of `SFXxxx`. This was a bad idea that makes adoption from the legacy version harder than necessary for minimal gains.
2 changes: 1 addition & 1 deletion Snowflake.Data.Tests/Mock/MockCloseSessionException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public Task<T> PostAsync<T>(RestRequest postRequest, CancellationToken cancellat
}
else
{
throw new SnowflakeException("", SESSION_CLOSE_ERROR, "Mock generated error", null);
throw new SnowflakeDbException("", SESSION_CLOSE_ERROR, "Mock generated error", null);
}
}

Expand Down
12 changes: 6 additions & 6 deletions Snowflake.Data.Tests/Mock/MockSnowflakeDbConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Tortuga.Data.Snowflake.Tests.Mock;

class MockSnowflakeDbConnection : SnowflakeConnection
class MockSnowflakeDbConnection : SnowflakeDbConnection
{
readonly private IMockRestRequester _restRequester;

Expand All @@ -31,7 +31,7 @@ public override void Open()
SfSession.Open();
OnSessionEstablished();
}
catch (SnowflakeException)
catch (SnowflakeDbException)
{
m_ConnectionState = ConnectionState.Closed;
throw;
Expand All @@ -40,7 +40,7 @@ public override void Open()
{
// Otherwise when Dispose() is called, the close request would timeout.
m_ConnectionState = System.Data.ConnectionState.Closed;
throw new SnowflakeException(ex, SnowflakeError.InternalError, "Unable to connect");
throw new SnowflakeDbException(ex, SnowflakeDbError.InternalError, "Unable to connect");
}
}

Expand All @@ -55,7 +55,7 @@ public async override Task OpenAsync(CancellationToken cancellationToken)
await SfSession.OpenAsync(cancellationToken).ConfigureAwait(false);
OnSessionEstablished();
}
catch (SnowflakeException)
catch (SnowflakeDbException)
{
m_ConnectionState = ConnectionState.Closed;
throw;
Expand All @@ -68,13 +68,13 @@ public async override Task OpenAsync(CancellationToken cancellationToken)
catch (Exception ex) when (ex is not TaskCanceledException || !cancellationToken.IsCancellationRequested)
{
m_ConnectionState = ConnectionState.Closed;
throw new SnowflakeException(ex, SnowflakeError.InternalError, "Unable to connect");
throw new SnowflakeDbException(ex, SnowflakeDbError.InternalError, "Unable to connect");
}
}

private void SetMockSession()
{
SfSession = new SFSession(ConnectionString, Password, _restRequester, SnowflakeConfiguration.Default);
SfSession = new SFSession(ConnectionString, Password, _restRequester, SnowflakeDbConfiguration.Default);

m_ConnectionTimeout = (int)SfSession.m_ConnectionTimeout.TotalSeconds;

Expand Down
58 changes: 29 additions & 29 deletions Snowflake.Data.Tests/SFBindTestIT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class SFBindTestIT : SFBaseTest
[Test]
public void TestArrayBind()
{
using (var conn = new SnowflakeConnection())
using (var conn = new SnowflakeDbConnection())
{
conn.ConnectionString = ConnectionString;
conn.Open();
Expand Down Expand Up @@ -54,7 +54,7 @@ public void TestArrayBind()
[Test]
public void TestBindNullValue()
{
using (var dbConnection = new SnowflakeConnection())
using (var dbConnection = new SnowflakeDbConnection())
{
dbConnection.ConnectionString = ConnectionString;
dbConnection.Open();
Expand Down Expand Up @@ -164,9 +164,9 @@ public void TestBindNullValue()
command.Parameters.Add(param);
int rowsInserted = command.ExecuteNonQuery();
}
catch (SnowflakeException e)
catch (SnowflakeDbException e)
{
Assert.AreEqual(SnowflakeError.UnsupportedDotnetType, e.SnowflakeError);
Assert.AreEqual(SnowflakeDbError.UnsupportedDotnetType, e.SnowflakeError);
}
}
}
Expand Down Expand Up @@ -207,7 +207,7 @@ public void TestBindNullValue()
[Test]
public void testBindValue()
{
using (SnowflakeConnection dbConnection = new SnowflakeConnection())
using (SnowflakeDbConnection dbConnection = new SnowflakeDbConnection())
{
dbConnection.ConnectionString = ConnectionString;
dbConnection.Open();
Expand Down Expand Up @@ -330,9 +330,9 @@ public void testBindValue()
command.Parameters.Add(param);
int rowsInserted = command.ExecuteNonQuery();
}
catch (SnowflakeException e)
catch (SnowflakeDbException e)
{
Assert.AreEqual(SnowflakeError.UnsupportedDotnetType, e.SnowflakeError);
Assert.AreEqual(SnowflakeDbError.UnsupportedDotnetType, e.SnowflakeError);
}
}
}
Expand Down Expand Up @@ -373,20 +373,20 @@ public void testBindValue()
[Test]
public void TestBindValueWithSFDataType()
{
using (SnowflakeConnection dbConnection = new SnowflakeConnection())
using (SnowflakeDbConnection dbConnection = new SnowflakeDbConnection())
{
dbConnection.ConnectionString = ConnectionString;
dbConnection.Open();
try
{
foreach (SnowflakeDataType type in Enum.GetValues(typeof(SnowflakeDataType)))
foreach (SnowflakeDbDataType type in Enum.GetValues(typeof(SnowflakeDbDataType)))
{
if (!type.Equals(SnowflakeDataType.None))
if (!type.Equals(SnowflakeDbDataType.None))
{
bool isTypeSupported = true;
using (var command = dbConnection.CreateCommand())
{
if (!type.Equals(SnowflakeDataType.Fixed))
if (!type.Equals(SnowflakeDbDataType.Fixed))
{
command.CommandText = $"create or replace table TEST_TBL (data {type}, unsupportedType VARCHAR)";
}
Expand All @@ -399,48 +399,48 @@ public void TestBindValueWithSFDataType()

using (var command = dbConnection.CreateCommand())
{
SnowflakeParameter param = (SnowflakeParameter)command.CreateParameter();
SnowflakeDbParameter param = (SnowflakeDbParameter)command.CreateParameter();
param.ParameterName = "p0";
param.SFDataType = type;
switch (type)
{
case SnowflakeDataType.Binary:
case SnowflakeDbDataType.Binary:
param.Value = Encoding.UTF8.GetBytes("BinaryData");
break;

case SnowflakeDataType.Fixed:
case SnowflakeDbDataType.Fixed:
param.Value = 10;
break;

case SnowflakeDataType.Boolean:
case SnowflakeDbDataType.Boolean:
param.Value = true;
break;

case SnowflakeDataType.Date:
case SnowflakeDbDataType.Date:
param.Value = DateTime.Now;
break;

case SnowflakeDataType.Text:
case SnowflakeDbDataType.Text:
param.Value = "thisIsAString";
break;

case SnowflakeDataType.TimestampLtz:
case SnowflakeDbDataType.TimestampLtz:
param.Value = DateTimeOffset.Now;
break;

case SnowflakeDataType.TimestampNtz:
case SnowflakeDbDataType.TimestampNtz:
param.Value = DateTime.Now;
break;

case SnowflakeDataType.TimestampTz:
case SnowflakeDbDataType.TimestampTz:
param.Value = DateTimeOffset.Now;
break;

case SnowflakeDataType.Time:
case SnowflakeDbDataType.Time:
param.Value = DateTime.Now;
break;

case SnowflakeDataType.Real:
case SnowflakeDbDataType.Real:
param.Value = 25.3;
break;

Expand All @@ -460,9 +460,9 @@ public void TestBindValueWithSFDataType()
Assert.AreEqual(1, rowsInserted);
}
// DB rejects query if param type is VARIANT, OBJECT or ARRAY
else if (!type.Equals(SnowflakeDataType.Variant) &&
!type.Equals(SnowflakeDataType.Object) &&
!type.Equals(SnowflakeDataType.Array))
else if (!type.Equals(SnowflakeDbDataType.Variant) &&
!type.Equals(SnowflakeDbDataType.Object) &&
!type.Equals(SnowflakeDbDataType.Array))
{
try
{
Expand All @@ -471,9 +471,9 @@ public void TestBindValueWithSFDataType()
command.Parameters.Add(param);
int rowsInserted = command.ExecuteNonQuery();
}
catch (SnowflakeException e)
catch (SnowflakeDbException e)
{
Assert.AreEqual(SnowflakeError.UnsupportedSnowflakeTypeForParam, e.SnowflakeError);
Assert.AreEqual(SnowflakeDbError.UnsupportedSnowflakeTypeForParam, e.SnowflakeError);
}
}
}
Expand Down Expand Up @@ -508,7 +508,7 @@ public void TestBindValueWithSFDataType()
[Test]
public void TestParameterCollection()
{
using (var conn = new SnowflakeConnection())
using (var conn = new SnowflakeDbConnection())
{
conn.ConnectionString = ConnectionString;
conn.Open();
Expand All @@ -535,7 +535,7 @@ public void TestParameterCollection()
parameters.SetValue(p2, 1);
parameters.SetValue(p3, 2);

((SnowflakeParameterCollection)cmd.Parameters).AddRange(parameters);
((SnowflakeDbParameterCollection)cmd.Parameters).AddRange(parameters);

var target = new IDataParameter[15];

Expand Down
Loading

0 comments on commit c6edb36

Please sign in to comment.