# Gnome::Gda::ServerProvider Class Reference

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

Inherits Glib::Object.

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

List of all members.

## Public Member Functions
virtual | ~ServerProvider ()
GdaServerProvider* | gobj ()
| Provides access to the underlying C GObject.
const GdaServerProvider* | gobj () const
| Provides access to the underlying C GObject.
GdaServerProvider* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
Glib::ustring | get_version () const
| Get the version of the provider.
Glib::ustring | get_server_version (const Glib::RefPtr< Connection >& cnc) const
| Get the version of the database to which the connection is opened.
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.
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.
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.
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.
bool | perform_operation (const Glib::RefPtr< Connection >& cnc, const Glib::RefPtr< ServerOperation >& op)
| Performs the operation described by op.
bool | supports_feature (const Glib::RefPtr< Connection >& cnc, ConnectionFeature feature) const
| Tests if a feature is supported.
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.
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).
Glib::ustring | unescape_string (const Glib::RefPtr< Connection >& cnc, const Glib::ustring& str) const
| Unescapes str for use within an SQL command.
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.
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.
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.
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.
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.
Glib::ustring | get_name () const
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).
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.
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.
std::string | find_file (const std::string& inst_dir, const std::string& filename)
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.
## 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.

## 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 |
| ) |  |  |

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<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: <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.
  | 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<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_sql_parser_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 |
| ) |  |  |

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_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<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`.
  | for_type | A Type.
  | dbms_type | A DBMS type definition.

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

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::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::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

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.

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

Get the version of the provider.

Returns:
  A string containing the version identification.

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

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

GdaServerProvider* Gnome::Gda::ServerProvider::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

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
  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.

  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.

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