libgdamm: Gnome::Gda::ServerProvider Class Reference

libgdamm 4.99.9

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Related Functions | List of all members
Gnome::Gda::ServerProvider Class Reference

Base class for all the DBMS providers. More...

Inheritance diagram for Gnome::Gda::ServerProvider:
[legend]
Collaboration diagram for Gnome::Gda::ServerProvider:
[legend]

## Public Member Functions
virtual | ~ServerProvider ()
GdaServerProvider* | gobj ()
| Provides access to the underlying C GObject. More...
const GdaServerProvider* | gobj () const
| Provides access to the underlying C GObject. More...
GdaServerProvider* | 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::ustring | get_version () const
| Get the version of the provider. More...
Glib::ustring | get_server_version (const Glib::RefPtr< Connection >& cnc) const
| Get the version of the database to which the connection is opened. More...
bool | supports_operation (const Glib::RefPtr< Connection >& cnc, ServerOperationType type, const Glib::RefPtr< Set >& options) const
| Tells if provider supports the type of operation on the cnc connection, using the (optional) options parameters. More...
bool | supports_operation (const Glib::RefPtr< Connection >& cnc, ServerOperationType type) const
Glib::RefPtr< ServerOperation > | create_operation (const Glib::RefPtr< Connection >& cnc, ServerOperationType type, const Glib::RefPtr< Set >& options)
| Creates a new Gda::ServerOperation object which can be modified in order to perform the type type of action. More...
Glib::RefPtr< ServerOperation > | create_operation (const Glib::RefPtr< Connection >& cnc, ServerOperationType type)
| Creates a new Gda::ServerOperation object which can be modified in order to perform the type type of action. More...
Glib::ustring | render_operation (const Glib::RefPtr< Connection >& cnc, const Glib::RefPtr< ServerOperation >& op)
| Creates an SQL statement (possibly using some specific extensions of the DBMS) corresponding to the op operation. More...
bool | perform_operation (const Glib::RefPtr< Connection >& cnc, const Glib::RefPtr< ServerOperation >& op)
| Performs the operation described by op. More...
bool | supports_feature (const Glib::RefPtr< Connection >& cnc, ConnectionFeature feature) const
| Tests if a feature is supported. More...
Glib::ustring | value_to_sql_string (const Glib::RefPtr< Connection >& cnc, const Value& from) const
| Produces a fully quoted and escaped string from a GValue. More...
Glib::ustring | escape_string (const Glib::RefPtr< Connection >& cnc, const Glib::ustring& str) const
| Escapes str for use within an SQL command (to avoid SQL injection attacks). More...
Glib::ustring | unescape_string (const Glib::RefPtr< Connection >& cnc, const Glib::ustring& str) const
| Unescapes str for use within an SQL command. More...
Glib::RefPtr< DataHandler > | get_data_handler_dbms (const Glib::RefPtr< Connection >& cnc, const Glib::ustring& for_type)
| Find a Gda::DataHandler object to manipulate data of type for_type. More...
Glib::RefPtr< const DataHandler > | get_data_handler_dbms (const Glib::RefPtr< Connection >& cnc, const Glib::ustring& for_type) const
| Find a Gda::DataHandler object to manipulate data of type for_type. More...
Glib::RefPtr< DataHandler > | get_data_handler_g_type (const Glib::RefPtr< Connection >& cnc, GType for_type)
| Find a Gda::DataHandler object to manipulate data of type for_type. More...
Glib::RefPtr< const DataHandler > | get_data_handler_g_type (const Glib::RefPtr< Connection >& cnc, GType for_type) const
| Find a Gda::DataHandler object to manipulate data of type for_type. More...
Glib::ustring | get_default_dbms_type (const Glib::RefPtr< Connection >& cnc, GType type) const
| Get the name of the most common data type which has type type. More...
Glib::ustring | get_name () const
| Get the name (identifier) of the provider. More...
Glib::RefPtr< SqlParser > | create_parser (const Glib::RefPtr< Connection >& cnc)
| Creates a new Gda::SqlParser object which is adapted to provider (and possibly depending on cnc for the actual database version). More...
Value | string_to_value (const Glib::RefPtr< Connection >& cnc, const Glib::ustring&string, GType prefered_type, Glib::ustring& dbms_type) const
| Use provider to create a new Value from a single string representation. More...
Glib::RefPtr< DataHandler > | get_data_handler_default (const Glib::RefPtr< Connection >& cnc, GType type, const Glib::ustring& dbms_type)
| Provides the implementation when the default Libgda's data handlers must be used. More...
std::string | find_file (const std::string& inst_dir, const std::string& filename)
| Finds the location of a filename. More...
bool | perform_operation_default (const Glib::RefPtr< Connection >& cnc, const Glib::RefPtr< ServerOperation >& op)
| Performs the operation described by op, using the SQL from the rendering of the operation. More...
Public Member Functions inherited from Glib::Object
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::Object > | wrap (GObject *object, bool take_copy=false)
Public Member Functions inherited from Glib::ObjectBase
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 ()
void | add_destroy_notify_callback (void *data, func_destroy_notify func) const
void | notify_callbacks ()
trackable & | operator= (const trackable &src)
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...

