|
@@ -31,7 +31,7 @@
|
|
|
|
|
|
#include "local.h"
|
|
#include "local.h"
|
|
|
|
|
|
-void copy_table(struct Map_info *, struct Map_info *, int, int);
|
|
|
|
|
|
+void copy_table(struct Map_info *, struct Map_info *, int, int, int);
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
int main(int argc, char *argv[])
|
|
{
|
|
{
|
|
@@ -50,6 +50,7 @@ int main(int argc, char *argv[])
|
|
int verbose;
|
|
int verbose;
|
|
|
|
|
|
struct field_info *Fi = NULL;
|
|
struct field_info *Fi = NULL;
|
|
|
|
+ int table_type;
|
|
char buf[DB_SQL_MAX];
|
|
char buf[DB_SQL_MAX];
|
|
dbString stmt;
|
|
dbString stmt;
|
|
dbString sql, value_string, col_defs;
|
|
dbString sql, value_string, col_defs;
|
|
@@ -161,6 +162,10 @@ int main(int argc, char *argv[])
|
|
i++;
|
|
i++;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ table_type = GV_1TABLE;
|
|
|
|
+ if ((ofield[0] > 0) + (ofield[1] > 0) + (ofield[2] > 0) > 1)
|
|
|
|
+ table_type = GV_MTABLE;
|
|
|
|
+
|
|
if (operator_opt->answer[0] == 'a')
|
|
if (operator_opt->answer[0] == 'a')
|
|
operator = OP_AND;
|
|
operator = OP_AND;
|
|
else if (operator_opt->answer[0] == 'o')
|
|
else if (operator_opt->answer[0] == 'o')
|
|
@@ -223,7 +228,7 @@ int main(int argc, char *argv[])
|
|
|
|
|
|
/* Create dblinks */
|
|
/* Create dblinks */
|
|
if (ofield[0] > 0) {
|
|
if (ofield[0] > 0) {
|
|
- Fi = Vect_default_field_info(&Out, ofield[0], NULL, GV_1TABLE);
|
|
|
|
|
|
+ Fi = Vect_default_field_info(&Out, ofield[0], NULL, table_type);
|
|
}
|
|
}
|
|
|
|
|
|
db_init_string(&sql);
|
|
db_init_string(&sql);
|
|
@@ -622,11 +627,11 @@ int main(int argc, char *argv[])
|
|
/* TODO: copy only valid attributes */
|
|
/* TODO: copy only valid attributes */
|
|
/* copy attributes from ainput */
|
|
/* copy attributes from ainput */
|
|
if (ofield[1] > 0 && field[0] > 0) {
|
|
if (ofield[1] > 0 && field[0] > 0) {
|
|
- copy_table(&In[0], &Out, field[0], ofield[1]);
|
|
|
|
|
|
+ copy_table(&In[0], &Out, field[0], ofield[1], table_type);
|
|
}
|
|
}
|
|
/* copy attributes from binput */
|
|
/* copy attributes from binput */
|
|
if (ofield[2] > 0 && field[1] > 0 && ofield[1] != ofield[2]) {
|
|
if (ofield[2] > 0 && field[1] > 0 && ofield[1] != ofield[2]) {
|
|
- copy_table(&In[1], &Out, field[1], ofield[2]);
|
|
|
|
|
|
+ copy_table(&In[1], &Out, field[1], ofield[2], table_type);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -640,7 +645,7 @@ int main(int argc, char *argv[])
|
|
}
|
|
}
|
|
|
|
|
|
void copy_table(struct Map_info *In, struct Map_info *Out, int infield,
|
|
void copy_table(struct Map_info *In, struct Map_info *Out, int infield,
|
|
- int outfield)
|
|
|
|
|
|
+ int outfield, int table_type)
|
|
{
|
|
{
|
|
struct ilist *list;
|
|
struct ilist *list;
|
|
int findex;
|
|
int findex;
|
|
@@ -652,7 +657,7 @@ void copy_table(struct Map_info *In, struct Map_info *Out, int infield,
|
|
list = Vect_new_list();
|
|
list = Vect_new_list();
|
|
Vect_cidx_get_unique_cats_by_index(Out, findex, list);
|
|
Vect_cidx_get_unique_cats_by_index(Out, findex, list);
|
|
Vect_copy_table_by_cats(In, Out, infield, outfield, NULL,
|
|
Vect_copy_table_by_cats(In, Out, infield, outfield, NULL,
|
|
- GV_1TABLE, list->value, list->n_values);
|
|
|
|
|
|
+ table_type, list->value, list->n_values);
|
|
|
|
|
|
Vect_destroy_list(list);
|
|
Vect_destroy_list(list);
|
|
}
|
|
}
|