C# Class com.rusanu.DBUtil.SqlCmd

Class for sqlcmd functionality
Inheritance: IDisposable
ファイルを表示 Open project: rusanu/com.rusanu.dbutil Class Usage Examples

Public Methods

Method Description
Dispose ( ) : void
ExecuteFile ( string filePath, string basePath = null ) : bool

Executes a SQL file, from the file path

ExecuteFile ( SqlConnection conn, string filePath ) : void

Executes a SQL file on the given connection

ExecuteReader ( TextReader file, string basePath = null ) : bool

Executes a SQL file, from a TextReader

ExecuteStream ( Stream stream, string basePath = null ) : bool

Executes a SQL file from a stream

ExecuteStream ( SqlConnection conn, Stream stream ) : void
SqlCmd ( SqlConnection conn ) : System

Constructor

Private Methods

Method Description
ConnectCommand ( string line ) : void
ExecuteBatch ( string batch, uint count ) : bool
GetFullFilePath ( string filePath, string basePath ) : string
OnErrorCommand ( string line ) : void
RunCommand ( string line, string basePath ) : void
SetVarCommand ( string line ) : void
ShellCommand ( string line ) : void

Method Details

Dispose() public method

public Dispose ( ) : void
return void

ExecuteFile() public method

Executes a SQL file, from the file path
public ExecuteFile ( string filePath, string basePath = null ) : bool
filePath string The SQL file to execute
basePath string /// The base path to use to qualify relative path of any included files that are to be executed. /// If not supplied this will default to the directory path containing ///
return bool

ExecuteFile() public static method

Executes a SQL file on the given connection
public static ExecuteFile ( SqlConnection conn, string filePath ) : void
conn System.Data.SqlClient.SqlConnection Connection to execute the file on
filePath string
return void

ExecuteReader() public method

Executes a SQL file, from a TextReader
public ExecuteReader ( TextReader file, string basePath = null ) : bool
file TextReader The SQL file to execute, as a TextReader
basePath string The base path to use to qualify relative path of any included files that are to be executed
return bool

ExecuteStream() public method

Executes a SQL file from a stream
public ExecuteStream ( Stream stream, string basePath = null ) : bool
stream Stream The SQL file to execute, as a Stream
basePath string The base path to use to qualify relative path of any included files that are to be executed
return bool

ExecuteStream() public static method

public static ExecuteStream ( SqlConnection conn, Stream stream ) : void
conn System.Data.SqlClient.SqlConnection
stream Stream
return void

SqlCmd() public method

Constructor
public SqlCmd ( SqlConnection conn ) : System
conn System.Data.SqlClient.SqlConnection The SQL Connection used to execute the SQL batches
return System