This code assumed that the types of operations that were selected were
default-off, so it only added JSON to the query to turn on the ones that
were wanted, but in fact they are default-on, so this commit changes it
to add JSON for each possible operation type.
}
if (argc >= 6 && *argv[5] != '\0') {
}
if (argc >= 6 && *argv[5] != '\0') {
+ bool initial, insert, delete, modify;
char *save_ptr = NULL;
char *token;
char *save_ptr = NULL;
char *token;
- select = json_object_create();
+ initial = insert = delete = modify = false;
+
for (token = strtok_r(argv[5], ",", &save_ptr); token != NULL;
token = strtok_r(NULL, ",", &save_ptr)) {
for (token = strtok_r(argv[5], ",", &save_ptr); token != NULL;
token = strtok_r(NULL, ",", &save_ptr)) {
- json_object_put(select, token, json_boolean_create(true));
+ if (!strcmp(token, "initial")) {
+ initial = true;
+ } else if (!strcmp(token, "insert")) {
+ insert = true;
+ } else if (!strcmp(token, "delete")) {
+ delete = true;
+ } else if (!strcmp(token, "modify")) {
+ modify = true;
+ }
+
+ select = json_object_create();
+ json_object_put(select, "initial", json_boolean_create(initial));
+ json_object_put(select, "insert", json_boolean_create(insert));
+ json_object_put(select, "delete", json_boolean_create(delete));
+ json_object_put(select, "modify", json_boolean_create(modify));
} else {
select = NULL;
}
} else {
select = NULL;
}