Skip to content

Commit

Permalink
add stubs of data service, data, trigger history
Browse files Browse the repository at this point in the history
  • Loading branch information
erilong committed Oct 13, 2015
1 parent 2b0ea71 commit 6dede24
Show file tree
Hide file tree
Showing 4 changed files with 151 additions and 0 deletions.
35 changes: 35 additions & 0 deletions symmetric-client-clib/inc/model/Data.h
@@ -0,0 +1,35 @@
/**
* Licensed to JumpMind Inc under one or more contributor
* license agreements. See the NOTICE file distributed
* with this work for additional information regarding
* copyright ownership. JumpMind Inc licenses this file
* to you under the GNU General Public License, version 3.0 (GPLv3)
* (the "License"); you may not use this file except in compliance
* with the License.
*
* You should have received a copy of the GNU General Public License,
* version 3.0 (GPLv3) along with this library; if not, see
* <http://www.gnu.org/licenses/>.
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#ifndef SYM_DATA_H
#define SYM_DATA_H

#include "io/data/CsvData.h"
#include "model/TriggerHistory.h"

typedef struct SymData {
SymDataEventType dataEventType;
SymStringArray *rowData;
SymStringArray *oldData;
SymStringArray *pkData;
SymTriggerHistory *triggerHistory;
} SymData;

#endif
42 changes: 42 additions & 0 deletions symmetric-client-clib/inc/model/TriggerHistory.h
@@ -0,0 +1,42 @@
/**
* Licensed to JumpMind Inc under one or more contributor
* license agreements. See the NOTICE file distributed
* with this work for additional information regarding
* copyright ownership. JumpMind Inc licenses this file
* to you under the GNU General Public License, version 3.0 (GPLv3)
* (the "License"); you may not use this file except in compliance
* with the License.
*
* You should have received a copy of the GNU General Public License,
* version 3.0 (GPLv3) along with this library; if not, see
* <http://www.gnu.org/licenses/>.
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#ifndef SYM_TRIGGER_HISTORY_H
#define SYM_TRIGGER_HISTORY_H

typedef struct SymTriggerHistory {
int triggerHistoryId;
char *triggerId;
char *sourceTableName;
char *sourceSchemaName;
char *sourceCatalogName;
SymDate *createTime;
char *columnNames;
SymStringArray *parsedColumnNames;
char *pkColumnNames;
SymStringArray *parsedPkColumnNames;
char *nameForInsertTrigger;
char *nameForUpdateTrigger;
char *nameForDeleteTrigger;
char *errorMessage;
SymDate *inactiveTime;
} SymTriggerHistory;

#endif
39 changes: 39 additions & 0 deletions symmetric-client-clib/inc/service/DataService.h
@@ -0,0 +1,39 @@
/**
* Licensed to JumpMind Inc under one or more contributor
* license agreements. See the NOTICE file distributed
* with this work for additional information regarding
* copyright ownership. JumpMind Inc licenses this file
* to you under the GNU General Public License, version 3.0 (GPLv3)
* (the "License"); you may not use this file except in compliance
* with the License.
*
* You should have received a copy of the GNU General Public License,
* version 3.0 (GPLv3) along with this library; if not, see
* <http://www.gnu.org/licenses/>.
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#ifndef SYM_DATA_SERVICE_H
#define SYM_DATA_SERVICE_H

#include <stdio.h>
#include <stdlib.h>
#include "db/platform/DatabasePlatform.h"
#include "model/Data.h"
#include "io/data/Batch.h"
#include "util/List.h"

typedef struct SymDataService {
SymDatabasePlatform *platform;
SymData * (*selectDataFor)(struct SymDataService *this, SymBatch *batch);
void (*destroy)(struct SymDataService *this);
} SymDataService;

SymDataService * SymDataService_new(SymDataService *this, SymDatabasePlatform *platform);

#endif
35 changes: 35 additions & 0 deletions symmetric-client-clib/src/service/DataService.c
@@ -0,0 +1,35 @@
/**
* Licensed to JumpMind Inc under one or more contributor
* license agreements. See the NOTICE file distributed
* with this work for additional information regarding
* copyright ownership. JumpMind Inc licenses this file
* to you under the GNU General Public License, version 3.0 (GPLv3)
* (the "License"); you may not use this file except in compliance
* with the License.
*
* You should have received a copy of the GNU General Public License,
* version 3.0 (GPLv3) along with this library; if not, see
* <http://www.gnu.org/licenses/>.
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#include "service/DataService.h"

void SymDataService_destroy(SymDataService *this) {
free(this);
}

SymDataService * SymDataService_new(SymDataService *this, SymDatabasePlatform *platform) {
if (this == NULL) {
this = (SymDataService *) calloc(1, sizeof(SymDataService));
}
this->platform = platform;
this->destroy = (void *) &SymDataService_destroy;
return this;
}

0 comments on commit 6dede24

Please sign in to comment.