Skip to content

Instantly share code, notes, and snippets.

@jesspanni
Last active April 24, 2019 12:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jesspanni/1745b0b753b05c900f207cf5c127d5ee to your computer and use it in GitHub Desktop.
Save jesspanni/1745b0b753b05c900f207cf5c127d5ee to your computer and use it in GitHub Desktop.
Snowflake Client
/// <summary>
/// A client for submitting queries to Snowflake.
/// </summary>
public class SnowflakeClient
{
private readonly string connectionString;
/// <summary>
/// Initializes a new instance of the <see cref="SnowflakeClient"/> class.
/// </summary>
public SnowflakeClient(string connectionString)
{
this.connectionString = connectionString;
}
/// <summary>
/// Executes a sequence of Snowflake statements that are not expected to return a result set.
/// </summary>
public int ExecuteNonQuery(params string[] statements)
{
using (IDbConnection conn = new SnowflakeDbConnection())
{
conn.ConnectionString = this.connectionString;
conn.Open();
IDbCommand cmd = conn.CreateCommand();
int affectedRows = 0;
foreach (string command in statements)
{
cmd.CommandText = command;
affectedRows = cmd.ExecuteNonQuery();
}
return affectedRows;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment