C# Class Tup.Cobar4Net.Parser.Recognizer.Mysql.Lexer.MySqlLexer

support MySql 5.5 token
Afficher le fichier Open project: tupunco/Tup.Cobar4Net Class Usage Examples

Protected Properties

Свойство Type Description
ch char
curIndex int
eofIndex int
inCStyleComment bool
inCStyleCommentIgnore bool
offsetCache int
sbuf char[]
sbufRef ThreadLocal
sizeCache int
sql char[]

Méthodes publiques

Méthode Description
AddCacheToke ( MySqlToken token ) : void
AppendStringContent ( StringBuilder sb ) : void

if GetStringValue returns "'abc\\'d'", then "abc\\'d" is appended

GetDecimalValue ( ) : BigDecimal
GetIntegerValue ( ) : Number

token must be MySqlToken.LiteralNumPureDigit

GetStringValue ( ) : string

make sense for those types of token:
MySqlToken.UsrVar : e.g. "@var1", "@'mary''s'";
MySqlToken.SysVar : e.g. "var2";
MySqlToken.LiteralChars , MySqlToken.LiteralNchars : e.g. "'ab\\'c'";
MySqlToken.LiteralBit : e.g. "0101"
MySqlToken.Identifier

GetStringValueUppercase ( ) : string

for MySqlToken.Identifier , MySqlToken.SysVar

MySqlLexer ( char sql ) : System
MySqlLexer ( string sql ) : System
NextToken ( ) : MySqlToken
SetCStyleCommentVersion ( int version ) : int
ToString ( ) : string
Token ( ) : MySqlToken

Méthodes protégées

Méthode Description
Eof ( ) : bool
Err ( string msg ) : SqlSyntaxErrorException

always throw SqlSyntaxErrorException

HasChars ( int howMany ) : bool
PutChar ( char ch, int index ) : void

Append a character to sbuf.

ScanBitField ( bool quoteMode ) : void
ScanChar ( ) : char
ScanChar ( int skip ) : char
ScanHexaDecimal ( bool quoteMode ) : void
ScanIdentifier ( ) : void

id is NOT included in `.

ScanIdentifierWithAccent ( ) : void

id is included in `.

id is included in `. first ` is included

ScanNumber ( ) : void

if first char is ., token may be MySqlToken.PuncDot if invalid char is presented after .

ScanPlaceHolder ( ) : void

not Sql syntax

ScanString ( ) : void
ScanSystemVariable ( ) : void

first @@ is included

ScanUserVariable ( ) : void

first @ is included

SkipSeparator ( ) : void

skip whitespace and comment

UpdateStringValue ( char src, int srcOffset, int len ) : void

update stringValue and stringValueUppercase . It is possible that sbuf be changed

Private Methods

Méthode Description
FromSQL2Chars ( string sql ) : char[]
NextTokenInternal ( ) : MySqlToken
ScanIdentifierFromNumber ( int initOffset, int initSize ) : void

NOTE: id dosn't include '.' for sake of performance issue (based on shaojin.wensj's design). However, it is not convenient for MySql compatibility. e.g. ".123f" will be regarded as ".123" and "f" in MySql, but in this MySqlLexer , it will be "." and "123f" because ".123f" may be part of "db1.123f" and "123f" is the table name.

Method Details

AddCacheToke() public méthode

public AddCacheToke ( MySqlToken token ) : void
token MySqlToken must be a keyword
Résultat void

AppendStringContent() public méthode

if GetStringValue returns "'abc\\'d'", then "abc\\'d" is appended
public AppendStringContent ( StringBuilder sb ) : void
sb StringBuilder
Résultat void

Eof() protected méthode

protected Eof ( ) : bool
Résultat bool

Err() protected méthode

always throw SqlSyntaxErrorException
protected Err ( string msg ) : SqlSyntaxErrorException
msg string
Résultat System.SqlSyntaxErrorException

GetDecimalValue() public méthode

public GetDecimalValue ( ) : BigDecimal
Résultat BigDecimal

GetIntegerValue() public méthode

token must be MySqlToken.LiteralNumPureDigit
public GetIntegerValue ( ) : Number
Résultat System.Number

