3 #include <grass/dbmi.h>
15 index->numColumns = 0;
16 index->columnNames =
NULL;
30 if (index->numColumns > 0)
44 if (index->columnNames ==
NULL)
46 index->numColumns = ncols;
62 list = (dbIndex *)
db_calloc(count,
sizeof(dbIndex));
64 for (i = 0; i <
count; i++)
81 for (i = 0; i <
count; i++)
139 return index->numColumns;
151 if (column_num < 0 || column_num >= index->numColumns) {
152 db_error(
"db_set_index_column_name(): invalid column number");
166 if (column_num < 0 || column_num >= index->numColumns) {
167 db_error(
"db_get_index_column_name(): invalid column number");
168 return ((
const char *)
NULL);
207 return index->unique != 0;
222 fprintf(fd,
"Unique: true\n");
224 fprintf(fd,
"Unique: false\n");
227 fprintf(fd,
"Number of columns: %d\nColumns:\n", nCols);
229 for (i = 0; i < nCols; i++) {
int db_set_index_type_unique(dbIndex *index)
int db_get_index_number_of_columns(dbIndex *index)
int db_set_index_type_non_unique(dbIndex *index)
void db_free_index_array(dbIndex *list, int count)
void db_init_index(dbIndex *index)
void * db_calloc(int n, int m)
void db_free_index(dbIndex *index)
int db_alloc_index_columns(dbIndex *index, int ncols)
const char * db_get_index_name(dbIndex *index)
void db_error(const char *s)
int db_set_index_name(dbIndex *index, const char *name)
int db_set_index_column_name(dbIndex *index, int column_num, const char *name)
int db_get_error_code(void)
void db_print_index(FILE *fd, dbIndex *index)
const char * db_get_index_table_name(dbIndex *index)
const char * db_get_index_column_name(dbIndex *index, int column_num)
void db_free_string_array(dbString *a, int n)
int db_test_index_type_unique(dbIndex *index)
dbString * db_alloc_string_array(int count)
char * db_get_string(dbString *x)
int db_set_index_table_name(dbIndex *index, const char *name)
int db_set_string(dbString *x, const char *s)
void db_free_string(dbString *x)
dbIndex * db_alloc_index_array(int count)
void db_init_string(dbString *x)