## Related Functions
(Note that these are not member functions.)
Glib::RefPtr< Gnome::Gda::ServerProvider > | wrap (GdaServerProvider* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...

## Additional Inherited Members
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
Protected Member Functions inherited from Glib::Object
| Object ()
| Object (const Glib::ConstructParams &construct_params)
| Object (GObject *castitem)
virtual | ~Object ()
Protected Member Functions inherited from Glib::ObjectBase
| ObjectBase ()
| ObjectBase (const char *custom_type_name)
| ObjectBase (const std::type_info &custom_type_info)
virtual | ~ObjectBase ()=0
void | initialize (GObject *castitem)

## Detailed Description

Base class for all the DBMS providers.

The ServerProvider class is an abstract class which all the DBMS providers must inherit, and implement its virtual methods.

## Constructor & Destructor Documentation

virtual Gnome::Gda::ServerProvider::~ServerProvider | ( |  | ) |
| virtual

## Member Function Documentation

Glib::RefPtr<ServerOperation> Gnome::Gda::ServerProvider::create_operation | ( | const Glib::RefPtr< Connection >& | cnc,
|  | ServerOperationType | type,
|  | const Glib::RefPtr< Set >& | options
| ) |  |

Creates a new Gda::ServerOperation object which can be modified in order to perform the type type of action.

The options can contain:

- named values which ID is a path in the resulting GdaServerOperation object, to initialize some value
- named values which may change the contents of the GdaServerOperation, see this section for more information

Parameters

  cnc | A Gda::Connection object which will be used to perform an action, or `0`.
  type | The type of operation requested.
  options | An optional list of parameters.

Returns
  A new Gda::ServerOperation object, or `0` in the provider does not support the type type of operation or if an error occurred.

Glib::RefPtr<ServerOperation> Gnome::Gda::ServerProvider::create_operation | ( | const Glib::RefPtr< Connection >& | cnc,
|  | ServerOperationType | type
| ) |  |

Creates a new Gda::ServerOperation object which can be modified in order to perform the type type of action.

The options can contain: <itemizedlist> <listitem>named values which ID is a path in the resulting GdaServerOperation object, to initialize some value</listitem> <listitem>named values which may change the contents of the GdaServerOperation, see this section for more information</listitem> </itemizedlist>

Parameters

  cnc | A Gda::Connection object which will be used to perform an action, or `0`.
  type | The type of operation requested.

Returns
  A new Gda::ServerOperation object, or `0` in the provider does not support the type type of operation or if an error occurred.

Glib::RefPtr<SqlParser> Gnome::Gda::ServerProvider::create_parser | ( | const Glib::RefPtr< Connection >& | cnc | ) |

Creates a new Gda::SqlParser object which is adapted to provider (and possibly depending on cnc for the actual database version).

If prov does not have its own parser, then `0` is returned, and a general SQL parser can be obtained using Gda::SqlParser::new().

Parameters

  cnc | A Gda::Connection, or `0`.

Returns
  A new Gda::SqlParser object, or `0`.

Glib::ustring Gnome::Gda::ServerProvider::escape_string | ( | const Glib::RefPtr< Connection >& | cnc,
|  | const Glib::ustring & | str
| ) |  | const

Escapes str for use within an SQL command (to avoid SQL injection attacks).

Note that the returned value still needs to be enclosed in single quotes before being used in an SQL statement.

Parameters

  cnc | A Gda::Connection object, or `0`.
  str | A string to escape.

Returns
  A new string suitable to use in SQL statements.

std::string Gnome::Gda::ServerProvider::find_file | ( | const std::string & | inst_dir,
|  | const std::string & | filename
| ) |  |

Finds the location of a filename.

This function should only be used by database provider's implementations

Parameters

  inst_dir | Directory where prov is installed.
  filename | Name of the file to find.

Returns
  The complete path to filename, or `0` if not found.

Glib::RefPtr<DataHandler> Gnome::Gda::ServerProvider::get_data_handler_dbms | ( | const Glib::RefPtr< Connection >& | cnc,
|  | const Glib::ustring & | for_type
| ) |  |

Find a Gda::DataHandler object to manipulate data of type for_type.

Parameters

  cnc | A Gda::Connection object, or `0`.
  for_type | A DBMS type definition.

Returns
  A Gda::DataHandler, or `0` if the provider does not know about the for_type type.

Glib::RefPtr<const DataHandler> Gnome::Gda::ServerProvider::get_data_handler_dbms | ( | const Glib::RefPtr< Connection >& | cnc,
|  | const Glib::ustring & | for_type
| ) |  | const

Find a Gda::DataHandler object to manipulate data of type for_type.

Parameters

  cnc | A Gda::Connection object, or `0`.
  for_type | A DBMS type definition.

Returns
  A Gda::DataHandler, or `0` if the provider does not know about the for_type type.

Glib::RefPtr<DataHandler> Gnome::Gda::ServerProvider::get_data_handler_default | ( | const Glib::RefPtr< Connection >& | cnc,
|  | GType | type,
|  | const Glib::ustring & | dbms_type
| ) |  |

Provides the implementation when the default Libgda's data handlers must be used.

Parameters

  cnc | A Gda::Connection object, or `0`.
  type | A Type.
  dbms_type | A DBMS type definition.

Returns
  A Gda::DataHandler, or `0`.

Glib::RefPtr<DataHandler> Gnome::Gda::ServerProvider::get_data_handler_g_type | ( | const Glib::RefPtr< Connection >& | cnc,
|  | GType | for_type
| ) |  |

Find a Gda::DataHandler object to manipulate data of type for_type.

The returned object must not be modified.

Parameters

  cnc | A Gda::Connection object, or `0`.
  for_type | A Type.

Returns
  A Gda::DataHandler, or `0` if the provider does not support the requested for_type data type.

Glib::RefPtr<const DataHandler> Gnome::Gda::ServerProvider::get_data_handler_g_type | ( | const Glib::RefPtr< Connection >& | cnc,
|  | GType | for_type
| ) |  | const

Find a Gda::DataHandler object to manipulate data of type for_type.

The returned object must not be modified.

Parameters

  cnc | A Gda::Connection object, or `0`.
  for_type | A Type.

Returns
  A Gda::DataHandler, or `0` if the provider does not support the requested for_type data type.

Glib::ustring Gnome::Gda::ServerProvider::get_default_dbms_type | ( | const Glib::RefPtr< Connection >& | cnc,
|  | GType | type
| ) |  | const

Get the name of the most common data type which has type type.

The returned value may be `0` either if the provider does not implement that method, or if there is no DBMS data type which could contain data of the g_type type (for example `0` may be returned if a DBMS has integers only up to 4 bytes and a G_TYPE_INT64 is requested).

Parameters

  cnc | A Gda::Connection object or `0`.
  type | A Type value type.

Returns
  The name of the DBMS type, or `0`.

Glib::ustring Gnome::Gda::ServerProvider::get_name | ( |  | ) | const

Get the name (identifier) of the provider.

Returns
  A string containing the provider's name.

Glib::ustring Gnome::Gda::ServerProvider::get_server_version | ( | const Glib::RefPtr< Connection >& | cnc | ) | const

Get the version of the database to which the connection is opened.

Parameters

  cnc | A Gda::Connection object.

Returns
  A (read only) string, or `0` if an error occurred.

static GType Gnome::Gda::ServerProvider::get_type | ( |  | ) |
| static

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

Glib::ustring Gnome::Gda::ServerProvider::get_version | ( |  | ) | const

Get the version of the provider.

Returns
  A string containing the version identification.

GdaServerProvider* Gnome::Gda::ServerProvider::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

const GdaServerProvider* Gnome::Gda::ServerProvider::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

GdaServerProvider* Gnome::Gda::ServerProvider::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::ServerProvider::perform_operation | ( | const Glib::RefPtr< Connection >& | cnc,
|  | const Glib::RefPtr< ServerOperation >& | op
| ) |  |

Performs the operation described by op.

Note that op is not destroyed by this method and can be reused.

Parameters

  cnc | A Gda::Connection object which will be used to perform the action, or `0`.
  op | A Gda::ServerOperation object.

Returns
  `true` if no error occurred.

bool Gnome::Gda::ServerProvider::perform_operation_default | ( | const Glib::RefPtr< Connection >& | cnc,
|  | const Glib::RefPtr< ServerOperation >& | op
| ) |  |

Performs the operation described by op, using the SQL from the rendering of the operation.

Parameters

  cnc | A Gda::Connection object which will be used to perform an action, or `0`.
  op | A Gda::ServerOperation object.

Returns
  `true` if no error occurred.

Glib::ustring Gnome::Gda::ServerProvider::render_operation | ( | const Glib::RefPtr< Connection >& | cnc,
|  | const Glib::RefPtr< ServerOperation >& | op
| ) |  |

Creates an SQL statement (possibly using some specific extensions of the DBMS) corresponding to the op operation.

Note that the returned string may actually contain more than one SQL statement.

This function's purpose is mainly informative to get the actual SQL code which would be executed to perform the operation; to actually perform the operation, use perform_operation().

Parameters

  cnc | A Gda::Connection object which will be used to render the action, or `0`.
  op | A Gda::ServerOperation object.

Returns
  A new string, or `0` if an error occurred or operation cannot be rendered as SQL.

Value Gnome::Gda::ServerProvider::string_to_value | ( | const Glib::RefPtr< Connection >& | cnc,
|  | const Glib::ustring & | string,
|  | GType | prefered_type,
|  | Glib::ustring & | dbms_type
| ) |  | const

Use provider to create a new Value from a single string representation.

The preferred_type can optionally ask provider to return a Value of the requested type (but if such a value can't be created from string, then `0` is returned); pass G_TYPE_INVALID if any returned type is acceptable.

The returned value is either a new Value or `0` in the following cases:

- string cannot be converted to preferred_type type
- the provider does not handle preferred_type
- the provider could not make a Value from string

If dbms_type is not `0`, then if will contain a constant string representing the database type used for the conversion if the conversion was successfull, or `0` otherwise.

Parameters

  cnc | A Gda::Connection object, or `0`.
  string | The SQL string to convert to a value.
  preferred_type | A Type, or G_TYPE_INVALID.
  dbms_type | Place to get the actual database type used if the conversion succeeded, or `0`.

Returns
  A new Value, or `0`.

bool Gnome::Gda::ServerProvider::supports_feature | ( | const Glib::RefPtr< Connection >& | cnc,
|  | ConnectionFeature | feature
| ) |  | const

Tests if a feature is supported.

Parameters

  cnc | A Gda::Connection object, or `0`.
  feature | Gda::ConnectionFeature feature to test.

Returns
  `true` if feature is supported.

bool Gnome::Gda::ServerProvider::supports_operation | ( | const Glib::RefPtr< Connection >& | cnc,
|  | ServerOperationType | type,
|  | const Glib::RefPtr< Set >& | options
| ) |  | const

Tells if provider supports the type of operation on the cnc connection, using the (optional) options parameters.

Parameters

  cnc | A Gda::Connection object which would be used to perform an action, or `0`.
  type | The type of operation requested.
  options | A list of named parameters, or `0`.

Returns
  `true` if the operation is supported.

bool Gnome::Gda::ServerProvider::supports_operation | ( | const Glib::RefPtr< Connection >& | cnc,
|  | ServerOperationType | type
| ) |  | const

Glib::ustring Gnome::Gda::ServerProvider::unescape_string | ( | const Glib::RefPtr< Connection >& | cnc,
|  | const Glib::ustring & | str
| ) |  | const

Unescapes str for use within an SQL command.

This is the exact opposite of escape_string().

Parameters

  cnc | A Gda::Connection object, or `0`.
  str | A string to escape.

Returns
  A new string.

Glib::ustring Gnome::Gda::ServerProvider::value_to_sql_string | ( | const Glib::RefPtr< Connection >& | cnc,
|  | const Value& | from
| ) |  | const

Produces a fully quoted and escaped string from a GValue.

Parameters

  cnc | A Gda::Connection object, or `0`.
  from | Value to convert from.

Returns
  Escaped and quoted value or `0` if not supported.

## Friends And Related Function Documentation

Glib::RefPtr< Gnome::Gda::ServerProvider > wrap | ( | GdaServerProvider * | object,
|  | bool | take_copy = `false`
| ) |  |
| related

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

Parameters

  object | The C instance.
  take_copy | False 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/serverprovider.h