GetStringValue() public méthode

make sense for those types of token:
MySqlToken.UsrVar : e.g. "@var1", "@'mary''s'";
MySqlToken.SysVar : e.g. "var2";
MySqlToken.LiteralChars , MySqlToken.LiteralNchars : e.g. "'ab\\'c'";
MySqlToken.LiteralBit : e.g. "0101"
MySqlToken.Identifier
public GetStringValue ( ) : string
Résultat string

GetStringValueUppercase() public méthode

for MySqlToken.Identifier , MySqlToken.SysVar
public GetStringValueUppercase ( ) : string
Résultat string

HasChars() protected méthode

protected HasChars ( int howMany ) : bool
howMany int
Résultat bool

MySqlLexer() public méthode

public MySqlLexer ( char sql ) : System
sql char
Résultat System

MySqlLexer() public méthode

public MySqlLexer ( string sql ) : System
sql string
Résultat System

NextToken() public méthode

public NextToken ( ) : MySqlToken
Résultat MySqlToken

PutChar() protected méthode

Append a character to sbuf.
protected PutChar ( char ch, int index ) : void
ch char
index int
Résultat void

ScanBitField() protected méthode

protected ScanBitField ( bool quoteMode ) : void
quoteMode bool /// if false: first 0b has been skipped; if /// true: first b' has been skipped ///
Résultat void

ScanChar() protected méthode

protected ScanChar ( ) : char
Résultat char

ScanChar() protected méthode

protected ScanChar ( int skip ) : char
skip int /// if 1, then equals to /// ///
Résultat char

ScanHexaDecimal() protected méthode

protected ScanHexaDecimal ( bool quoteMode ) : void
quoteMode bool /// if false: first 0x has been skipped; if /// true: first x' has been skipped ///
Résultat void

ScanIdentifier() protected méthode

id is NOT included in `.
protected ScanIdentifier ( ) : void
Résultat void

ScanIdentifierWithAccent() protected méthode

id is included in `.
id is included in `. first ` is included
protected ScanIdentifierWithAccent ( ) : void
Résultat void

ScanNumber() protected méthode

if first char is ., token may be MySqlToken.PuncDot if invalid char is presented after .
protected ScanNumber ( ) : void
Résultat void

ScanPlaceHolder() protected méthode

not Sql syntax
protected ScanPlaceHolder ( ) : void
Résultat void

ScanString() protected méthode

protected ScanString ( ) : void
Résultat void

ScanSystemVariable() protected méthode

first @@ is included
protected ScanSystemVariable ( ) : void
Résultat void

ScanUserVariable() protected méthode

first @ is included
protected ScanUserVariable ( ) : void
Résultat void

SetCStyleCommentVersion() public static méthode

public static SetCStyleCommentVersion ( int version ) : int
version int
Résultat int

SkipSeparator() protected méthode

skip whitespace and comment
protected SkipSeparator ( ) : void
Résultat void

ToString() public méthode

public ToString ( ) : string
Résultat string

Token() public méthode

public Token ( ) : MySqlToken
Résultat MySqlToken

UpdateStringValue() protected méthode

update stringValue and stringValueUppercase . It is possible that sbuf be changed
protected UpdateStringValue ( char src, int srcOffset, int len ) : void
src char
srcOffset int
len int
Résultat void

Property Details

ch protected_oe property

always be sql [ curIndex ]
protected char ch
Résultat char

curIndex protected_oe property

current index of sql
protected int curIndex
Résultat int

eofIndex protected_oe property

always be sql .length - 1
protected int eofIndex
Résultat int

inCStyleComment protected_oe property

protected bool inCStyleComment
Résultat bool

inCStyleCommentIgnore protected_oe property

protected bool inCStyleCommentIgnore
Résultat bool

offsetCache protected_oe property

protected int offsetCache
Résultat int

sbuf protected_oe property

protected char[] sbuf
Résultat char[]

sbufRef protected_oe static_oe property

A character buffer for literals.
protected static ThreadLocal sbufRef
Résultat ThreadLocal

sizeCache protected_oe property

protected int sizeCache
Résultat int

sql protected_oe property

protected char[] sql
Résultat char[]