|
|
A bunch of functions to parse and indent SQL text.
settings (struct) | settings |
statement (class) | statement |
Structure the statement is parsed into.
QString getToken (toMarkedText *text,int &curLine,int &pos,bool forward=true,
bool comment=false)
| getToken |
[static]
Get next SQL token from an editor.
Parameters:
text | Editor to get token from |
curLine | Current line when parsing, modified when calling. |
pos | Current position when parsing, modified when calling. |
forward | If true go forward from current position, otherwise backward. |
comment | Include comments as tokens. |
Returns: String with next token in editor
QString getToken (const QString &sql,int &line,int &pos,bool forward=true,
bool comment=false)
| getToken |
[static]
Get next SQL token from a string.
Parameters:
str | String to get token from |
line | The line the current position is on. This is not needed, but only valid if a correct value is passed into the function. |
pos | Current position when parsing, modified when calling. |
forward | If true go forward from current position, otherwise backward. |
comment | Include comments as tokens. |
Returns: String with next token in editor
QString getToken (const QString &sql,int &pos,bool forward=true,
bool comment=false)
| getToken |
[static]
Get next SQL token from a string.
Parameters:
str | String to get token from |
pos | Current position when parsing, modified when calling. |
forward | If true go forward from current position, otherwise backward. |
comment | Include comments as tokens. |
Returns: String with next token in editor
std::list | parse |
[static]
Parse a string.
Parameters:
str | String to parse. |
Returns: Parsed statement tree.
std::list | parse |
[static]
Parse a string.
Parameters:
str | String to parse. |
conn | Connection to determine SQL dialect. (For future use) |
Returns: Parsed statement tree.
QString indent (const QString &str)
| indent |
[static]
Indent a string.
Parameters:
str | String to indent. |
Returns: An indented string.
QString indentStatement (statement &stat,int level=0)
| indentStatement |
[static]
Indent a parse statement structure into a string.
Parameters:
stat | Statement to indent. |
level | Initial indentation level to use. |
Returns: A string with the indented statement.
QString indent (const QString &str,toConnection &conn)
| indent |
[static]
Indent a string.
Parameters:
str | String to indent. |
conn | Connection to determine SQL dialect. (For future use) |
Returns: An indented string.
QString indentString (int level)
| indentString |
[static]
Create an indentation string.
Parameters:
level | Number of characters to indent. |
int countIndent (const QString &str,int &chars)
| countIndent |
[static]
Count indentation level of a string.
Parameters:
str | String to check. |
chars | Position in string. |
settings getSetting (void)
| getSetting |
[static]
Get current settings.
void setSetting (const settings &setting)
| setSetting |
[static]
Get current settings.