From 9269eb73586ea9507b8a224d3d5b27b3def97b8b Mon Sep 17 00:00:00 2001 From: elong Date: Mon, 14 Dec 2015 14:02:55 -0500 Subject: [PATCH] add countIncomingBatchesInError --- symmetric-client-clib/inc/model/Node.h | 2 +- symmetric-client-clib/inc/service/IncomingBatchService.h | 3 +++ symmetric-client-clib/src/service/IncomingBatchService.c | 7 +++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/symmetric-client-clib/inc/model/Node.h b/symmetric-client-clib/inc/model/Node.h index a39f0c85c2..c33607b3aa 100644 --- a/symmetric-client-clib/inc/model/Node.h +++ b/symmetric-client-clib/inc/model/Node.h @@ -23,7 +23,7 @@ #include -#define SYM_VERSION "3.7.27.2" +#define SYM_VERSION "3.7.27.3" typedef enum SymNodeStatus { SYM_NODE_STATUS_DATA_LOAD_NOT_STARTED, diff --git a/symmetric-client-clib/inc/service/IncomingBatchService.h b/symmetric-client-clib/inc/service/IncomingBatchService.h index 83da9963af..98d149e788 100644 --- a/symmetric-client-clib/inc/service/IncomingBatchService.h +++ b/symmetric-client-clib/inc/service/IncomingBatchService.h @@ -41,6 +41,7 @@ typedef struct SymIncomingBatchService { int (*updateIncomingBatch)(struct SymIncomingBatchService *this, SymIncomingBatch *incomingBatch); int (*deleteIncomingBatch)(struct SymIncomingBatchService *this, SymIncomingBatch *incomingBatch); unsigned short (*isRecordOkBatchesEnabled)(struct SymIncomingBatchService *this); + int (*countIncomingBatchesInError)(struct SymIncomingBatchService *this); void (*destroy)(struct SymIncomingBatchService *this); } SymIncomingBatchService; @@ -69,4 +70,6 @@ where batch_id = ? and node_id = ?" #define SYM_SQL_DELETE_INCOMING_BATCH "delete from sym_incoming_batch where batch_id = ? and node_id = ?" +#define SYM_SQL_COUNT_INCOMING_BATCHES_ERRORS "select count(*) from sym_incoming_batch where error_flag = 1" + #endif diff --git a/symmetric-client-clib/src/service/IncomingBatchService.c b/symmetric-client-clib/src/service/IncomingBatchService.c index f941eb0302..977398c9ff 100644 --- a/symmetric-client-clib/src/service/IncomingBatchService.c +++ b/symmetric-client-clib/src/service/IncomingBatchService.c @@ -182,6 +182,12 @@ int SymIncomingBatchService_deleteIncomingBatch(SymIncomingBatchService *this, S return count; } +int SymIncomingBatchService_countIncomingBatchesInError(SymIncomingBatchService *this) { + SymSqlTemplate *sqlTemplate = this->platform->getSqlTemplate(this->platform); + int error; + return sqlTemplate->queryForInt(sqlTemplate, SYM_SQL_COUNT_INCOMING_BATCHES_ERRORS, NULL, NULL, &error); +} + void SymIncomingBatchService_destroy(SymIncomingBatchService *this) { free(this); } @@ -198,6 +204,7 @@ SymIncomingBatchService * SymIncomingBatchService_new(SymIncomingBatchService *t this->updateIncomingBatch = (void *) &SymIncomingBatchService_updateIncomingBatch; this->deleteIncomingBatch = (void *) &SymIncomingBatchService_deleteIncomingBatch; this->isRecordOkBatchesEnabled = (void *) &SymIncomingBatchService_isRecordOkBatchesEnabled; + this->countIncomingBatchesInError = (void *) &SymIncomingBatchService_countIncomingBatchesInError; this->destroy = (void *) &SymIncomingBatchService_destroy; return this; }