Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add platform, dialect, and dml statement
- Loading branch information
Showing
75 changed files
with
2,470 additions
and
406 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
/** | ||
* 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 "symclient_test.h" | ||
|
||
typedef struct { | ||
int i; | ||
} myobj; | ||
|
||
/* | ||
void SymListTest_test1() { | ||
SymList *list = SymList_new(NULL); | ||
list->add(list, "hola"); | ||
list->add(list, ""); | ||
list->add(list, NULL); | ||
list->add(list, "bonjour"); | ||
CU_ASSERT(strcmp(list->get(list, 0), "hola") == 0); | ||
CU_ASSERT(strcmp(list->get(list, 1), "") == 0); | ||
CU_ASSERT(list->get(list, 2) == NULL); | ||
CU_ASSERT(strcmp(list->get(list, 3), "bonjour") == 0); | ||
CU_ASSERT(list->size == 4); | ||
char **array = (char **) list->to_array(list); | ||
CU_ASSERT(strcmp(array[0], "hola") == 0); | ||
CU_ASSERT(array[1] != NULL); | ||
CU_ASSERT(strcmp(array[1], "") == 0); | ||
CU_ASSERT(array[2] == NULL); | ||
CU_ASSERT(strcmp(array[3], "bonjour") == 0); | ||
CU_ASSERT(array[4] == NULL); | ||
int i; | ||
for (i = 0; array[i] != NULL; i++) { | ||
printf("%d is %s\n", i, array[i]); | ||
} | ||
list->destroy(list); | ||
} | ||
void SymListTest_test2() { | ||
myobj myobjs[3]; | ||
myobjs[0].i = 0; | ||
myobjs[1].i = 1; | ||
myobjs[2].i = 2; | ||
SymList *list = SymList_new(NULL); | ||
list->add(list, &myobjs[0]); | ||
list->add(list, NULL); | ||
list->add(list, &myobjs[2]); | ||
CU_ASSERT(((myobj *) list->get(list, 0))->i == 0); | ||
CU_ASSERT(((myobj *) list->get(list, 1)) == NULL); | ||
CU_ASSERT(((myobj *) list->get(list, 2))->i == 2); | ||
myobj **array = (myobj **) list->to_array(list); | ||
CU_ASSERT(array[0]->i == 0); | ||
CU_ASSERT(array[1] == NULL); | ||
CU_ASSERT(array[2]->i == 2); | ||
int i; | ||
for (i = 0; array[i] != NULL; i++) { | ||
printf("%d is %d\n", i, array[i]->i); | ||
} | ||
list->destroy(list); | ||
} | ||
void SymListTest_test3() { | ||
SymList *list = SymList_new(NULL); | ||
list->add(list, "one string"); | ||
list->add(list, "two thing"); | ||
list->add(list, "red ping"); | ||
list->add(list, "blue ring"); | ||
char **array = (char **) list->to_array_slice(list, 1, 2); | ||
CU_ASSERT(strcmp(array[0], "two thing") == 0); | ||
int i; | ||
for (i = 0; array[i] != NULL; i++) { | ||
printf("%d is %s\n", i, array[i]); | ||
} | ||
list->destroy(list); | ||
} | ||
*/ | ||
|
||
int SymListTest_CUnit() { | ||
CU_pSuite suite = CU_add_suite("SymListTest", NULL, NULL); | ||
if (suite == NULL) { | ||
return CUE_NOSUITE; | ||
} | ||
|
||
/* | ||
if (CU_add_test(suite, "SymListTest_test1", SymListTest_test1) == NULL || | ||
CU_add_test(suite, "SymListTest_test2", SymListTest_test2) == NULL || | ||
CU_add_test(suite, "SymListTest_test3", SymListTest_test3) == NULL) { | ||
return CUE_NOTEST; | ||
} | ||
*/ | ||
return CUE_SUCCESS; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
/** | ||
* 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 "symclient_test.h" | ||
|
||
static void SymMapTest_test_stringmap(int keySize, char **keys, char **values, int mapSize) { | ||
SymMap *map = SymMap_new(NULL, mapSize); | ||
int i; | ||
for (i = 0; i < keySize; i++) { | ||
map->put(map, keys[i], values[i], strlen(values[i])); | ||
} | ||
|
||
for (i = 0; i < keySize; i++) { | ||
char *out = (char *) map->get(map, keys[i]); | ||
CU_ASSERT(out != NULL); | ||
if (out != NULL) { | ||
CU_ASSERT(strcmp(out, values[i]) == 0); | ||
} | ||
} | ||
map->destroy(map); | ||
} | ||
|
||
void SymMapTest_test1() { | ||
char *keys[] = { "Hello", "Hi", "Welcome", "Greetings" }; | ||
char *values[] = { "Goodbye", "Hey", "Thank you", "Later" }; | ||
|
||
SymMapTest_test_stringmap(4, keys, values, 1); | ||
SymMapTest_test_stringmap(4, keys, values, 4); | ||
SymMapTest_test_stringmap(4, keys, values, 8); | ||
} | ||
|
||
void SymMapTest_test2() { | ||
char *keys[] = { "1", "2", "Three" }; | ||
char *values[] = { "One", "", "3" }; | ||
|
||
SymMapTest_test_stringmap(3, keys, values, 0); | ||
SymMapTest_test_stringmap(3, keys, values, 1); | ||
SymMapTest_test_stringmap(3, keys, values, 2); | ||
SymMapTest_test_stringmap(3, keys, values, 3); | ||
} | ||
|
||
void SymMapTest_test3() { | ||
char *columnNames[] = { "id", "name", "description", "create_time" }; | ||
SymTable *table = SymTable_new_with_fullname(NULL, "mydb", "dbo", "table1"); | ||
table->columns = SymList_new(NULL); | ||
int i; | ||
for (i = 0; i < 4; i++) { | ||
table->columns->add(table->columns, SymColumn_new(NULL, columnNames[i], 0)); | ||
} | ||
|
||
SymMap *map = SymMap_new(NULL, 100); | ||
map->put(map, table->name, table, sizeof(SymTable)); | ||
SymTable *out = map->get(map, table->name); | ||
|
||
CU_ASSERT(out != NULL); | ||
if (out) { | ||
CU_ASSERT(out->columns != NULL); | ||
if (out->columns) { | ||
SymIterator *iter = out->columns->iterator(out->columns); | ||
while (iter->has_next(iter)) { | ||
SymColumn *column = (SymColumn *) iter->next(iter); | ||
CU_ASSERT(column->name != NULL); | ||
if (column->name) { | ||
CU_ASSERT(strcmp(column->name, columnNames[iter->index]) == 0); | ||
} | ||
} | ||
iter->destroy(iter); | ||
} | ||
} | ||
|
||
table->destroy(table); | ||
map->destroy(map); | ||
} | ||
|
||
int SymMapTest_CUnit() { | ||
CU_pSuite suite = CU_add_suite("SymMapTest", NULL, NULL); | ||
if (suite == NULL) { | ||
return CUE_NOSUITE; | ||
} | ||
|
||
if (CU_add_test(suite, "SymMapTest_test1", SymMapTest_test1) == NULL || | ||
CU_add_test(suite, "SymMapTest_test2", SymMapTest_test2) == NULL || | ||
CU_add_test(suite, "SymMapTest_test3", SymMapTest_test3) == NULL) { | ||
return CUE_NOTEST; | ||
} | ||
return CUE_SUCCESS; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
symmetric-client-clib/Debug/src/db/platform/sqlite/subdir.mk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
################################################################################ | ||
# Automatically-generated file. Do not edit! | ||
################################################################################ | ||
|
||
# Add inputs and outputs from these tool invocations to the build variables | ||
C_SRCS += \ | ||
../src/db/platform/sqlite/SqliteDdlReader.c \ | ||
../src/db/platform/sqlite/SqlitePlatform.c \ | ||
../src/db/platform/sqlite/SqliteSqlTemplate.c \ | ||
../src/db/platform/sqlite/SqliteSqlTransaction.c | ||
|
||
OBJS += \ | ||
./src/db/platform/sqlite/SqliteDdlReader.o \ | ||
./src/db/platform/sqlite/SqlitePlatform.o \ | ||
./src/db/platform/sqlite/SqliteSqlTemplate.o \ | ||
./src/db/platform/sqlite/SqliteSqlTransaction.o | ||
|
||
C_DEPS += \ | ||
./src/db/platform/sqlite/SqliteDdlReader.d \ | ||
./src/db/platform/sqlite/SqlitePlatform.d \ | ||
./src/db/platform/sqlite/SqliteSqlTemplate.d \ | ||
./src/db/platform/sqlite/SqliteSqlTransaction.d | ||
|
||
|
||
# Each subdirectory must supply rules for building sources it contributes | ||
src/db/platform/sqlite/%.o: ../src/db/platform/sqlite/%.c | ||
@echo 'Building file: $<' | ||
@echo 'Invoking: GCC C Compiler' | ||
gcc -I"/home/elong/git/3.7/symmetric-ds/symmetric-client-clib/inc" -O0 -g3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<" | ||
@echo 'Finished building: $<' | ||
@echo ' ' | ||
|
||
|
Oops, something went wrong.