# Gnome::Gda::SqlParser Class Reference

SQL parser. More...

Inherits Glib::Object.

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

List of all members.

## Public Member Functions
virtual | ~SqlParser ()
GdaSqlParser* | gobj ()
| Provides access to the underlying C GObject.
const GdaSqlParser* | gobj () const
| Provides access to the underlying C GObject.
GdaSqlParser* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
Glib::RefPtr< Statement > | parse_string (const Glib::ustring& sql, Glib::ustring& remain)
Glib::RefPtr< Statement > | parse_string (const Glib::ustring& sql)
Glib::RefPtr< Batch > | parse_string_as_batch (const Glib::ustring& sql, Glib::ustring& remain)
Glib::RefPtr< Batch > | parse_string_as_batch (const Glib::ustring& sql)
Glib::PropertyProxy_ReadOnly< int > | property_column_error () const
| You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly< int > | property_line_error () const
| You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy< int > | property_mode ()
| You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly< int > | property_mode () const
| You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy< int > | property_tokenizer_flavour ()
| You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly< int > | property_tokenizer_flavour () const
| You rarely need to use properties because there are get_ and set_ methods for almost all of them.
## Static Public Member Functions
static Glib::RefPtr< SqlParser > | create ()
## Protected Member Functions
| SqlParser ()
## Related Functions
(Note that these are not member functions.)
Glib::RefPtr < Gnome::Gda::SqlParser > | wrap (GdaSqlParser* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

SQL parser.

The Gda::SqlParser is an object dedicated to creating Gda::Statement and Gda::Batch objects from SQL strings. The actual contents of the parsed statements is represented as Gda::SqlStatement structures (which can be obtained from any Gda::Statement through the "structure" property).

Gda::SqlParser parsers can be created by calling Gda::ServerProvider::create_parser() for a provider adapted SQL parser, or using create() for a general purpose SQL parser.

The Gda::SqlParser can either work in "parse" mode where it will try to parse the SQL string, or in "delimiter" mode where it will only attempt at delimiting SQL statements in a string which may contain several SQL statements (usually separated by a semi column). If operating in "parser" mode, and the parser can't correctly parse the string, then it will switch to the "delimiter" mode for the next statement in the string to parse (and create a STATEMENT_UNKNOWN statement).

The Gda::SqlParser object parses and analyses SQL statements and reports the following statement types:

- SELECT (and COMPOUND select), INSERT, UPDATE and DELETE SQL statements should be completely parsed.

- Transaction related statements (corresponding to the BEGIN, COMMIT, ROLLBACK, SAVEPOINT, ROLLBACK SAVEPOINT and DELETE SAVEPOINT) are parsed and a minimalist structure is created to extract some information (that structure is not enough per-se to re-create the complete SQL statement).

Any other type of SQL statement (CREATE TABLE, ...) creates a GdaStatement of type STATEMENT_UNKNOWN, and it only able to locate place holders (variables) and end of statement marks.

NOTE: Any SQL of a type which should be parsed which but which creates a Gda::Statement of type GDA_SQL_STATEMENT_UNKNOWN (check with Gda::Statement::get_statement_type()) should be reported as a bug.

The Gda::SqlParser object recognizes place holders (variables), which can later be queried and valued using Gda::Statement::get_parameters(). The folllowing syntax are recognized (other syntaxes might be recognized for specific database providers if the Gda::SqlParser is created using Gda::ServerProvider::create_parser() but for portability reasons it's better to avoid them):

- #NAME[TYPE[NULL]]: for a variable named NAME with the optional type TYPE (which can be a GType name or a custom database type name), and with the optional "::NULL" to instruct that the variable can be NULL.
- ## //

  * name:NAME [type:TYPE] [nullok:[TRUE|FALSE]] [descr:DESCR] *

  / for a variable named NAME with the optional type TYPE (which can be a GType name or a custom database type name), with the optional "nullok" attribute and an optional description DESCR. Note that the NAME, TYPE and DESCR literals here must be quoted (simple or double quotes) if they include non alphanumeric characters, and that there must always be at least a space between the ## and the //

  * ... *

  /.

## Constructor & Destructor Documentation

virtual Gnome::Gda::SqlParser::~SqlParser | ( |  | ) | `[virtual]`

Gnome::Gda::SqlParser::SqlParser | ( |  | ) | `[protected]`

## Member Function Documentation

static Glib::RefPtr<SqlParser> Gnome::Gda::SqlParser::create | ( |  | ) | `[static]`

const GdaSqlParser* Gnome::Gda::SqlParser::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

GdaSqlParser* Gnome::Gda::SqlParser::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

GdaSqlParser* Gnome::Gda::SqlParser::gobj_copy | ( |  | ) |

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

Glib::RefPtr<Statement> Gnome::Gda::SqlParser::parse_string | ( | const Glib::ustring & | sql | ) |

Glib::RefPtr<Statement> Gnome::Gda::SqlParser::parse_string | ( | const Glib::ustring & | sql,
|  | Glib::ustring & | remain |
| ) |  |  |

Glib::RefPtr<Batch> Gnome::Gda::SqlParser::parse_string_as_batch | ( | const Glib::ustring & | sql | ) |

Glib::RefPtr<Batch> Gnome::Gda::SqlParser::parse_string_as_batch | ( | const Glib::ustring & | sql,
|  | Glib::ustring & | remain |
| ) |  |  |

Glib::PropertyProxy_ReadOnly<int> Gnome::Gda::SqlParser::property_column_error | ( |  | ) | const

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<int> Gnome::Gda::SqlParser::property_line_error | ( |  | ) | const

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<int> Gnome::Gda::SqlParser::property_mode | ( |  | ) | const

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<int> Gnome::Gda::SqlParser::property_mode | ( |  | ) |

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<int> Gnome::Gda::SqlParser::property_tokenizer_flavour | ( |  | ) | const

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<int> Gnome::Gda::SqlParser::property_tokenizer_flavour | ( |  | ) |

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

## Friends And Related Function Documentation

Glib::RefPtr< Gnome::Gda::SqlParser > wrap | ( | GdaSqlParser * | 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/sqlparser.h