C# Class Insight.Database.Schema.SqlParser

A parser that detects the type and name of a sql object from a script.
ファイルを表示 Open project: jonwagner/Insight.Database.Schema Class Usage Examples

Public Methods

Method Description
Match ( string sql ) : SqlParserMatch

Attempts to match the sql to the pattern. If successful, sets the type and name

SqlParser ( SchemaObjectType type, string pattern, string nameTemplate = "$1" ) : System

Create a parser that detects a type from a pattern

Private Methods

Method Description
AssertValidSqlName ( string name ) : void

Makes sure that a name of a schema object does not contain any insecure characters.

FormatSqlName ( string name ) : string

Format a Sql Name to escape it out properly;

FormatSqlName ( string name, string name2 ) : string

Format a Sql Name to escape it out properly;

SqlParser ( ) : System
UnformatSqlName ( string name ) : string

Get the name of a SqlObject without owner and schema, and unformat the name

[dbo]..[foo] returns foo

Method Details

Match() public method

Attempts to match the sql to the pattern. If successful, sets the type and name
public Match ( string sql ) : SqlParserMatch
sql string The sql to parse
return SqlParserMatch

SqlParser() public method

Create a parser that detects a type from a pattern
public SqlParser ( SchemaObjectType type, string pattern, string nameTemplate = "$1" ) : System
type SchemaObjectType The type represented by the pattern
pattern string The pattern to detect
nameTemplate string The string used to generate the resulting name
return System