class toSQLParse

A bunch of functions to parse and indent SQL text. More...

Definition#include <tosqlparse.h>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types

Public Static Methods


Detailed Description

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:
textEditor to get token from
curLineCurrent line when parsing, modified when calling.
posCurrent position when parsing, modified when calling.
forwardIf true go forward from current position, otherwise backward.
commentInclude 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:
strString to get token from
lineThe line the current position is on. This is not needed, but only valid if a correct value is passed into the function.
posCurrent position when parsing, modified when calling.
forwardIf true go forward from current position, otherwise backward.
commentInclude 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:
strString to get token from
posCurrent position when parsing, modified when calling.
forwardIf true go forward from current position, otherwise backward.
commentInclude comments as tokens.

Returns: String with next token in editor

std::list  parse (const QString &str)

parse

[static]

Parse a string.

Parameters:
strString to parse.

Returns: Parsed statement tree.

std::list  parse (const QString &str,toConnection &conn)

parse

[static]

Parse a string.

Parameters:
strString to parse.
connConnection to determine SQL dialect. (For future use)

Returns: Parsed statement tree.

QString  indent (const QString &str)

indent

[static]

Indent a string.

Parameters:
strString to indent.

Returns: An indented string.

QString  indentStatement (statement &stat,int level=0)

indentStatement

[static]

Indent a parse statement structure into a string.

Parameters:
statStatement to indent.
levelInitial indentation level to use.

Returns: A string with the indented statement.

QString  indent (const QString &str,toConnection &conn)

indent

[static]

Indent a string.

Parameters:
strString to indent.
connConnection to determine SQL dialect. (For future use)

Returns: An indented string.

QString  indentString (int level)

indentString

[static]

Create an indentation string.

Parameters:
levelNumber of characters to indent.

int  countIndent (const QString &str,int &chars)

countIndent

[static]

Count indentation level of a string.

Parameters:
strString to check.
charsPosition in string.

settings  getSetting (void)

getSetting

[static]

Get current settings.

void  setSetting (const settings &setting)

setSetting

[static]

Get current settings.