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



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'ext/gda/gda.c', line 68

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

    TypedData_Get_Struct(self, GdaSqlParser, &parser_type, parser);

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

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

    return TypedData_Wrap_Struct(cStatement, &statement_type, stmt);
}