Re: [gnome-db] Connection between GdaStatement and GdaSqlStatement



On Mon, May 12, 2008 at 2:17 PM, Phil Longstaff <plongstaff rogers com> wrote:
> What is the connection between these objects?  GdaConnection requires a
>  GdaStatement to execute, and there are lots of
>  GdaSqlStatement/GdaSqlStatementSelect/... objects and structs, but how
>  to I get a GdaStatement if I have a GdaSqlStatement?
>

GdaStatement is a "high level" GObject representing a statement,
whereas GdaSqlStatement is the "low level" C structure (internally
used by GdaStatement). GdaSqlStatement represents a tree of C
structures (all of them declared in the sql-parser/ dir).

You don't have to care about GdaSqlStatement unless you want to create
your own statements from scratch (eg not from SQL). If you have som
SQL and want a GdaStatement object, use a parser object
(GdaSqlParser).

If you have a GdaSqlStatement, then you can create a GdaStatement as:
GdaStatement *stmt;
GdaSqlStatement *sql_stmt;

sql_stmt=...
stmt = (GdaStatement*) g_object_new (GDA_TYPE_STATEMENT, "structure",
sql_stmt, NULL)
gda_sql_statement_free (sql_stmt);

or

stmt = gda_statement_new ();
g_object_set (stmt, "structure", sql_stmt, NULL);
gda_sql_statement_free (sql_stmt);

Cheers,

Vivien


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]