libgdamm: Gnome::Gda::Statement Class Reference

Single SQL statement. More...

Inheritance diagram for Gnome::Gda::Statement:
Collaboration diagram for Gnome::Gda::Statement:

Public Types

typedef std::vector< const Glib::RefPtr< Holder > > HolderVector
 
- Public Types inherited from Glib::Object
typedef void(* DestroyNotify) (gpointer data)
 
- Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify func_destroy_notify
 

Public Member Functions

 Statement (Statement&& src) noexcept
 
Statementoperator= (Statement&& src) noexcept
 
virtual ~Statement () noexcept
 
GdaStatement* gobj ()
 Provides access to the underlying C GObject. More...

 
const GdaStatement* gobj () const
 Provides access to the underlying C GObject. More...

 
GdaStatement* gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...

 
Glib::RefPtr< Statementcopy () const
 Copy constructor. More...

 
Glib::ustring serialize () const
 Creates a string representing the contents of stmt. More...

 
bool get_parameters (Glib::RefPtr< Set >& out_params)
 Get a new Gda::Set object which groups all the execution parameters which stmt needs. More...

 
Glib::ustring to_sql () const
 
Glib::ustring to_sql (const Glib::RefPtr< const Set >& params) const
 
Glib::ustring to_sql (const Glib::RefPtr< Connection >& cnc, const Glib::RefPtr< const Set >& params, StatementSqlFlag flags, const HolderVector& params_used) const
 Renders stmt as an SQL statement, with some control on how it is rendered. More...

 
SqlStatementType get_statement_type () const
 Get the type of statement held by stmt. More...

 
bool is_useless () const
 Tells if stmt is composed only of spaces (that is it has no real SQL code), and is completely useless as such. More...

 
bool check_structure () const
 Checks that stmt's structure is correct. More...

 
bool check_validity (const Glib::RefPtr< Connection >& cnc) const
 If cnc is not 0 then checks that every object (table, field, function) used in stmt actually exists in cnc's database. More...

 
bool normalize (const Glib::RefPtr< Connection >& cnc)
 "Normalizes" some parts of stmt, see gda_sql_statement_normalize() for more information. More...

 
Glib::PropertyProxy< gpointer > property_structure ()
 
Glib::PropertyProxy_ReadOnly< gpointer > property_structure () const
 
Glib::SignalProxy2< void, const Glib::RefPtr< Connection >&, bool > signal_checked ()
 
Glib::SignalProxy0< void > signal_reset ()
 
- Public Member Functions inherited from Glib::Object
 Object (const Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&src) noexcept
 
Objectoperator= (Object &&src) noexcept
 
void * get_data (const QueryQuark &key)
 
void set_data (const Quark &key, void *data)
 
void set_data (const Quark &key, void *data, DestroyNotify notify)
 
void remove_data (const QueryQuark &quark)
 
void * steal_data (const QueryQuark &quark)
 
Glib::RefPtr< Glib::Objectwrap (GObject *object, bool take_copy=false)
 
- Public Member Functions inherited from Glib::ObjectBase
 ObjectBase (const ObjectBase &)=delete
 
ObjectBaseoperator= (const ObjectBase &)=delete
 
void set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
 
void get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
 
void set_property (const Glib::ustring &property_name, const PropertyType &value)
 
void get_property (const Glib::ustring &property_name, PropertyType &value) const
 
void connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void > &slot)
 
sigc::connection connect_property_changed_with_return (const Glib::ustring &property_name, const sigc::slot< void > &slot)
 
void freeze_notify ()
 
void thaw_notify ()
 
virtual void reference () const
 
virtual void unreference () const
 
GObject * gobj ()
 
const GObject * gobj () const
 
GObject * gobj_copy () const
 
- Public Member Functions inherited from sigc::trackable
 trackable ()
 
 trackable (const trackable &src)
 
 trackable (trackable &&src) noexcept
 
 ~trackable ()
 
void add_destroy_notify_callback (void *data, func_destroy_notify func) const
 
void notify_callbacks ()
 
trackableoperator= (const trackable &src)
 
trackableoperator= (trackable &&src) noexcept
 
void remove_destroy_notify_callback (void *data) const
 

Static Public Member Functions

static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system. More...

 
static Glib::RefPtr< Statementcreate ()
 

Protected Member Functions

 Statement ()
 
virtual void on_checked (const Glib::RefPtr< Connection >& cnc, bool valid)
 This is a default handler for the signal signal_checked(). More...

 
virtual void on_reset ()
 This is a default handler for the signal signal_reset(). More...

 
- Protected Member Functions inherited from Glib::Object
 Object ()
 
 Object (const Glib::ConstructParams &construct_params)
 
 Object (GObject *castitem)
 
virtual ~Object () noexcept
 
- Protected Member Functions inherited from Glib::ObjectBase
 ObjectBase ()
 
 ObjectBase (const char *custom_type_name)
 
 ObjectBase (const std::type_info &custom_type_info)
 
 ObjectBase (ObjectBase &&src) noexcept
 
ObjectBaseoperator= (ObjectBase &&src) noexcept
 
virtual ~ObjectBase () noexcept=0
 
void initialize (GObject *castitem)
 
void initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)
 

Related Functions

(Note that these are not member functions.)

