From a1aa2b8813ff52e017e9686034010c045aea59fe Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Tue, 3 Feb 2009 21:35:01 +0100 Subject: [PATCH] dbi plugin: Use the server version to only use appropriate queries. --- src/dbi.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/dbi.c b/src/dbi.c index ee436023..a542df32 100644 --- a/src/dbi.c +++ b/src/dbi.c @@ -712,14 +712,25 @@ static int cdbi_read_database (cdbi_database_t *db) /* {{{ */ int success; int status; + unsigned int db_version; + status = cdbi_connect_database (db); if (status != 0) return (status); assert (db->connection != NULL); + db_version = dbi_conn_get_engine_version (db->connection); + /* TODO: Complain if `db_version == 0' */ + success = 0; for (i = 0; i < db->queries_num; i++) { + /* Check if we know the database's version and if so, if this query applies + * to that version. */ + if ((db_version != 0) + && (udb_query_check_version (db->queries[i], db_version) == 0)) + continue; + status = cdbi_read_database_query (db, db->queries[i]); if (status == 0) success++; -- 2.11.0