Class: GDA::SQL::Parser

Inherits:
Object
  • Object
show all
Defined in:
ext/gda/gda.c

Instance Method Summary collapse

Instance Method Details

#parse(sql) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'ext/gda/gda.c', line 15

static VALUE parse(VALUE self, VALUE sql)
{
    GdaSqlParser * parser;
    GdaStatement * stmt;
    GError * error = NULL;
    const gchar * rest;

    Data_Get_Struct(self, GdaSqlParser, parser);

    stmt = gda_sql_parser_parse_string(parser, StringValuePtr(sql), &rest, &error);

    if (!stmt) {
	rb_raise(rb_eRuntimeError, "error parsing sql");
    }

    return Data_Wrap_Struct(cStatement, NULL, g_object_unref, stmt);
}