Interface ITokenHandle
- Namespace
- gudusoft.gsqlparser
- Assembly
- gudusoft.gsqlparser.dll
use this interface if you like to change token properties generated by lexer before send to parser.
package test.interfaceDemo;
import gudusoft.gsqlparser.*;
import junit.framework.TestCase;
class myTokenHandle implements ITokenHandle{
public boolean processToken(TSourceToken st){
if (st.toString().equalsIgnoreCase("limit")){
st.tokencode = TBaseType.cmtslashstar;//treat this token as a comment
}
return true;
}
}
public class testITokenHandle extends TestCase {
public void test1(){
TGSqlParser sqlparser = new TGSqlParser(EDbVendor.dbvmysql);
sqlparser.sqltext = "select * from dual limit";
sqlparser.setTokenHandle(new myTokenHandle());
assertTrue(sqlparser.parse() == 0);
}
}
public interface ITokenHandle
Methods
processToken(TSourceToken)
Source token of input SQL query during parsing.
bool processToken(TSourceToken st)
Parameters
stTSourceTokencurrent processing token
Returns
- bool
true, continue processing. false, break process rest tokens.