## Validate a DML statement

Libgda supports validating DML (SELECT, INSERT, UPDATE and DELETE) statements: making sure every database object referenced in the statement actually exists in the database being accessed through a connection. The validation process involves the meta data associated to a connection, son one must make that meta data is up to date with the database being accessed, using gda_connection_update_meta_store() (also see the Get information about a table's columns section).

The following code shows how to validate a statement (assuming the statement already exists):

    if (!gda_statement_check_validity (stmt, cnc, &error))
        g_print ("Invalid statement: %s\n",
                 error && error->message ? error->message : "No detail");
    else
        g_print ("Statement is valid\n");