Exemple #1
0
/* note: dbString *a; ...(...,&a...) */
int db__recv_string_array(dbString ** a, int *n)
{
    int i, count;
    int stat;
    dbString *b;

    *n = 0;
    *a = NULL;
    stat = db__recv_int(&count);
    if (stat != DB_OK)
	return stat;
    if (count < 0) {
	db_protocol_error();
	return DB_PROTOCOL_ERR;
    }

    b = db_alloc_string_array(count);
    if (b == NULL)
	return DB_MEMORY_ERR;

    for (i = 0; i < count; i++) {
	stat = db__recv_string(&b[i]);
	if (stat != DB_OK) {
	    db_free_string_array(b, count);
	    return stat;
	}
    }
    *n = count;
    *a = b;

    return DB_OK;
}
Exemple #2
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);
}