Gda.Statement

g GObject.Object GObject.Object Gda.Statement Gda.Statement GObject.Object->Gda.Statement

Subclasses:None

Methods

Inherited:GObject.Object (37)
Structs:GObject.ObjectClass (5)
class error_quark ()
class new ()
  check_structure ()
  check_validity (cnc)
  copy ()
  get_parameters ()
  get_statement_type ()
  is_useless ()
  normalize (cnc)
  serialize ()
  to_sql_extended (cnc, params, flags)
  to_sql_real (context)

Virtual Methods

Inherited:GObject.Object (7)
  do_checked (cnc, checked)
  do_reset ()

Properties

Name Type Flags Short Description
structure int r/w  

Signals

Inherited:GObject.Object (1)
Name Short Description
checked Gets emitted whenever the structure and contents of the statement have been verified (emitted after Gda.Statement.check_validity()).
reset Gets emitted whenever the statement has changed

Fields

Inherited:GObject.Object (1)
Name Type Access Description
object GObject.Object r  

Class Details

class Gda.Statement(**kwargs)
Bases:GObject.Object
Abstract:No
Structure:Gda.StatementClass
classmethod error_quark()
Return type:int
classmethod new()
Returns:the new object
Return type:Gda.Statement

Creates a new Gda.Statement object

check_structure()
Raises:GLib.Error
Returns:True if self’s structure is correct
Return type:bool

Checks that self’s structure is correct.

check_validity(cnc)
Parameters:cnc (Gda.Connection or None) – a Gda.Connection object, or None
Raises:GLib.Error
Returns:True if every object actually exists in cnc’s database
Return type:bool

If cnc is not None then checks that every object (table, field, function) used in self actually exists in cnc’s database

If cnc is None, then cleans anything related to cnc in self.

See gda_sql_statement_check_validity() for more information.

copy()
Returns:a the new copy of self
Return type:Gda.Statement

Copy constructor

get_parameters()
Raises:GLib.Error
Returns:True if no error occurred.
out_params:a place to store a new Gda.Set object, or None
Return type:(bool, out_params: Gda.Set)

Get a new Gda.Set object which groups all the execution parameters which self needs. This new object is returned though out_params.

Note that if self does not need any parameter, then out_params is set to None.

get_statement_type()
Returns:the statement type
Return type:Gda.SqlStatementType

Get the type of statement held by self. It returns Gda.SqlStatementType.NONE if self does not hold any statement

is_useless()
Returns:True if executing self does nothing
Return type:bool

Tells if self is composed only of spaces (that is it has no real SQL code), and is completely useless as such.

normalize(cnc)
Parameters:cnc (Gda.Connection) – a Gda.Connection object
Raises:GLib.Error
Returns:True if no error occurred
Return type:bool

“Normalizes” some parts of self, see gda_sql_statement_normalize() for more information.

serialize()
Returns:a string containing the serialized version of self
Return type:str

Creates a string representing the contents of self.

to_sql_extended(cnc, params, flags)
Parameters:
Raises:

GLib.Error

Returns:

a new string if no error occurred

params_used:a place to store the list of actual Gda.Holder objects in params used to do the rendering, or None

Return type:

(str, params_used: [Gda.Holder])

Renders self as an SQL statement, with some control on how it is rendered.

If cnc is not None, then the rendered SQL will better be suited to be used by cnc (in particular it may include some SQL tweaks and/or proprietary extensions specific to the database engine used by cnc): in this case the result is similar to calling Gda.Connection.statement_to_sql().

to_sql_real(context)
Parameters:context (Gda.SqlRenderingContext) – a Gda.SqlRenderingContext context
Raises:GLib.Error
Returns:a new string, or None if an error occurred
Return type:str

Renders self to its SQL representation, using context to specify how each part of self must be rendered. This function is mainly used by database provider’s implementations which require to specialize some aspects of SQL rendering to be adapted to the database,’s own SQL dialect (for example SQLite rewrites the ‘False’ and ‘True’ literals as ‘0’ and ‘NOT 0’).

do_checked(cnc, checked) virtual
Parameters:
do_reset() virtual

Signal Details

Gda.Statement.signals.checked(statement, object, p0)
Signal Name:

checked

Flags:

RUN_FIRST

Parameters:

Gets emitted whenever the structure and contents of the statement have been verified (emitted after Gda.Statement.check_validity()).

Gda.Statement.signals.reset(statement)
Signal Name:reset
Flags:RUN_FIRST
Parameters:statement (Gda.Statement) – The object which received the signal

Gets emitted whenever the statement has changed

Property Details

Gda.Statement.props.structure
Name:structure
Type:int
Default Value:None
Flags:READABLE, WRITABLE