Glib::RefPtr< Gnome::Gda::Statementwrap (GdaStatement* object, bool take_copy=false)
 A Glib::wrap() method for this object. More...

 

Detailed Description

Single SQL statement.

The Gda::Statement represents a single SQL statement (multiple statements can be grouped in a Batch object).

A Gda::Statement can either be built "manually" by building a Gda::SqlStatement structure, or from an SQL statement using a Gda::SqlParser object. A GdaConnection can use a GdaStatement to:

Member Typedef Documentation

Constructor & Destructor Documentation

Gnome::Gda::Statement::Statement ( Statement&&  src)
noexcept
virtual Gnome::Gda::Statement::~Statement ( )
virtualnoexcept
Gnome::Gda::Statement::Statement ( )
protected

Member Function Documentation

bool Gnome::Gda::Statement::check_structure ( ) const

Checks that stmt's structure is correct.

Returns
true if stmt's structure is correct.
bool Gnome::Gda::Statement::check_validity ( const Glib::RefPtr< Connection >&  cnc) const

If cnc is not 0 then checks that every object (table, field, function) used in stmt actually exists in cnc's database.

If cnc is 0, then cleans anything related to cnc in stmt.

See gda_sql_statement_check_validity() for more information.

Parameters
cncA Gda::Connection object, or 0.
Returns
true if every object actually exists in cnc's database.
Glib::RefPtr<Statement> Gnome::Gda::Statement::copy ( ) const

Copy constructor.

Returns
A the new copy of orig.
static Glib::RefPtr<Statement> Gnome::Gda::Statement::create ( )
static
bool Gnome::Gda::Statement::get_parameters ( Glib::RefPtr< Set >&  out_params)

Get a new Gda::Set object which groups all the execution parameters which stmt needs.

This new object is returned though out_params.

Note that if stmt does not need any parameter, then out_params is set to 0.

Parameters
out_paramsA place to store a new Gda::Set object, or 0.
Returns
true if no error occurred.
SqlStatementType Gnome::Gda::Statement::get_statement_type ( ) const

Get the type of statement held by stmt.

It returns GDA_SQL_STATEMENT_NONE if stmt does not hold any statement

Returns
The statement type.
static GType Gnome::Gda::Statement::get_type ( )
static

Get the GType for this class, for use with the underlying GObject type system.

GdaStatement* Gnome::Gda::Statement::gobj ( )
inline

Provides access to the underlying C GObject.

const GdaStatement* Gnome::Gda::Statement::gobj ( ) const
inline

Provides access to the underlying C GObject.

GdaStatement* Gnome::Gda::Statement::gobj_copy ( )

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

bool Gnome::Gda::Statement::is_useless ( ) const

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

Returns
true if executing stmt does nothing.
bool Gnome::Gda::Statement::normalize ( const Glib::RefPtr< Connection >&  cnc)

"Normalizes" some parts of stmt, see gda_sql_statement_normalize() for more information.

Parameters
cncA Gda::Connection object.
Returns
true if no error occurred.
virtual void Gnome::Gda::Statement::on_checked ( const Glib::RefPtr< Connection >&  cnc,
bool  valid 
)
protectedvirtual

This is a default handler for the signal signal_checked().

virtual void Gnome::Gda::Statement::on_reset ( )
protectedvirtual

This is a default handler for the signal signal_reset().

Statement& Gnome::Gda::Statement::operator= ( Statement&&  src)
noexcept
Glib::PropertyProxy< gpointer > Gnome::Gda::Statement::property_structure ( )
Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< gpointer > Gnome::Gda::Statement::property_structure ( ) const
Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
Glib::ustring Gnome::Gda::Statement::serialize ( ) const

Creates a string representing the contents of stmt.

Returns
A string containing the serialized version of stmt.
Glib::SignalProxy2< void,const Glib::RefPtr<Connection>&,bool > Gnome::Gda::Statement::signal_checked ( )
Slot Prototype:
void on_my_checked(const Glib::RefPtr<Connection>& cnc, bool valid)
Glib::SignalProxy0< void > Gnome::Gda::Statement::signal_reset ( )
Slot Prototype:
void on_my_reset()
Glib::ustring Gnome::Gda::Statement::to_sql ( ) const
Glib::ustring Gnome::Gda::Statement::to_sql ( const Glib::RefPtr< const Set >&  params) const
Glib::ustring Gnome::Gda::Statement::to_sql ( const Glib::RefPtr< Connection >&  cnc,
const Glib::RefPtr< const Set >&  params,
StatementSqlFlag  flags,
const HolderVector params_used 
) const

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

If cnc is not 0, 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().

Parameters
cncA Gda::Connection object, or 0.
paramsParameters contained in a single Gda::Set object.
flagsA set of flags to control the rendering.
params_usedA place to store the list of actual Gda::Holder objects in params used to do the rendering, or 0.
Returns
A new string if no error occurred.

Friends And Related Function Documentation

Glib::RefPtr< Gnome::Gda::Statement > wrap ( GdaStatement *  object,
bool  take_copy = false 
)
related

A Glib::wrap() method for this object.

Parameters
objectThe C instance.
take_copyFalse if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns
A C++ instance that wraps this C instance.

The documentation for this class was generated from the following file:
  • libgdamm/statement.h