Example #1
0
/*!
  \brief Free allocated dbIndex

  \param index pointer to dbIndex to be freed
*/
void db_free_index(dbIndex * index)
{
    db_free_string(&index->indexName);
    db_free_string(&index->tableName);
    if (index->numColumns > 0)
	db_free_string_array(index->columnNames, index->numColumns);
    db_init_index(index);
}
Example #2
0
/*!
  \brief Allocate index array

  \param count number of items

  \return pointer to allocated dbIndex array
*/
dbIndex *db_alloc_index_array(int count)
{
    dbIndex *list;
    int i;

    list = (dbIndex *) db_calloc(count, sizeof(dbIndex));
    if (list) {
	for (i = 0; i < count; i++)
	    db_init_index(&list[i]);
    }
    return list;
}
Example #3
0
int db__recv_index(dbIndex * index)
{
    int i, ncols;

    db_init_index(index);
    DB_RECV_STRING(&index->indexName);
    DB_RECV_STRING(&index->tableName);
    DB_RECV_CHAR(&index->unique);

    DB_RECV_INT(&ncols);

    if (db_alloc_index_columns(index, ncols) != DB_OK)
	return db_get_error_code();

    for (i = 0; i < ncols; i++) {
	DB_RECV_STRING(&index->columnNames[i]);
    }

    return DB_OK;
}