Skip to content

Commit

Permalink
add countIncomingBatchesInError
Browse files Browse the repository at this point in the history
  • Loading branch information
erilong committed Dec 14, 2015
1 parent c171cf8 commit 9269eb7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion symmetric-client-clib/inc/model/Node.h
Expand Up @@ -23,7 +23,7 @@

#include <stdlib.h>

#define SYM_VERSION "3.7.27.2"
#define SYM_VERSION "3.7.27.3"

typedef enum SymNodeStatus {
SYM_NODE_STATUS_DATA_LOAD_NOT_STARTED,
Expand Down
3 changes: 3 additions & 0 deletions symmetric-client-clib/inc/service/IncomingBatchService.h
Expand Up @@ -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;

Expand Down Expand Up @@ -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
7 changes: 7 additions & 0 deletions symmetric-client-clib/src/service/IncomingBatchService.c
Expand Up @@ -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);
}
Expand All @@ -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;
}

0 comments on commit 9269eb7

Please sign in to comment.