libgdamm: Gnome::Gda::ServerProvider Class Reference

libgdamm 4.99.6

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

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

Public Member Functions | Related Functions
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]

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.
get_version () const
| Get the version of the provider.
Connection >& cnc) const
| Get the version of the database to which the connection is opened.
bool | supports_operation (const Set >& options) const
| Tells if provider supports the type of operation on the cnc connection, using the (optional) options parameters.
bool | supports_operation (const type) const
Set >& options)
| Creates a new Gda::ServerOperation object which can be modified in order to perform the type type of action.
type)
| Creates a new Gda::ServerOperation object which can be modified in order to perform the type type of action.
ServerOperation >& op)
| Creates an SQL statement (possibly using some specific extensions of the DBMS) corresponding to the op operation.
bool | perform_operation (const ServerOperation >& op)
| Performs the operation described by op.
bool | supports_feature (const ConnectionFeature feature) const
| Tests if a feature is supported.
Value& from) const
| Produces a fully quoted and escaped string from a GValue.
Glib::ustring& str) const
| Escapes str for use within an SQL command (to avoid SQL injection attacks).
Glib::ustring& str) const
| Unescapes str for use within an SQL command.
Glib::ustring& for_type)
| Find a Gda::DataHandler object to manipulate data of type for_type.
Glib::ustring& for_type) const
| Find a Gda::DataHandler object to manipulate data of type for_type.
Connection >& cnc, GType for_type)
| Find a Gda::DataHandler object to manipulate data of type for_type.
Connection >& cnc, GType for_type) const
| Find a Gda::DataHandler object to manipulate data of type for_type.
type) const
| Get the name of the most common data type which has type type.
get_name () const
| Get the name (identifier) of the provider.
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::ustring& dbms_type) const
| Use provider to create a new Value from a single string representation.
Glib::ustring& dbms_type)
| Provides the implementation when the default Libgda's data handlers must be used.
std::string& filename)
| Finds the location of a filename.
bool | perform_operation_default (const 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.)
< Gnome::Gda::ServerProvider > | wrap (GdaServerProvider* object, bool take_copy=false)
| A

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

ServerOperation> Gnome::Gda::ServerProvider::create_operation | ( | const Connection >& | cnc,
|  | ServerOperationType | type,
|  | const 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.

ServerOperation> Gnome::Gda::ServerProvider::create_operation | ( | const 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.

SqlParser> Gnome::Gda::ServerProvider::create_parser | ( | const 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 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.

DataHandler> Gnome::Gda::ServerProvider::get_data_handler_dbms | ( | const 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.

DataHandler> Gnome::Gda::ServerProvider::get_data_handler_dbms | ( | const 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.

DataHandler> Gnome::Gda::ServerProvider::get_data_handler_default | ( | const 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`.

DataHandler> Gnome::Gda::ServerProvider::get_data_handler_g_type | ( | const 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.

DataHandler> Gnome::Gda::ServerProvider::get_data_handler_g_type | ( | const 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 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 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.

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

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

const GdaServerProvider* Gnome::Gda::ServerProvider::gobj | ( |  | ) | const`[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 Connection >& | cnc,
|  | const 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 Connection >& | cnc,
|  | const 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 Connection >& | cnc,
|  | const 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 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 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 Connection >& | cnc,
|  | ServerOperationType | type,
|  | const 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 Connection >& | cnc,
|  | ServerOperationType | type
| ) |  | const

Glib::ustring Gnome::Gda::ServerProvider::unescape_string | ( | const 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 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

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