0

Looking at the C examples for monetdbe_query in the GitHub repository: https://github.com/MonetDBSolutions/monetdbe-examples

The prescribed way to run queries is to run SQL queries in an IF statement that captures Null return values as shown below:

if (monetdbe_query(db, "SELECT * FROM mystrings", &result, NULL) != NULL) {
        fprintf(stderr, "Failed to run select query\n");
        goto cleanup;
    }

is it possible to get any detailed information regarding why the SQL statement failed?

arif saeed
  • 33
  • 4

1 Answers1

0

Many monetdbe_ functions return an error message if something went wrong, or NULL otherwise. So, just catch the return value. See the example copy_into.c in monetdbe-examples:

if((err=monetdbe_query(db, sql, NULL, NULL)) != NULL) {
    printf("%s\r\n", err);
    return -1;
}

grep for err in the examples for more.

Jennie
  • 345
  • 1
  • 8