Gda.SqlParser

g GObject.GInterface GObject.GInterface Gda.Lockable Gda.Lockable GObject.GInterface->Gda.Lockable GObject.Object GObject.Object Gda.SqlParser Gda.SqlParser GObject.Object->Gda.SqlParser Gda.Lockable->Gda.SqlParser

Subclasses:

None

Methods

Inherited:

GObject.Object (37), Gda.Lockable (3)

Structs:

GObject.ObjectClass (5)

class

error_quark ()

class

new ()

parse_file_as_batch (filename)

parse_string (sql)

parse_string_as_batch (sql)

set_overflow_error ()

set_syntax_error ()

Virtual Methods

Inherited:

GObject.Object (7), Gda.Lockable (3)

Properties

Name

Type

Flags

Short Description

column-error

int

r

line-error

int

r

mode

int

r/w

tokenizer-flavour

int

r/w

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

object

GObject.Object

r

Class Details

class Gda.SqlParser(**kwargs)
Bases:

GObject.Object, Gda.Lockable

Abstract:

No

Structure:

Gda.SqlParserClass

classmethod error_quark()
Return type:

int

classmethod new()
Returns:

the new object

Return type:

Gda.SqlParser

Creates a new Gda.SqlParser object

parse_file_as_batch(filename)
Parameters:

filename (str) – name of the file to parse

Raises:

GLib.Error

Returns:

a new Gda.Batch object, or None if an error occurred

Return type:

Gda.Batch or None

Parse filename's contents and creates a Gda.Batch object which contains all the Gda.Statement objects created while parsing (one object per SQL statement).

filename's contents are parsed and Gda.Statement objects are created as long as no error is found. If an error is found at some point, then the parsing stops, error may be set and None is returned

if sql is None, then the returned Gda.Batch object will contain no statement.

parse_string(sql)
Parameters:

sql (str) – the SQL string to parse

Raises:

GLib.Error

Returns:

a new Gda.Statement object, or None if an error occurred

remain:

location to store a pointer to remaining part of sql in case sql has multiple statement, or None

Return type:

(Gda.Statement or None, remain: str)

Parses sql and creates a Gda.Statement statement from the first SQL statement contained in sql: if sql contains more than one statement, then the remaining part of the string is not parsed at all, and remain (if not None) will point at the first non parsed character.

To include variables in the sql string, see the

‘GdaSqlParser’s object description [GdaSqlParser.description]’.

parse_string_as_batch(sql)
Parameters:

sql (str) – the SQL string to parse

Raises:

GLib.Error

Returns:

a new Gda.Batch object, or None if an error occurred

remain:

location to store a pointer to remaining part of sql in case an error occurred while parsing sql, or None

Return type:

(Gda.Batch or None, remain: str)

Parse sql and creates a Gda.Batch object which contains all the Gda.Statement objects created while parsing (one object per SQL statement). Empty statements (composed of spaces only) do not appear in the resulting object.

sql is parsed and Gda.Statement objects are created as long as no error is found in sql. If an error is found at some point, then the parsing stops and remain may contain a non None pointer, error may be set, and None is returned.

if sql is None, then the returned Gda.Batch object will contain no statement.

To include variables in the sql string, see the

‘GdaSqlParser’s object description [GdaSqlParser.description]’.

set_overflow_error()
set_syntax_error()

Property Details

Gda.SqlParser.props.column_error
Name:

column-error

Type:

int

Default Value:

0

Flags:

READABLE

Gda.SqlParser.props.line_error
Name:

line-error

Type:

int

Default Value:

0

Flags:

READABLE

Gda.SqlParser.props.mode
Name:

mode

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE

Gda.SqlParser.props.tokenizer_flavour
Name:

tokenizer-flavour

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE