Last active
April 24, 2019 12:45
-
-
Save jesspanni/1745b0b753b05c900f207cf5c127d5ee to your computer and use it in GitHub Desktop.
Snowflake Client
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <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