Skip to content

Commit

Permalink
Assume a failure in schema version check means it's not loaded.
Browse files Browse the repository at this point in the history
If the schema version check fails in the prepare statement phase, that
probably means that the schema's not loaded (the riker table is
missing).
Try to load the schema - if something's really wrong, it'll fail again
later.

References: gh-10
  • Loading branch information
kepstin committed Feb 13, 2012
1 parent e0fd535 commit 348de0a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions gdastore/store.vala
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,16 @@ public class Store: Object {
var stmt = builder.get_statement();
data = connection.statement_execute_select(stmt, null);
} catch (Error error) {
stderr.printf("%s %d %s\n", error.domain.to_string(), error.code, error.message);
throw new StoreError.OPEN_FAILED("Failed to check schema version: " + error.message);
if (error.domain == Gda.ServerProvider.error_quark() &&
error.code == Gda.ServerProviderError.PREPARE_STMT_ERROR) {
/*
* This error probably means that the schema's
* not loaded. So try to load it here.
*/
initialize_schema();
} else {
throw new StoreError.OPEN_FAILED("Failed to check schema version: " + error.message);
}
}
}

Expand Down

0 comments on commit 348de0a

Please sign in to comment.