Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## gudusoft.gsqlparser
Class TGSqlParser

    java.lang.Object
      gudusoft.gsqlparser.TGSqlParser

    public class TGSqlParser

extends java.lang.Object

SQL Parser check syntax of input SQL script, generate, analyze parse tree, list all SQL statements with detailed information of input SQL script.

Field Summary
`TSourceTokenList` | `sourcetokenlist` Tokens generated by lexer for input SQL script.
`java.lang.String` | `sqlfilename` SQL file need to be parsed.
`TStatementList` | `sqlstatements` SQL statements generated by this parser for input SQL script.
`java.lang.String` | `sqltext` SQL Text need to be parsed.

Constructor Summary
`TGSqlParser(EDbVendor pdbvendor)`

Method Summary
`EDbVendor` | `getDbVendor()` this source token list is the same as sourcetokenlist after parse input sql.
`int` | `getErrorCount()` Syntax errors of SQL script.
`java.lang.String` | `getErrormessage()` Detailed syntax error messages.
`static java.lang.String` | `getLicenseMessage()`
`static java.lang.String` | `getLicenseType()`
`static java.lang.String` | `getMachineId()`
`IMetaDatabase` | `getMetaDatabase()`
`int` | `getrawsqlstatements()` Separate SQL statements in a script into `sqlstatements` without parse each statement.
`java.lang.String` | `getSqlfilename()`
`java.io.InputStream` | `getSqlInputStream()`
`java.lang.String` | `getSqltext()`
`java.util.ArrayList` | `getSyntaxErrors()` detailed list of parse error, element of this list is TSyntaxError
`static java.lang.String` | `getUserName()`
`int` | `parse()` Parse input SQL script.
`void` | `setMetaDatabase(IMetaDatabase metaDatabase)`
`void` | `setSqlfilename(java.lang.String sqlfilename)`
`void` | `setSqlInputStream(java.io.InputStream sqlInputStream)` set SQL need to be parsed in InputStream
`void` | `setSqltext(java.lang.String sqltext)`
`void` | `tokenizeSqltext()` converting input sql text into a sequence of tokens: `sourcetokenlist`.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### sqltext

    public java.lang.String sqltext

  SQL Text need to be parsed. If sqlfilename was specified, then sqltext will be ignored.

### sqlfilename

    public java.lang.String sqlfilename

  SQL file need to be parsed. If sqlfilename was specified, then sqltext will be ignored. This must be full path to the file, relative path doesn't work.

### sourcetokenlist

    public TSourceTokenList sourcetokenlist

  Tokens generated by lexer for input SQL script. Tokens are always available even if there are syntax errors in input SQL script.

### sqlstatements

    public TStatementList sqlstatements

  SQL statements generated by this parser for input SQL script. statements are always available even if there are syntax errors in input SQL script. if there is no syntax error in statement, you can access that statement to fetch desired information such as tables, columns, etc.

Constructor Detail

### TGSqlParser

    public TGSqlParser(EDbVendor pdbvendor)

Parameters:
  `pdbvendor` - The SQL dialect to be parsed

Method Detail

### setSqltext

    public void setSqltext(java.lang.String sqltext)

### getSqltext

    public java.lang.String getSqltext()

### setSqlfilename

    public void setSqlfilename(java.lang.String sqlfilename)

### getSqlfilename

    public java.lang.String getSqlfilename()

### setSqlInputStream

    public void setSqlInputStream(java.io.InputStream sqlInputStream)

  set SQL need to be parsed in InputStream

  Parameters:
    `sqlInputStream` -

### getSqlInputStream

    public java.io.InputStream getSqlInputStream()

### getSyntaxErrors

    public java.util.ArrayList getSyntaxErrors()

  detailed list of parse error, element of this list is TSyntaxError

  Returns:

### getDbVendor

    public EDbVendor getDbVendor()

  this source token list is the same as sourcetokenlist after parse input sql.

  Will be changed once modify various sql parts in sql statement. this source token list is used by toString() in all sub class of TParseTreeNode

  Returns:

### getUserName

    public static java.lang.String getUserName()

### getMachineId

    public static java.lang.String getMachineId()

### getLicenseMessage

    public static java.lang.String getLicenseMessage()

### getLicenseType

    public static java.lang.String getLicenseType()

  Returns:
    trial license or developer license or distribution license

### setMetaDatabase

    public void setMetaDatabase(IMetaDatabase metaDatabase)

### getMetaDatabase

    public IMetaDatabase getMetaDatabase()

  Returns:
    class represents meta data in a real database this can be used to check whether a column belongs to a table and other information need to be gained from database.

### getErrorCount

    public int getErrorCount()

  Syntax errors of SQL script.

### getErrormessage

    public java.lang.String getErrormessage()

  Detailed syntax error messages.

### parse

    public int parse()

  Parse input SQL script.

  Returns:
    0 means parse SQL script successfully. otherwise, use getErrorCount, getErrormessage to get detailed error information.

### getrawsqlstatements

    public int getrawsqlstatements()

  Separate SQL statements in a script into `sqlstatements` without parse each statement.

  Returns:
    0 if get SQL statements successfully

### tokenizeSqltext

    public void tokenizeSqltext()

  converting input sql text into a sequence of tokens: `sourcetokenlist`.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD