Przeglądaj źródła

update doxygen documentation of DBMI library (BASE)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@45853 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 14 lat temu
rodzic
commit
7259e5a937
48 zmienionych plików z 2452 dodań i 1597 usunięć
  1. 6 3
      include/dbmi.h
  2. 410 0
      include/dbmidefs.h
  3. 0 411
      include/proto_dbmi.h
  4. 49 22
      lib/db/dbmi_base/alloc.c
  5. 35 23
      lib/db/dbmi_base/case.c
  6. 27 22
      lib/db/dbmi_base/column.c
  7. 46 28
      lib/db/dbmi_base/columnfmt.c
  8. 29 10
      lib/db/dbmi_base/connect.c
  9. 2 2
      lib/db/dbmi_base/cursor.c
  10. 43 28
      lib/db/dbmi_base/datetime.c
  11. 2 3
      lib/db/dbmi_base/dbmscap.c
  12. 1 1
      lib/db/dbmi_base/default_name.c
  13. 39 21
      lib/db/dbmi_base/dirent.c
  14. 83 95
      lib/db/dbmi_base/error.c
  15. 1 1
      lib/db/dbmi_base/handle.c
  16. 119 81
      lib/db/dbmi_base/index.c
  17. 19 4
      lib/db/dbmi_base/interval.c
  18. 21 5
      lib/db/dbmi_base/isdir.c
  19. 31 20
      lib/db/dbmi_base/legal_dbname.c
  20. 22 21
      lib/db/dbmi_base/login.c
  21. 33 0
      lib/db/dbmi_base/ret_codes.c
  22. 20 5
      lib/db/dbmi_base/sqlCtype.c
  23. 20 4
      lib/db/dbmi_base/sqltype.c
  24. 3 3
      lib/db/dbmi_base/string.c
  25. 21 11
      lib/db/dbmi_base/strip.c
  26. 143 110
      lib/db/dbmi_base/table.c
  27. 185 152
      lib/db/dbmi_base/value.c
  28. 35 16
      lib/db/dbmi_base/valuefmt.c
  29. 22 9
      lib/db/dbmi_base/whoami.c
  30. 27 15
      lib/db/dbmi_base/xdr.c
  31. 26 0
      lib/db/dbmi_base/xdrchar.c
  32. 53 0
      lib/db/dbmi_base/xdrcolumn.c
  33. 27 0
      lib/db/dbmi_base/xdrdatetime.c
  34. 43 2
      lib/db/dbmi_base/xdrdouble.c
  35. 45 2
      lib/db/dbmi_base/xdrfloat.c
  36. 27 0
      lib/db/dbmi_base/xdrhandle.c
  37. 42 0
      lib/db/dbmi_base/xdrindex.c
  38. 46 2
      lib/db/dbmi_base/xdrint.c
  39. 41 6
      lib/db/dbmi_base/xdrprocedure.c
  40. 46 2
      lib/db/dbmi_base/xdrshort.c
  41. 52 9
      lib/db/dbmi_base/xdrstring.c
  42. 43 1
      lib/db/dbmi_base/xdrtable.c
  43. 27 0
      lib/db/dbmi_base/xdrtoken.c
  44. 33 1
      lib/db/dbmi_base/xdrvalue.c
  45. 19 5
      lib/db/dbmi_base/zero.c
  46. 5 5
      lib/db/dbmi_client/c_bindupdate.c
  47. 382 435
      lib/db/dbmilib.dox
  48. 1 1
      lib/python/ctypes/Makefile

+ 6 - 3
include/dbmi.h

@@ -116,13 +116,16 @@
 /* Privileges */
 #define DB_PRIV_SELECT       0x01
 
-#define DB_GROUP         0x01
-#define DB_PUBLIC        0x02
+#define DB_GROUP             0x01
+#define DB_PUBLIC            0x02
 
 /* default value modes */
 #define DB_DEFINED	1
 #define DB_UNDEFINED	2
 
+/* static buffer for SQL statements */
+#define DB_SQL_MAX      4096
+
 typedef void *dbAddress;
 typedef int dbToken;
 
@@ -297,6 +300,6 @@ typedef struct
     char **label;		/* array of new category labels */
 } dbRclsRule;
 
-#include <grass/proto_dbmi.h>
+#include <grass/dbmidefs.h>
 
 #endif

+ 410 - 0
include/dbmidefs.h

@@ -0,0 +1,410 @@
+#ifndef _PROTO_DBMI_H_
+#define _PROTO_DBMI_H_
+
+void db_Cstring_to_lowercase(char *);
+void db_Cstring_to_uppercase(char *);
+int db_add_column(dbDriver *, dbString *, dbColumn *);
+void db__add_cursor_to_driver_state(dbCursor *);
+int db_alloc_cursor_column_flags(dbCursor *);
+int db_alloc_cursor_table(dbCursor *, int);
+int db_append_table_column(dbTable * , dbColumn *);
+dbDirent *db_alloc_dirent_array(int);
+dbHandle *db_alloc_handle_array(int);
+dbIndex *db_alloc_index_array(int);
+int db_alloc_index_columns(dbIndex *, int);
+dbString *db_alloc_string_array(int);
+dbTable *db_alloc_table(int);
+int db_append_string(dbString *, const char *);
+void db_auto_print_errors(int);
+void db_auto_print_protocol_errors(int);
+int db_bind_update(dbCursor *);
+void *db_calloc(int, int);
+int db_CatValArray_alloc(dbCatValArray *, int);
+int db_CatValArray_realloc(dbCatValArray *, int);
+void db_CatValArray_free(dbCatValArray *);
+void db_CatValArray_init(dbCatValArray *);
+void db_CatValArray_sort(dbCatValArray *);
+int db_CatValArray_sort_by_value(dbCatValArray *);
+int db_CatValArray_get_value(dbCatValArray *, int, dbCatVal **);
+int db_CatValArray_get_value_int(dbCatValArray *, int, int *);
+int db_CatValArray_get_value_double(dbCatValArray *, int,
+				    double *);
+void db_char_to_lowercase(char *);
+void db_char_to_uppercase(char *);
+void db_clear_error(void);
+dbTable *db_clone_table(dbTable *);
+void db__close_all_cursors(void);
+int db_close_cursor(dbCursor *);
+int db_close_database(dbDriver *);
+int db_close_database_shutdown_driver(dbDriver *);
+int db_column_sqltype(dbDriver *, const char *, const char *);
+int db_column_Ctype(dbDriver *, const char *, const char *);
+int db_convert_Cstring_to_column_default_value(const char *,
+					       dbColumn *);
+int db_convert_Cstring_to_column_value(const char *,
+				       dbColumn *);
+int db_convert_Cstring_to_value(const char *, int,
+				dbValue *);
+int db_convert_Cstring_to_value_datetime(const char *, int,
+					 dbValue *);
+int db_convert_column_default_value_to_string(dbColumn *,
+					      dbString *);
+int db_convert_column_value_to_string(dbColumn *, dbString *);
+int db_convert_value_datetime_into_string(dbValue *, int,
+					  dbString *);
+int db_convert_value_to_string(dbValue *, int,
+			       dbString *);
+dbColumn *db_copy_column(dbColumn *, dbColumn *);
+void db_copy_dbmscap_entry(dbDbmscap *, dbDbmscap *);
+int db_copy_string(dbString *, const dbString *);
+int db_table_to_sql(dbTable *, dbString *);
+int db_copy_table(const char *, const char *, const char *, const char *,
+		  const char *, const char *);
+int db_copy_table_where(const char *, const char *, const char *,
+			const char *, const char *, const char *,
+			const char *);
+int db_copy_table_select(const char *, const char *, const char *,
+			 const char *, const char *, const char *,
+			 const char *);
+int db_copy_table_by_ints(const char *, const char *, const char *,
+			  const char *, const char *, const char *,
+			  const char *, int *, int);
+void db_copy_value(dbValue *, dbValue *);
+int db_create_database(dbDriver *, dbHandle *);
+int db_create_index(dbDriver *, dbIndex *);
+int db_create_index2(dbDriver *, const char *,
+		     const char *);
+int db_create_table(dbDriver *, dbTable *);
+int db_d_add_column(void);
+int db_d_bind_update(void);
+const char *db_dbmscap_filename(void);
+int db_d_close_cursor(void);
+int db_d_close_database(void);
+int db_d_create_database(void);
+int db_d_create_index(void);
+int db_d_create_table(void);
+int db_d_delete(void);
+int db_d_delete_database(void);
+int db_d_describe_table(void);
+int db_d_drop_column(void);
+int db_d_drop_index(void);
+int db_d_drop_table(void);
+void db_debug(const char *);
+void db_debug_off(void);
+void db_debug_on(void);
+int db_delete(dbCursor *);
+int db_delete_database(dbDriver *, dbHandle *);
+int db_delete_table(const char *, const char *, const char *);
+int db_describe_table(dbDriver *, dbString *, dbTable **);
+int db_d_execute_immediate(void);
+int db_d_begin_transaction(void);
+int db_d_commit_transaction(void);
+int db_d_fetch(void);
+int db_d_find_database(void);
+int db_d_get_num_rows(void);
+int db_d_grant_on_table(void);
+int db_d_insert(void);
+dbDirent *db_dirent(const char *, int *);
+int db_d_list_databases(void);
+int db_d_list_indexes(void);
+int db_d_list_tables(void);
+int db_d_open_database(void);
+int db_d_open_insert_cursor(void);
+int db_d_open_select_cursor(void);
+int db_d_open_update_cursor(void);
+void db_double_quote_string(dbString *);
+int db_driver(int, char **);
+
+int db_driver_mkdir(const char *, int, int);
+int db_drop_column(dbDriver *, dbString *,
+		   dbString *);
+void db__drop_cursor_from_driver_state(dbCursor *);
+int db_drop_index(dbDriver *, dbString *);
+int db_drop_table(dbDriver *, dbString *);
+void db_drop_token(dbToken);
+int db_d_update(void);
+int db_d_version(void);
+int db_enlarge_string(dbString *, int);
+void db_error(const char *);
+int db_execute_immediate(dbDriver *, dbString *);
+int db_begin_transaction(dbDriver *);
+int db_commit_transaction(dbDriver *);
+int db_fetch(dbCursor *, int, int *);
+int db_find_database(dbDriver *, dbHandle *, int *);
+dbAddress db_find_token(dbToken);
+void *db_free(void *);
+void db_free_column(dbColumn *);
+void db_free_cursor(dbCursor *);
+void db_free_cursor_column_flags(dbCursor *);
+void db_free_dbmscap(dbDbmscap *);
+void db_free_dirent_array(dbDirent *, int);
+void db_free_handle(dbHandle *);
+void db_free_handle_array(dbHandle *, int);
+void db_free_index(dbIndex *);
+void db_free_index_array(dbIndex *, int);
+void db_free_string(dbString *);
+void db_free_string_array(dbString *, int);
+void db_free_table(dbTable *);
+int db_get_column(dbDriver *, const char *, const char *,
+		  dbColumn **);
+dbValue *db_get_column_default_value(dbColumn *);
+const char *db_get_column_description(dbColumn *);
+int db_get_column_host_type(dbColumn *);
+int db_get_column_length(dbColumn *);
+const char *db_get_column_name(dbColumn *);
+int db_get_column_precision(dbColumn *);
+int db_get_column_scale(dbColumn *);
+int db_get_column_select_priv(dbColumn *);
+int db_get_column_sqltype(dbColumn *);
+int db_get_column_update_priv(dbColumn *);
+dbValue *db_get_column_value(dbColumn *);
+int db_get_connection(dbConnection *);
+int db_get_cursor_number_of_columns(dbCursor *);
+dbTable *db_get_cursor_table(dbCursor *);
+dbToken db_get_cursor_token(dbCursor *);
+const char *db_get_default_driver_name(void);
+const char *db_get_default_database_name(void);
+const char *db_get_default_schema_name(void);
+const char *db_get_default_group_name(void);
+dbDriverState *db__get_driver_state(void);
+int db_get_error_code(void);
+const char *db_get_error_msg(void);
+const char *db_get_error_who(void);
+const char *db_get_handle_dbname(dbHandle *);
+const char *db_get_handle_dbschema(dbHandle *);
+const char *db_get_index_column_name(dbIndex *, int);
+const char *db_get_index_name(dbIndex *);
+int db_get_index_number_of_columns(dbIndex *);
+const char *db_get_index_table_name(dbIndex *);
+int db_get_num_rows(dbCursor *);
+char *db_get_string(const dbString *);
+dbColumn *db_get_table_column(dbTable *, int);
+dbColumn *db_get_table_column_by_name(dbTable *, const char*);
+int db_get_table_delete_priv(dbTable *);
+const char *db_get_table_description(dbTable *);
+int db_get_table_insert_priv(dbTable *);
+const char *db_get_table_name(dbTable *);
+int db_get_table_number_of_columns(dbTable *);
+int db_get_table_number_of_rows(dbDriver *, dbString *);
+int db_get_table_select_priv(dbTable *);
+int db_get_table_update_priv(dbTable *);
+double db_get_value_as_double(dbValue *, int);
+int db_get_value_day(dbValue *);
+double db_get_value_double(dbValue *);
+int db_get_value_hour(dbValue *);
+int db_get_value_int(dbValue *);
+int db_get_value_minute(dbValue *);
+int db_get_value_month(dbValue *);
+double db_get_value_seconds(dbValue *);
+const char *db_get_value_string(dbValue *);
+int db_get_value_year(dbValue *);
+int db_grant_on_table(dbDriver *, const char *, int,
+		      int);
+int db_has_dbms(void);
+void db_init_column(dbColumn *);
+void db_init_cursor(dbCursor *);
+void db__init_driver_state(void);
+void db_init_handle(dbHandle *);
+void db_init_index(dbIndex *);
+void db_init_string(dbString *);
+void db_init_table(dbTable *);
+int db_insert(dbCursor *);
+void db_interval_range(int, int *, int *);
+int db_isdir(const char *);
+int db_legal_tablename(const char *);
+int db_list_databases(dbDriver *, dbString *, int,
+		      dbHandle **, int *);
+const char *db_list_drivers(void);
+int db_list_indexes(dbDriver *, dbString *, dbIndex **,
+		    int *);
+int db_list_tables(dbDriver *, dbString **, int *,
+		   int);
+void *db_malloc(int);
+void db__mark_database_closed(void);
+void db__mark_database_open(const char *, const char *);
+void db_memory_error(void);
+dbToken db_new_token(dbAddress);
+int db_nocase_compare(const char *, const char *);
+void db_noproc_error(int);
+int db_open_database(dbDriver *, dbHandle *);
+int db_open_insert_cursor(dbDriver *, dbCursor *);
+int db_open_select_cursor(dbDriver *, dbString *,
+			  dbCursor *, int);
+int db_open_update_cursor(dbDriver *, dbString *_name,
+			  dbString *, dbCursor *, int);
+void db_print_column_definition(FILE *, dbColumn *);
+void db_print_error(void);
+void db_print_index(FILE *, dbIndex *);
+void db_print_table_definition(FILE *, dbTable *);
+void db_procedure_not_implemented(const char *);
+void db_protocol_error(void);
+dbDbmscap *db_read_dbmscap(void);
+void *db_realloc(void *, int);
+int db__recv_char(char *);
+int db__recv_column_default_value(dbColumn *);
+int db__recv_column_definition(dbColumn *);
+int db__recv_column_value(dbColumn *);
+int db__recv_datetime(dbDateTime *);
+int db__recv_double(double *);
+int db__recv_double_array(double **, int *);
+int db__recv_float(float *);
+int db__recv_float_array(float **, int *);
+int db__recv_handle(dbHandle *);
+int db__recv_index(dbIndex *);
+int db__recv_index_array(dbIndex **, int *);
+int db__recv_int(int *);
+int db__recv_int_array(int **, int *);
+int db__recv_procnum(int *);
+int db__recv_return_code(int *);
+int db__recv_short(short *);
+int db__recv_short_array(short **, int *);
+int db__recv_string(dbString *);
+int db__recv_string_array(dbString **, int *);
+int db__recv_table_data(dbTable *);
+int db__recv_table_definition(dbTable **);
+int db__recv_token(dbToken *);
+int db__recv_value(dbValue *, int);
+int db__send_Cstring(const char *);
+int db__send_char(int);
+int db__send_column_default_value(dbColumn *);
+int db__send_column_definition(dbColumn *);
+int db__send_column_value(dbColumn *);
+int db__send_datetime(dbDateTime *);
+int db__send_double(double);
+int db__send_double_array(const double *, int);
+int db__send_failure(void);
+int db__send_float(float);
+int db__send_float_array(const float *, int);
+int db__send_handle(dbHandle *);
+int db__send_index(dbIndex *);
+int db__send_index_array(dbIndex *, int);
+int db__send_int(int);
+int db__send_int_array(const int *, int);
+int db__send_procedure_not_implemented(int);
+int db__send_procedure_ok(int);
+int db__send_short(int);
+int db__send_short_array(const short *, int);
+int db__send_string(dbString *);
+int db__send_string_array(dbString *, int);
+int db__send_success(void);
+int db__send_table_data(dbTable *);
+int db__send_table_definition(dbTable *);
+int db__send_token(dbToken *);
+int db__send_value(dbValue *, int);
+int db_select_CatValArray(dbDriver *, const char *, const char *,
+			  const char *, const char *,
+			  dbCatValArray *);
+int db_select_int(dbDriver *, const char *, const char *,
+		  const char *, int **);
+int db_select_value(dbDriver *, const char *, const char *,
+		    int, const char *, dbValue *);
+int db_set_column_description(dbColumn *, const char *);
+void db_set_column_has_defined_default_value(dbColumn *);
+void db_set_column_has_undefined_default_value(dbColumn *);
+void db_set_column_host_type(dbColumn *, int);
+void db_set_column_length(dbColumn *, int);
+int db_set_column_name(dbColumn *, const char *);
+void db_set_column_null_allowed(dbColumn *);
+void db_set_column_precision(dbColumn *, int);
+void db_set_column_scale(dbColumn *, int);
+void db_set_column_select_priv_granted(dbColumn *);
+void db_set_column_select_priv_not_granted(dbColumn *);
+void db_set_column_sqltype(dbColumn *, int);
+void db_set_column_update_priv_granted(dbColumn *);
+void db_set_column_update_priv_not_granted(dbColumn *);
+void db_set_column_use_default_value(dbColumn *);
+int db_set_connection(dbConnection *);
+void db_set_cursor_column_flag(dbCursor *, int);
+void db_set_cursor_column_for_update(dbCursor *, int);
+void db_set_cursor_mode(dbCursor *, int);
+void db_set_cursor_mode_insensitive(dbCursor *);
+void db_set_cursor_mode_scroll(dbCursor *);
+void db_set_cursor_table(dbCursor *, dbTable *);
+void db_set_cursor_token(dbCursor *, dbToken);
+void db_set_cursor_type_insert(dbCursor *);
+void db_set_cursor_type_readonly(dbCursor *);
+void db_set_cursor_type_update(dbCursor *);
+int db_set_default_connection(void);
+void db_set_error_who(const char *);
+int db_set_handle(dbHandle *, const char *, const char *);
+int db_set_index_column_name(dbIndex *, int,
+			     const char *);
+int db_set_index_name(dbIndex *, const char *);
+int db_set_index_table_name(dbIndex *, const char *);
+int db_set_index_type_non_unique(dbIndex *);
+int db_set_index_type_unique(dbIndex *);
+void db__set_protocol_fds(FILE *, FILE *);
+int db_set_string(dbString *, const char *);
+int db_set_string_no_copy(dbString *, char *);
+int db_set_table_column(dbTable *, int, dbColumn *);
+void db_set_table_delete_priv_granted(dbTable *);
+void db_set_table_delete_priv_not_granted(dbTable *);
+int db_set_table_description(dbTable *, const char *);
+void db_set_table_insert_priv_granted(dbTable *);
+void db_set_table_insert_priv_not_granted(dbTable *);
+int db_set_table_name(dbTable *, const char *);
+void db_set_table_select_priv_granted(dbTable *);
+void db_set_table_select_priv_not_granted(dbTable *);
+void db_set_table_update_priv_granted(dbTable *);
+void db_set_table_update_priv_not_granted(dbTable *);
+void db_set_value_datetime_current(dbValue *);
+void db_set_value_datetime_not_current(dbValue *);
+void db_set_value_day(dbValue *, int);
+void db_set_value_double(dbValue *, double);
+void db_set_value_hour(dbValue *, int);
+void db_set_value_int(dbValue *, int);
+void db_set_value_minute(dbValue *, int);
+void db_set_value_month(dbValue *, int);
+void db_set_value_not_null(dbValue *);
+void db_set_value_null(dbValue *);
+void db_set_value_seconds(dbValue *, double);
+int db_set_value_string(dbValue *, const char *);
+void db_set_value_year(dbValue *, int);
+int db_shutdown_driver(dbDriver *);
+const char *db_sqltype_name(int);
+int db_sqltype_to_Ctype(int);
+dbDriver *db_start_driver(const char *);
+dbDriver *db_start_driver_open_database(const char *, const char *);
+int db__start_procedure_call(int);
+char *db_store(const char *);
+void db_strip(char *);
+void db_syserror(const char *);
+int db_table_exists(const char *, const char *,
+		    const char *);
+int db_test_column_has_default_value(dbColumn *);
+int db_test_column_has_defined_default_value(dbColumn *);
+int db_test_column_has_undefined_default_value(dbColumn *);
+int db_test_column_null_allowed(dbColumn *);
+int db_test_column_use_default_value(dbColumn *);
+int db_test_cursor_any_column_flag(dbCursor *);
+int db_test_cursor_any_column_for_update(dbCursor *);
+int db_test_cursor_column_flag(dbCursor *, int);
+int db_test_cursor_column_for_update(dbCursor *, int);
+int db_test_cursor_mode_insensitive(dbCursor *);
+int db_test_cursor_mode_scroll(dbCursor *);
+int db_test_cursor_type_fetch(dbCursor *);
+int db_test_cursor_type_insert(dbCursor *);
+int db_test_cursor_type_update(dbCursor *);
+int db__test_database_open(void);
+int db_test_index_type_unique(dbIndex *);
+int db_test_value_datetime_current(dbValue *);
+int db_test_value_isnull(dbValue *);
+void db_unset_column_has_default_value(dbColumn *);
+void db_unset_column_null_allowed(dbColumn *);
+void db_unset_column_use_default_value(dbColumn *);
+void db_unset_cursor_column_flag(dbCursor *, int);
+void db_unset_cursor_column_for_update(dbCursor *, int);
+void db_unset_cursor_mode(dbCursor *);
+void db_unset_cursor_mode_insensitive(dbCursor *);
+void db_unset_cursor_mode_scroll(dbCursor *);
+int db_update(dbCursor *);
+int db_gversion(dbDriver *, dbString *,
+		dbString *);
+const char *db_whoami(void);
+void db_zero(void *, int);
+void db_zero_string(dbString *);
+unsigned int db_sizeof_string(const dbString *);
+int db_set_login(const char *, const char *, const char *, const char *);
+int db_get_login(const char *, const char *, const char **, const char **);
+
+#endif

+ 0 - 411
include/proto_dbmi.h

@@ -1,411 +0,0 @@
-#ifndef _PROTO_DBMI_H_
-#define _PROTO_DBMI_H_
-
-void db_Cstring_to_lowercase(char *s);
-void db_Cstring_to_uppercase(char *s);
-int db_add_column(dbDriver * driver, dbString * tableName, dbColumn * column);
-void db__add_cursor_to_driver_state(dbCursor * cursor);
-int db_alloc_cursor_column_flags(dbCursor * cursor);
-int db_alloc_cursor_table(dbCursor * cursor, int ncols);
-int db_append_table_column(dbTable * , dbColumn *);
-dbDirent *db_alloc_dirent_array(int count);
-dbHandle *db_alloc_handle_array(int count);
-dbIndex *db_alloc_index_array(int count);
-int db_alloc_index_columns(dbIndex * index, int ncols);
-dbString *db_alloc_string_array(int count);
-dbTable *db_alloc_table(int ncols);
-int db_append_string(dbString * x, const char *s);
-void db_auto_print_errors(int flag);
-void db_auto_print_protocol_errors(int flag);
-int db_bind_update(dbCursor * cursor);
-void *db_calloc(int n, int m);
-int db_CatValArray_alloc(dbCatValArray * arr, int n);
-int db_CatValArray_realloc(dbCatValArray * arr, int n);
-void db_CatValArray_free(dbCatValArray * arr);
-void db_CatValArray_init(dbCatValArray * arr);
-void db_CatValArray_sort(dbCatValArray * arr);
-int db_CatValArray_sort_by_value(dbCatValArray * arr);
-int db_CatValArray_get_value(dbCatValArray * arr, int key, dbCatVal **);
-int db_CatValArray_get_value_int(dbCatValArray * arr, int key, int *val);
-int db_CatValArray_get_value_double(dbCatValArray * arr, int key,
-				    double *val);
-void db_char_to_lowercase(char *s);
-void db_char_to_uppercase(char *s);
-void db_clear_error(void);
-dbTable *db_clone_table(dbTable *);
-void db__close_all_cursors(void);
-int db_close_cursor(dbCursor * cursor);
-int db_close_database(dbDriver * driver);
-int db_close_database_shutdown_driver(dbDriver * driver);
-int db_column_sqltype(dbDriver * driver, const char *tab, const char *col);
-int db_column_Ctype(dbDriver * driver, const char *tab, const char *col);
-int db_convert_Cstring_to_column_default_value(const char *Cstring,
-					       dbColumn * column);
-int db_convert_Cstring_to_column_value(const char *Cstring,
-				       dbColumn * column);
-int db_convert_Cstring_to_value(const char *Cstring, int sqltype,
-				dbValue * value);
-int db_convert_Cstring_to_value_datetime(const char *buf, int sqltype,
-					 dbValue * value);
-int db_convert_column_default_value_to_string(dbColumn * column,
-					      dbString * string);
-int db_convert_column_value_to_string(dbColumn * column, dbString * string);
-int db_convert_value_datetime_into_string(dbValue * value, int sqltype,
-					  dbString * string);
-int db_convert_value_to_string(dbValue * value, int sqltype,
-			       dbString * string);
-dbColumn *db_copy_column(dbColumn *, dbColumn *);
-void db_copy_dbmscap_entry(dbDbmscap * dst, dbDbmscap * src);
-int db_copy_string(dbString * dst, const dbString * src);
-int db_table_to_sql(dbTable *, dbString *);
-int db_copy_table(const char *, const char *, const char *, const char *,
-		  const char *, const char *);
-int db_copy_table_where(const char *, const char *, const char *,
-			const char *, const char *, const char *,
-			const char *);
-int db_copy_table_select(const char *, const char *, const char *,
-			 const char *, const char *, const char *,
-			 const char *);
-int db_copy_table_by_ints(const char *, const char *, const char *,
-			  const char *, const char *, const char *,
-			  const char *, int *, int);
-void db_copy_value(dbValue * dst, dbValue * src);
-int db_create_database(dbDriver * driver, dbHandle * handle);
-int db_create_index(dbDriver * driver, dbIndex * index);
-int db_create_index2(dbDriver * driver, const char *table_name,
-		     const char *column_name);
-int db_create_table(dbDriver * driver, dbTable * table);
-int db_d_add_column(void);
-int db_d_bind_update(void);
-const char *db_dbmscap_filename(void);
-int db_d_close_cursor(void);
-int db_d_close_database(void);
-int db_d_create_database(void);
-int db_d_create_index(void);
-int db_d_create_table(void);
-int db_d_delete(void);
-int db_d_delete_database(void);
-int db_d_describe_table(void);
-int db_d_drop_column(void);
-int db_d_drop_index(void);
-int db_d_drop_table(void);
-void db_debug(const char *s);
-void db_debug_off(void);
-void db_debug_on(void);
-int db_delete(dbCursor * cursor);
-int db_delete_database(dbDriver * driver, dbHandle * handle);
-int db_delete_table(const char *, const char *, const char *);
-int db_describe_table(dbDriver * driver, dbString * name, dbTable ** table);
-int db_d_execute_immediate(void);
-int db_d_begin_transaction(void);
-int db_d_commit_transaction(void);
-int db_d_fetch(void);
-int db_d_find_database(void);
-int db_d_get_num_rows(void);
-int db_d_grant_on_table(void);
-int db_d_insert(void);
-dbDirent *db_dirent(const char *dirname, int *n);
-int db_d_list_databases(void);
-int db_d_list_indexes(void);
-int db_d_list_tables(void);
-int db_d_open_database(void);
-int db_d_open_insert_cursor(void);
-int db_d_open_select_cursor(void);
-int db_d_open_update_cursor(void);
-void db_double_quote_string(dbString * src);
-int db_driver(int argc, char *argv[]);
-
-int db_driver_mkdir(const char *path, int mode, int parentdirs);
-int db_drop_column(dbDriver * driver, dbString * tableName,
-		   dbString * columnName);
-void db__drop_cursor_from_driver_state(dbCursor * cursor);
-int db_drop_index(dbDriver * driver, dbString * name);
-int db_drop_table(dbDriver * driver, dbString * name);
-void db_drop_token(dbToken token);
-int db_d_update(void);
-int db_d_version(void);
-int db_enlarge_string(dbString * x, int len);
-void db_error(const char *s);
-int db_execute_immediate(dbDriver * driver, dbString * SQLstatement);
-int db_begin_transaction(dbDriver * driver);
-int db_commit_transaction(dbDriver * driver);
-int db_fetch(dbCursor * cursor, int position, int *more);
-int db_find_database(dbDriver * driver, dbHandle * handle, int *found);
-dbAddress db_find_token(dbToken token);
-void *db_free(void *s);
-void db_free_column(dbColumn * column);
-void db_free_cursor(dbCursor * cursor);
-void db_free_cursor_column_flags(dbCursor * cursor);
-void db_free_dbmscap(dbDbmscap * list);
-void db_free_dirent_array(dbDirent * dirent, int count);
-void db_free_handle(dbHandle * handle);
-void db_free_handle_array(dbHandle * handle, int count);
-void db_free_index(dbIndex * index);
-void db_free_index_array(dbIndex * list, int count);
-void db_free_string(dbString * x);
-void db_free_string_array(dbString * a, int n);
-void db_free_table(dbTable * table);
-int db_get_column(dbDriver * Driver, const char *tname, const char *cname,
-		  dbColumn ** Column);
-dbValue *db_get_column_default_value(dbColumn * column);
-const char *db_get_column_description(dbColumn * column);
-int db_get_column_host_type(dbColumn * column);
-int db_get_column_length(dbColumn * column);
-const char *db_get_column_name(dbColumn * column);
-int db_get_column_precision(dbColumn * column);
-int db_get_column_scale(dbColumn * column);
-int db_get_column_select_priv(dbColumn * column);
-int db_get_column_sqltype(dbColumn * column);
-int db_get_column_update_priv(dbColumn * column);
-dbValue *db_get_column_value(dbColumn * column);
-int db_get_connection(dbConnection * connection);
-int db_get_cursor_number_of_columns(dbCursor * cursor);
-dbTable *db_get_cursor_table(dbCursor * cursor);
-dbToken db_get_cursor_token(dbCursor * cursor);
-const char *db_get_default_driver_name(void);
-const char *db_get_default_database_name(void);
-const char *db_get_default_schema_name(void);
-const char *db_get_default_group_name(void);
-dbDriverState *db__get_driver_state(void);
-int db_get_error_code(void);
-const char *db_get_error_msg(void);
-const char *db_get_error_who(void);
-const char *db_get_handle_dbname(dbHandle * handle);
-const char *db_get_handle_dbschema(dbHandle * handle);
-const char *db_get_index_column_name(dbIndex * index, int column_num);
-const char *db_get_index_name(dbIndex * index);
-int db_get_index_number_of_columns(dbIndex * index);
-const char *db_get_index_table_name(dbIndex * index);
-int db_get_num_rows(dbCursor * cursor);
-char *db_get_string(const dbString * x);
-dbColumn *db_get_table_column(dbTable *, int);
-dbColumn *db_get_table_column_by_name(dbTable *, const char*);
-int db_get_table_delete_priv(dbTable * table);
-const char *db_get_table_description(dbTable * table);
-int db_get_table_insert_priv(dbTable * table);
-const char *db_get_table_name(dbTable * table);
-int db_get_table_number_of_columns(dbTable * table);
-int db_get_table_number_of_rows(dbDriver * driver, dbString * sql);
-int db_get_table_select_priv(dbTable * table);
-int db_get_table_update_priv(dbTable * table);
-double db_get_value_as_double(dbValue * value, int ctype);
-int db_get_value_day(dbValue * value);
-double db_get_value_double(dbValue * value);
-int db_get_value_hour(dbValue * value);
-int db_get_value_int(dbValue * value);
-int db_get_value_minute(dbValue * value);
-int db_get_value_month(dbValue * value);
-double db_get_value_seconds(dbValue * value);
-const char *db_get_value_string(dbValue * value);
-int db_get_value_year(dbValue * value);
-int db_grant_on_table(dbDriver * driver, const char *tableName, int priv,
-		      int to);
-int db_has_dbms(void);
-void db_init_column(dbColumn * column);
-void db_init_cursor(dbCursor * cursor);
-void db__init_driver_state(void);
-void db_init_handle(dbHandle * handle);
-void db_init_index(dbIndex * index);
-void db_init_string(dbString * x);
-void db_init_table(dbTable * table);
-int db_insert(dbCursor * cursor);
-void db_interval_range(int sqltype, int *from, int *to);
-int db_isdir(const char *path);
-int db_legal_tablename(const char *s);
-int db_list_databases(dbDriver * driver, dbString * path, int npaths,
-		      dbHandle ** handles, int *count);
-const char *db_list_drivers(void);
-int db_list_indexes(dbDriver * driver, dbString * table_name, dbIndex ** list,
-		    int *count);
-int db_list_tables(dbDriver * driver, dbString ** names, int *count,
-		   int system);
-void *db_malloc(int n);
-void db__mark_database_closed(void);
-void db__mark_database_open(const char *dbname, const char *dbpath);
-void db_memory_error(void);
-dbToken db_new_token(dbAddress address);
-int db_nocase_compare(const char *a, const char *b);
-void db_noproc_error(int procnum);
-int db_open_database(dbDriver * driver, dbHandle * handle);
-int db_open_insert_cursor(dbDriver * driver, dbCursor * cursor);
-int db_open_select_cursor(dbDriver * driver, dbString * select,
-			  dbCursor * cursor, int mode);
-int db_open_update_cursor(dbDriver * driver, dbString * table_name,
-			  dbString * select, dbCursor * cursor, int mode);
-void db_print_column_definition(FILE * fd, dbColumn * column);
-void db_print_error(void);
-void db_print_index(FILE * fd, dbIndex * index);
-void db_print_table_definition(FILE * fd, dbTable * table);
-void db_procedure_not_implemented(const char *name);
-void db_protocol_error(void);
-dbDbmscap *db_read_dbmscap(void);
-void *db_realloc(void *s, int n);
-int db__recv_char(char *d);
-int db__recv_column_default_value(dbColumn * column);
-int db__recv_column_definition(dbColumn * column);
-int db__recv_column_value(dbColumn * column);
-int db__recv_datetime(dbDateTime * t);
-int db__recv_double(double *d);
-int db__recv_double_array(double **x, int *n);
-int db__recv_float(float *d);
-int db__recv_float_array(float **x, int *n);
-int db__recv_handle(dbHandle * handle);
-int db__recv_index(dbIndex * index);
-int db__recv_index_array(dbIndex ** list, int *count);
-int db__recv_int(int *n);
-int db__recv_int_array(int **x, int *n);
-int db__recv_procnum(int *n);
-int db__recv_return_code(int *ret_code);
-int db__recv_short(short *n);
-int db__recv_short_array(short **x, int *n);
-int db__recv_string(dbString * x);
-int db__recv_string_array(dbString ** a, int *n);
-int db__recv_table_data(dbTable * table);
-int db__recv_table_definition(dbTable ** table);
-int db__recv_token(dbToken * token);
-int db__recv_value(dbValue * value, int Ctype);
-int db__send_Cstring(const char *s);
-int db__send_char(int d);
-int db__send_column_default_value(dbColumn * column);
-int db__send_column_definition(dbColumn * column);
-int db__send_column_value(dbColumn * column);
-int db__send_datetime(dbDateTime * t);
-int db__send_double(double d);
-int db__send_double_array(const double *x, int n);
-int db__send_failure(void);
-int db__send_float(float d);
-int db__send_float_array(const float *x, int n);
-int db__send_handle(dbHandle * handle);
-int db__send_index(dbIndex * index);
-int db__send_index_array(dbIndex * list, int count);
-int db__send_int(int n);
-int db__send_int_array(const int *x, int n);
-int db__send_procedure_not_implemented(int n);
-int db__send_procedure_ok(int n);
-int db__send_short(int n);
-int db__send_short_array(const short *x, int n);
-int db__send_string(dbString * x);
-int db__send_string_array(dbString * a, int count);
-int db__send_success(void);
-int db__send_table_data(dbTable * table);
-int db__send_table_definition(dbTable * table);
-int db__send_token(dbToken * token);
-int db__send_value(dbValue * value, int Ctype);
-int db_select_CatValArray(dbDriver * driver, const char *tab, const char *key,
-			  const char *col, const char *where,
-			  dbCatValArray * Cvarr);
-int db_select_int(dbDriver * driver, const char *table, const char *column,
-		  const char *where, int **pval);
-int db_select_value(dbDriver * driver, const char *table, const char *key,
-		    int id, const char *column, dbValue * value);
-int db_set_column_description(dbColumn * column, const char *description);
-void db_set_column_has_defined_default_value(dbColumn * column);
-void db_set_column_has_undefined_default_value(dbColumn * column);
-void db_set_column_host_type(dbColumn * column, int type);
-void db_set_column_length(dbColumn * column, int length);
-int db_set_column_name(dbColumn * column, const char *name);
-void db_set_column_null_allowed(dbColumn * column);
-void db_set_column_precision(dbColumn * column, int precision);
-void db_set_column_scale(dbColumn * column, int scale);
-void db_set_column_select_priv_granted(dbColumn * column);
-void db_set_column_select_priv_not_granted(dbColumn * column);
-void db_set_column_sqltype(dbColumn * column, int sqltype);
-void db_set_column_update_priv_granted(dbColumn * column);
-void db_set_column_update_priv_not_granted(dbColumn * column);
-void db_set_column_use_default_value(dbColumn * column);
-int db_set_connection(dbConnection * connection);
-void db_set_cursor_column_flag(dbCursor * cursor, int col);
-void db_set_cursor_column_for_update(dbCursor * cursor, int col);
-void db_set_cursor_mode(dbCursor * cursor, int mode);
-void db_set_cursor_mode_insensitive(dbCursor * cursor);
-void db_set_cursor_mode_scroll(dbCursor * cursor);
-void db_set_cursor_table(dbCursor * cursor, dbTable * table);
-void db_set_cursor_token(dbCursor * cursor, dbToken token);
-void db_set_cursor_type_insert(dbCursor * cursor);
-void db_set_cursor_type_readonly(dbCursor * cursor);
-void db_set_cursor_type_update(dbCursor * cursor);
-int db_set_default_connection(void);
-void db_set_error_who(const char *me);
-int db_set_handle(dbHandle * handle, const char *dbName, const char *dbPath);
-int db_set_index_column_name(dbIndex * index, int column_num,
-			     const char *name);
-int db_set_index_name(dbIndex * index, const char *name);
-int db_set_index_table_name(dbIndex * index, const char *name);
-int db_set_index_type_non_unique(dbIndex * index);
-int db_set_index_type_unique(dbIndex * index);
-void db__set_protocol_fds(FILE * send, FILE * recv);
-int db_set_string(dbString * x, const char *s);
-int db_set_string_no_copy(dbString * x, char *s);
-int db_set_table_column(dbTable *, int, dbColumn *);
-void db_set_table_delete_priv_granted(dbTable * table);
-void db_set_table_delete_priv_not_granted(dbTable * table);
-int db_set_table_description(dbTable * table, const char *description);
-void db_set_table_insert_priv_granted(dbTable * table);
-void db_set_table_insert_priv_not_granted(dbTable * table);
-int db_set_table_name(dbTable * table, const char *name);
-void db_set_table_select_priv_granted(dbTable * table);
-void db_set_table_select_priv_not_granted(dbTable * table);
-void db_set_table_update_priv_granted(dbTable * table);
-void db_set_table_update_priv_not_granted(dbTable * table);
-void db_set_value_datetime_current(dbValue * value);
-void db_set_value_datetime_not_current(dbValue * value);
-void db_set_value_day(dbValue * value, int day);
-void db_set_value_double(dbValue * value, double d);
-void db_set_value_hour(dbValue * value, int hour);
-void db_set_value_int(dbValue * value, int i);
-void db_set_value_minute(dbValue * value, int minute);
-void db_set_value_month(dbValue * value, int month);
-void db_set_value_not_null(dbValue * value);
-void db_set_value_null(dbValue * value);
-void db_set_value_seconds(dbValue * value, double seconds);
-int db_set_value_string(dbValue * value, const char *s);
-void db_set_value_year(dbValue * value, int year);
-int db_shutdown_driver(dbDriver * driver);
-const char *db_sqltype_name(int sqltype);
-int db_sqltype_to_Ctype(int sqltype);
-dbDriver *db_start_driver(const char *name);
-dbDriver *db_start_driver_open_database(const char *drvname,
-					const char *dbname);
-int db__start_procedure_call(int procnum);
-char *db_store(const char *s);
-void db_strip(char *buf);
-void db_syserror(const char *s);
-int db_table_exists(const char *drvname, const char *dbname,
-		    const char *tabname);
-int db_test_column_has_default_value(dbColumn * column);
-int db_test_column_has_defined_default_value(dbColumn * column);
-int db_test_column_has_undefined_default_value(dbColumn * column);
-int db_test_column_null_allowed(dbColumn * column);
-int db_test_column_use_default_value(dbColumn * column);
-int db_test_cursor_any_column_flag(dbCursor * cursor);
-int db_test_cursor_any_column_for_update(dbCursor * cursor);
-int db_test_cursor_column_flag(dbCursor * cursor, int col);
-int db_test_cursor_column_for_update(dbCursor * cursor, int col);
-int db_test_cursor_mode_insensitive(dbCursor * cursor);
-int db_test_cursor_mode_scroll(dbCursor * cursor);
-int db_test_cursor_type_fetch(dbCursor * cursor);
-int db_test_cursor_type_insert(dbCursor * cursor);
-int db_test_cursor_type_update(dbCursor * cursor);
-int db__test_database_open(void);
-int db_test_index_type_unique(dbIndex * index);
-int db_test_value_datetime_current(dbValue * value);
-int db_test_value_isnull(dbValue * value);
-void db_unset_column_has_default_value(dbColumn * column);
-void db_unset_column_null_allowed(dbColumn * column);
-void db_unset_column_use_default_value(dbColumn * column);
-void db_unset_cursor_column_flag(dbCursor * cursor, int col);
-void db_unset_cursor_column_for_update(dbCursor * cursor, int col);
-void db_unset_cursor_mode(dbCursor * cursor);
-void db_unset_cursor_mode_insensitive(dbCursor * cursor);
-void db_unset_cursor_mode_scroll(dbCursor * cursor);
-int db_update(dbCursor * cursor);
-int db_gversion(dbDriver * driver, dbString * client_version,
-		dbString * driver_version);
-const char *db_whoami(void);
-void db_zero(void *s, int n);
-void db_zero_string(dbString * x);
-unsigned int db_sizeof_string(const dbString * x);
-int db_set_login(const char *, const char *, const char *, const char *);
-int db_get_login(const char *, const char *, const char **, const char **);
-
-#endif

+ 49 - 22
lib/db/dbmi_base/alloc.c

@@ -1,13 +1,30 @@
+/*!
+  \file lib/db/dbmi_base/alloc.c
+  
+  \brief DBMI Library (base) - allocate memory
+  
+  (C) 1999-2009, 2011 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Joel Jones (CERL/UIUC), Radim Blazek
+  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
+*/
+
 #include <string.h>
 #include <stdlib.h>
 #include <grass/dbmi.h>
 
 /*!
-   \fn char *db_store (char *s)
-   \brief 
-   \return 
-   \param 
- */
+  \brief Make a copy of string buffer
+  
+  Allocated string buffer should be freed by db_free().
+
+  \param s source string buffer
+
+  \return allocated string buffer
+*/
 char *db_store(const char *s)
 {
     char *a;
@@ -19,10 +36,13 @@ char *db_store(const char *s)
 }
 
 /*!
-   \fn void *db_malloc (int n)
-   \brief 
-   \return 
-   \param 
+  \brief Allocate memory
+
+  On failure is called db_memory_error().
+  
+  \param n number of bytes to be allocated
+
+  \return pointer to allocated memory
  */
 void *db_malloc(int n)
 {
@@ -37,10 +57,14 @@ void *db_malloc(int n)
 }
 
 /*!
-   \fn void *db_calloc (int n, int m)
-   \brief 
-   \return 
-   \param 
+  \brief Allocate memory
+
+  On failure is called db_memory_error().
+  
+  \param n number of entities
+  \param m entity size
+
+  \return pointer to allocated memmory
  */
 void *db_calloc(int n, int m)
 {
@@ -57,10 +81,14 @@ void *db_calloc(int n, int m)
 }
 
 /*!
-   \fn void *db_realloc (void *s, int n)
-   \brief 
-   \return 
-   \param 
+  \brief Reallocate memory
+
+  On failure is called db_memory_error().
+  
+  \param s pointer to memory
+  \param n number of newly allocated bytes
+
+  \return pointer to allocated memmory
  */
 void *db_realloc(void *s, int n)
 {
@@ -76,11 +104,10 @@ void *db_realloc(void *s, int n)
 }
 
 /*!
-   \fn void *db_free (void *s)
-   \brief 
-   \return 
-   \param 
- */
+  \brief Free allocated memory
+  
+  \param s pointer to memory to be freed
+*/
 void *db_free(void *s)
 {
     free(s);

+ 35 - 23
lib/db/dbmi_base/case.c

@@ -1,11 +1,24 @@
+/*!
+  \file lib/db/dbmi_base/case.c
+  
+  \brief DBMI Library (base) - case string conversion
+  
+  (C) 1999-2009, 2011 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Joel Jones (CERL/UIUC), Radim Blazek
+  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
+*/
+
 #include <grass/dbmi.h>
 
 /*!
-   \fn void db_char_to_lowercase (char *s)
-   \brief 
-   \return 
-   \param 
- */
+  \brief Convert character to lowercase
+
+  \param s character to be modified
+*/
 void db_char_to_lowercase(char *s)
 {
     if (*s >= 'A' && *s <= 'Z')
@@ -13,10 +26,9 @@ void db_char_to_lowercase(char *s)
 }
 
 /*!
-   \fn void db_char_to_uppercase (char *s)
-   \brief 
-   \return 
-   \param 
+  \brief Convert character to uppercase
+
+  \param s character to be modified
  */
 void db_char_to_uppercase(char *s)
 {
@@ -25,11 +37,10 @@ void db_char_to_uppercase(char *s)
 }
 
 /*!
-   \fn void db_Cstring_to_lowercase (char *s)
-   \brief 
-   \return 
-   \param 
- */
+  \brief Convert string to lowercase
+
+  \param s string buffer to be modified
+*/
 void db_Cstring_to_lowercase(char *s)
 {
     while (*s)
@@ -37,11 +48,10 @@ void db_Cstring_to_lowercase(char *s)
 }
 
 /*!
-   \fn void db_Cstring_to_uppercase (char *s)
-   \brief 
-   \return 
-   \param 
- */
+  \brief Convert string to lowercase
+
+  \param s string buffer to be modified
+*/
 void db_Cstring_to_uppercase(char *s)
 {
     while (*s)
@@ -49,10 +59,12 @@ void db_Cstring_to_uppercase(char *s)
 }
 
 /*!
-   \fn int db_nocase_compare (char *a, char *b)
-   \brief 
-   \return 
-   \param 
+  \brief Compare strings case-insensitive
+
+  \param a,b string buffers to be compared
+
+  \return 0 strings equal
+  \return 1 otherwise
  */
 int db_nocase_compare(const char *a, const char *b)
 {

+ 27 - 22
lib/db/dbmi_base/column.c

@@ -1,23 +1,22 @@
 /*!
-  \file db/dbmi_base/column.c
+  \file lib/db/dbmi_base/column.c
   
   \brief DBMI Library (base) - columns management
   
-  (C) 1999-2009 by the GRASS Development Team
+  (C) 1999-2009, 2011 by the GRASS Development Team
   
-  This program is free software under the GNU General Public
-  License (>=v2). Read the file COPYING that comes with GRASS
-  for details.
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
   
   \author Joel Jones (CERL/UIUC), Radim Blazek
- */
+  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
+*/
 
 #include <stdlib.h>
 #include <string.h>
 #include <grass/gis.h>
 #include <grass/dbmi.h>
 
-
 /*!
   \brief Returns column value for given column structure
 
@@ -25,7 +24,7 @@
 
   \return pointer to dbValue
 */
-dbValue *db_get_column_value(dbColumn * column)
+dbValue *db_get_column_value(dbColumn *column)
 {
     return &column->value;
 }
@@ -43,10 +42,11 @@ dbValue *db_get_column_default_value(dbColumn * column)
 }
 
 /*!
-  \brief Define column sqltype for column (the function db_sqltype_name() 
-  returns sqltype description)
+  \brief Define column sqltype for column
 
-  \verbatim
+  The function db_sqltype_name() returns sqltype description.
+
+  \code
   #define DB_SQL_TYPE_UNKNOWN          0
   
   #define DB_SQL_TYPE_CHARACTER        1
@@ -63,12 +63,12 @@ dbValue *db_get_column_default_value(dbColumn * column)
   #define DB_SQL_TYPE_TEXT            13
   
   #define DB_SQL_TYPE_SERIAL          21
-  \endverbatim
+  \endcode
 
   \param column pointer to dbColumn
   \param sqltype SQL data type (see list)
 */
-void db_set_column_sqltype(dbColumn * column, int sqltype)
+void db_set_column_sqltype(dbColumn *column, int sqltype)
 {
     column->sqlDataType = sqltype;
 }
@@ -131,14 +131,15 @@ void db_set_column_precision(dbColumn * column, int precision)
 }
 
 /*!
-  \brief Returns column sqltype for column (the function
-  db_sqltype_name() returns sqltype description) \return \param
+  \brief Returns column sqltype for column
+
+  The function db_sqltype_name() returns sqltype description.
   
   \param column pointer to dbColumn
   
   \return sql data type (see include/dbmi.h)
 */
-int db_get_column_sqltype(dbColumn * column)
+int db_get_column_sqltype(dbColumn *column)
 {
     return column->sqlDataType;
 }
@@ -168,6 +169,8 @@ void db_set_column_has_defined_default_value(dbColumn * column)
 /*!
   \brief Unset default value identificator
 
+  \todo Replace by db_unset_column_has_default_value() ?
+
   \param column pointer to dbColumn
 */
 void db_set_column_has_undefined_default_value(dbColumn * column)
@@ -459,12 +462,14 @@ void db_free_column(dbColumn * column)
 
 
 /*!
- * \brief Copy a db column from source to destination
- *
- * \param src The column to copy from
- * \param dest An allocated column to copy to which will be initialized. In case dest is NULL a new column will be allocated and returned
- * \return The pointer of copied/allocated column
- */
+  \brief Copy a db column from source to destination
+  
+  \param src The column to copy from
+  \param dest An allocated column to copy to which will be
+  initialized. In case dest is NULL a new column will be allocated
+  and returned
+  \return The pointer of copied/allocated column
+*/
 dbColumn *db_copy_column(dbColumn *dest, dbColumn *src)
 {
     dbColumn *new = dest;

+ 46 - 28
lib/db/dbmi_base/columnfmt.c

@@ -1,12 +1,28 @@
+/*!
+  \file lib/db/dbmi_base/columnfmt.c
+  
+  \brief DBMI Library (base) - columns formating
+  
+  (C) 1999-2009, 2011 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Joel Jones (CERL/UIUC), Radim Blazek
+  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
+*/
+
 #include <grass/dbmi.h>
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
-int db_convert_Cstring_to_column_value(const char *Cstring, dbColumn * column)
+  \brief ?
+  
+  \param Cstring string buffer
+  \param column pointer to dbColumn
+  
+  \return ?
+*/
+int db_convert_Cstring_to_column_value(const char *Cstring, dbColumn *column)
 {
     dbValue *value;
     int sqltype;
@@ -17,14 +33,14 @@ int db_convert_Cstring_to_column_value(const char *Cstring, dbColumn * column)
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
-int
-db_convert_Cstring_to_column_default_value(const char *Cstring,
-					   dbColumn * column)
+  \brief ?
+  
+  \param Cstring string buffer
+  \param column pointer to dbColumn
+
+  \return ?
+*/
+int db_convert_Cstring_to_column_default_value(const char *Cstring, dbColumn *column)
 {
     dbValue *value;
     int sqltype;
@@ -35,12 +51,14 @@ db_convert_Cstring_to_column_default_value(const char *Cstring,
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
-int db_convert_column_value_to_string(dbColumn * column, dbString * string)
+  \brief ?
+
+  \param column pointer to dbColumn
+  \param string pointer to dbString
+
+  \return ?
+*/
+int db_convert_column_value_to_string(dbColumn *column, dbString *string)
 {
     int sqltype;
     dbValue *value;
@@ -51,14 +69,14 @@ int db_convert_column_value_to_string(dbColumn * column, dbString * string)
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
-int
-db_convert_column_default_value_to_string(dbColumn * column,
-					  dbString * string)
+  \brief ?
+
+  \param column pointer to dbColumn
+  \param string pointer to dbString
+
+  \return ?
+*/
+int db_convert_column_default_value_to_string(dbColumn *column, dbString *string)
 {
     int sqltype;
     dbValue *value;

+ 29 - 10
lib/db/dbmi_base/connect.c

@@ -1,11 +1,29 @@
+/*!
+  \file lib/db/dbmi_base/connect.c
+  
+  \brief DBMI Library (base) - connect to DB
+  
+  (C) 1999-2009, 2011 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Joel Jones (CERL/UIUC), Radim Blazek
+  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
+*/
+
 #include <grass/gis.h>
 #include <grass/dbmi.h>
 
 /*!
-   \fn int db_set_connection (dbConnection *connection )
-   \brief set default db connection settings
-   \return DB_OK
-   \param dbConnection
+  \brief Set default DB connection settings
+
+  This function sets enviromental variables as DB_DRIVER, DB_DATABASE,
+  DB_SCHEMA, DB_GROUP.
+
+  \param connection pointer to dbConnection with default settings
+  
+  \return DB_OK
  */
 int db_set_connection(dbConnection * connection)
 {
@@ -41,14 +59,15 @@ int db_set_connection(dbConnection * connection)
 }
 
 /*!
-   \fn int db_get_connection (dbConnection *connection )
-   \brief get default db connection settings
-   \return DB_OK
-   \param dbConnection
+  \brief Get default DB connection settings
+  
+  \param[out] connection pointer to dbConnection to be modified
+
+  \return DB_OK
  */
 int db_get_connection(dbConnection * connection)
 {
-    /* TODO: add checks and return DB_* error code if needed */
+  /* TODO: add checks and return DB_* error code if needed */
 
     connection->driverName = G__getenv2("DB_DRIVER", G_VAR_MAPSET);
     connection->databaseName = G__getenv2("DB_DATABASE", G_VAR_MAPSET);
@@ -61,6 +80,6 @@ int db_get_connection(dbConnection * connection)
        connection->user = G__getenv("DB_USER");
        connection->password = G__getenv("DB_PASSWORD");
      */
-
+    
     return DB_OK;
 }

+ 2 - 2
lib/db/dbmi_base/cursor.c

@@ -1,5 +1,5 @@
 /*!
-  \file db/dbmi_base/cursor.c
+  \file lib/db/dbmi_base/cursor.c
   
   \brief DBMI Library (base) - cursors management
   
@@ -18,7 +18,7 @@
 /*!
   \brief Initialize cursor
   
-  \param cursor pointer to dbCursor
+  \param cursor pointer to dbCursor to be initialized
 */
 void db_init_cursor(dbCursor *cursor)
 {

+ 43 - 28
lib/db/dbmi_base/datetime.c

@@ -1,3 +1,17 @@
+/*!
+  \file lib/db/dbmi_base/datetime.c
+  
+  \brief DBMI Library (base) - datetime conversions
+  
+  (C) 1999-2009, 2011 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Joel Jones (CERL/UIUC), Radim Blazek
+  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
+*/
+
 #include <stdio.h>
 #include <string.h>
 #include <grass/dbmi.h>
@@ -6,13 +20,16 @@ static char ds = '-';
 static char ts = ':';
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
+  \brief Convert datetime value into string
+
+  \param value pointer to dbValue
+  \param sqltype SQL data type
+  \param[out] string pointer to dbString
+
+  \return DB_OK on success
  */
-int db_convert_value_datetime_into_string(dbValue * value, int sqltype,
-					  dbString * string)
+int db_convert_value_datetime_into_string(dbValue *value, int sqltype,
+					  dbString *string)
 {
     int to, from;
     int year, month, day, hour, minute;
@@ -158,29 +175,27 @@ int db_convert_value_datetime_into_string(dbValue * value, int sqltype,
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
-/* NAME: db_convert_Cstring_to_value_datetime
- * INPUT: buf, a C string formated as indicated by sqltype, value, a dbValue
- *  to put the converted value into
- * OUTPUT: the converted datetime value in value
- * PROCESSING: the format of buf must be as follows
- *  buf == "CURRENT" in a case-insignificant fashion
- *   value is marked as current
- *  sqltype == DB_SQL_TYPE_DATE
- *   "year*month*day"
- *  sqltype == DB_SQL_TYPE_TIME
- *   "hour*minute*second"
- *  sqltype == DB_SQL_TYPE_TIMESTAMP
- *   "year*month*day hour*minute*second"
- *  otherwise the to and from markings in sqltype are used.
- *  where "*" represents any non-whitespace character
- */
+  \brief Convert datetime string to value
+
+  The format of <em>buf</em> must be as follows
+   - buf == "CURRENT" in a case-insignificant fashion value is marked as current
+   - sqltype == DB_SQL_TYPE_DATE
+    "year*month*day"
+   - sqltype == DB_SQL_TYPE_TIME
+    "hour*minute*second"
+   - sqltype == DB_SQL_TYPE_TIMESTAMP
+    "year*month*day hour*minute*second"
+   - otherwise the to and from markings in sqltype are used, 
+     where "*" represents any non-whitespace character
+  
+  \param buf input string buffer
+  \param sqltype SQL data type
+  \param[out] value pointer to dbValue to be set
+
+  \return DB_OK
+*/
 int db_convert_Cstring_to_value_datetime(const char *buf, int sqltype,
-					 dbValue * value)
+					 dbValue *value)
 {
     int from, to;
     int year, month, day, hour, minute;

+ 2 - 3
lib/db/dbmi_base/dbmscap.c

@@ -1,5 +1,5 @@
 /*!
-  \file db/dbmi_base/dbmscap.c
+  \file lib/db/dbmi_base/dbmscap.c
   
   \brief DBMI Library (base) - DBmscap management
   
@@ -203,8 +203,7 @@ dbDbmscap *db_read_dbmscap(void)
     return list;
 }
 
-static void
-add_entry(dbDbmscap ** list, char *name, char *startup, char *comment)
+static void add_entry(dbDbmscap ** list, char *name, char *startup, char *comment)
 {
     dbDbmscap *head, *cur, *tail;
 

+ 1 - 1
lib/db/dbmi_base/default_name.c

@@ -1,5 +1,5 @@
 /*!
-  \file db/dbmi_base/default_name.c
+  \file lib/db/dbmi_base/default_name.c
   
   \brief DBMI Library (base) - default settings
   

+ 39 - 21
lib/db/dbmi_base/dirent.c

@@ -1,3 +1,17 @@
+/*!
+  \file lib/db/dbmi_base/dirent.c
+  
+  \brief DBMI Library (base) - directory entities management
+  
+  (C) 1999-2010 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Joel Jones (CERL/UIUC)
+  \author Upgraded to GRASS 5.7 by Radim Blazek
+*/
+
 #include <string.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -19,19 +33,21 @@ typedef struct dirent dir_entry;
 extern DIR *opendir();
 extern dir_entry *readdir();
 
-static int cmp_dirent(const void *aa, const void *bb);
-static int get_perm(char *path);
-static void sort_dirent(dbDirent * a, int n);
-
+static int cmp_dirent(const void *, const void *);
+static int get_perm(char *);
+static void sort_dirent(dbDirent *, int);
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
-/* read directory and build an array of dbDirent's */
-/* append one entry with name = NULL to mark end of array */
+  \brief Read directory and build an array of dbDirent's
+  
+  Append one entry with name = NULL to mark end of array
+  
+  \param dirname directory name
+  \param[out] number of entities
+
+  \return pointer to dbDirent
+  \return NULL on error
+*/
 dbDirent *db_dirent(const char *dirname, int *n)
 {
     DIR *dp;
@@ -93,11 +109,11 @@ dbDirent *db_dirent(const char *dirname, int *n)
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Free dbDirent
+
+  \param dirent pointer to dbDirent
+  \param count number of entities in the array
+*/
 void db_free_dirent_array(dbDirent * dirent, int count)
 {
     int i;
@@ -140,11 +156,13 @@ static void sort_dirent(dbDirent * a, int n)
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Allocate dirent array
+
+  \param count number of entities in the array
+
+  \return pointer to dbDirent array
+  \return NULL on failure
+*/
 dbDirent *db_alloc_dirent_array(int count)
 {
     int i;

+ 83 - 95
lib/db/dbmi_base/error.c

@@ -1,8 +1,23 @@
+/*!
+  \file lib/db/dbmi_base/error.c
+  
+  \brief DBMI Library (base) - error management
+  
+  (C) 1999-2011 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Joel Jones (CERL/UIUC)
+  \author Upgraded to GRASS 5.7 by Radim Blazek
+  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
+*/
+
 #include <string.h>
 #include <stdlib.h>
-#include <grass/dbmi.h>
-
 #include <errno.h>
+#include <grass/dbmi.h>
+#include <grass/glocale.h>
 
 static int err_flag = 0;
 static int err_code = DB_OK;
@@ -14,22 +29,20 @@ static void (*user_print_function) (const char *);
 static char *who = NULL;
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief User defined error procedure
+
+  \param f pointer to user-defined function
+*/
 void db_on_error(void (*f) (const char *))
 {
     user_print_function = f;
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Set 'who' for error messages
+
+  \param me my name
+*/
 void db_set_error_who(const char *me)
 {
     if (who)
@@ -38,26 +51,25 @@ void db_set_error_who(const char *me)
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  brief Get 'who' string
+
+  \return pointer to string buffer
+  \return empty buffer if 'who' is not defined
+*/
 const char *db_get_error_who(void)
 {
     return who ? who : "";
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Report error message
+  
+  \param s error message (can be NULL)
+*/
 void db_error(const char *s)
 {
     if (s == NULL)
-	s = "<NULL error message>";
+	s = _("<NULL error message>");
     if (err_msg)
 	db_free(err_msg);
     err_msg = db_store(s);
@@ -68,28 +80,24 @@ void db_error(const char *s)
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Report protocol error
+*/
 void db_protocol_error(void)
 {
     int flag;
 
     flag = auto_print_errors;
     auto_print_errors = auto_print_protocol_errors;
-    db_error("dbmi: Protocol error");
+    db_error(_("dbmi: Protocol error"));
     auto_print_errors = flag;
     err_code = DB_PROTOCOL_ERR;
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Report system error
+  
+  \param s error message
+*/
 void db_syserror(const char *s)
 {
     char lead[1024];
@@ -111,10 +119,9 @@ void db_syserror(const char *s)
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
+  \brief Get error code
+  
+  \return DB_OK if not defined
  */
 int db_get_error_code(void)
 {
@@ -122,53 +129,45 @@ int db_get_error_code(void)
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief  Report memory error
+*/
 void db_memory_error(void)
 {
-    db_error("dbmi: Out of Memory");
+    db_error(_("dbmi: Out of Memory"));
     err_code = DB_MEMORY_ERR;
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Report 'not implemented' error
+
+  \param name name of functionality
+*/
 void db_procedure_not_implemented(const char *name)
 {
     char msg[128];
 
-    sprintf(msg, "dbmi: %s() not implemented", name);
+    sprintf(msg, _("dbmi: %s() not implemented"), name);
     db_error(msg);
     err_code = DB_NOPROC;
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Report no procedure error
+
+  \param procnum procedure number
+*/
 void db_noproc_error(procnum)
 {
     char msg[128];
 
-    sprintf(msg, "dbmi: Invalid procedure %d", procnum);
+    sprintf(msg, _("dbmi: Invalid procedure %d"), procnum);
     db_error(msg);
     err_code = DB_NOPROC;
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Clear error status
+*/
 void db_clear_error(void)
 {
     err_flag = 0;
@@ -177,11 +176,10 @@ void db_clear_error(void)
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Print error
+
+  If not defined, the error message is printed to stderr.
+*/
 void db_print_error(void)
 {
     char lead[1024];
@@ -207,33 +205,26 @@ void db_print_error(void)
 static int debug_on = 0;
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Turn on debuging
+*/
 void db_debug_on(void)
 {
     debug_on = 1;
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Turn off debuging
+*/
 void db_debug_off(void)
 {
     debug_on = 0;
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Print debug message
+
+  \param s debug message
+*/
 void db_debug(const char *s)
 {
     if (debug_on)
@@ -241,22 +232,20 @@ void db_debug(const char *s)
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Get error message
+
+  \return pointer to error message string
+*/
 const char *db_get_error_msg(void)
 {
     return err_flag ? err_msg : (const char *)NULL;
 }
 
 /*!
-   \fn void db_auto_print_errors (flag)
-   \brief toggles printing of DBMI error messages
-   \return void
-   \param flag
- */
+  \brief Toggles printing of DBMI error messages
+
+  \param flag ?
+*/
 void db_auto_print_errors(int flag)
 {
     auto_print_errors = flag;
@@ -264,10 +253,9 @@ void db_auto_print_errors(int flag)
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
+  \brief Set auto print protocol error
+
+  \param flag ?
  */
 void db_auto_print_protocol_errors(int flag)
 {

+ 1 - 1
lib/db/dbmi_base/handle.c

@@ -1,5 +1,5 @@
 /*!
-  \file db/dbmi_base/handle.c
+  \file lib/db/dbmi_base/handle.c
   
   \brief DBMI Library (base) - handle management
   

+ 119 - 81
lib/db/dbmi_base/index.c

@@ -1,13 +1,27 @@
+/*!
+  \file lib/db/dbmi_base/index.c
+  
+  \brief DBMI Library (base) - index management
+  
+  (C) 1999-2009, 2011 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Joel Jones (CERL/UIUC), Radim Blazek
+  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
+*/
+
 #include <string.h>
 #include <stdlib.h>
 #include <grass/dbmi.h>
+#include <grass/glocale.h>
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Initialize dbIndex
+
+  \param index pointer to dbIndex to be initialized
+*/
 void db_init_index(dbIndex * index)
 {
     db_init_string(&index->indexName);
@@ -18,11 +32,10 @@ void db_init_index(dbIndex * index)
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Free allocated dbIndex
+
+  \param index pointer to dbIndex to be freed
+*/
 void db_free_index(dbIndex * index)
 {
     db_free_string(&index->indexName);
@@ -33,11 +46,13 @@ void db_free_index(dbIndex * index)
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Allocate index columns
+
+  \param index pointer to dbIndex
+  \param ncols number of columns to be allocated
+
+  \return DB_OK
+*/
 int db_alloc_index_columns(dbIndex * index, int ncols)
 {
     index->columnNames = db_alloc_string_array(ncols);
@@ -49,11 +64,12 @@ int db_alloc_index_columns(dbIndex * index, int ncols)
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Allocate index array
+
+  \param count number of items
+
+  \return pointer to allocated dbIndex array
+*/
 dbIndex *db_alloc_index_array(int count)
 {
     dbIndex *list;
@@ -68,11 +84,11 @@ dbIndex *db_alloc_index_array(int count)
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Free index array
+
+  \param list dbIndex array
+  \param count number of items in the array
+*/
 void db_free_index_array(dbIndex * list, int count)
 {
     int i;
@@ -85,32 +101,39 @@ void db_free_index_array(dbIndex * list, int count)
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Set index name
+
+  \param index pointer to dbIndex
+  \param name name to be set
+
+  \return DB_OK on success
+  \return DB_FAILED on error
+*/
 int db_set_index_name(dbIndex * index, const char *name)
 {
     return db_set_string(&index->indexName, name);
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Get index name
+
+  \param index pointer to dbIndex
+  
+  \return string buffer with name
+*/
 const char *db_get_index_name(dbIndex * index)
 {
     return db_get_string(&index->indexName);
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
+  \brief Set table name
+
+  \param index pointer to dbIndex
+  \param name name to be set
+
+  \return DB_OK on success
+  \return DB_FAILED on error
  */
 int db_set_index_table_name(dbIndex * index, const char *name)
 {
@@ -118,64 +141,74 @@ int db_set_index_table_name(dbIndex * index, const char *name)
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Get table name
+
+  \param index pointer to dbIndex
+  
+  \return string buffer with name
+*/
 const char *db_get_index_table_name(dbIndex * index)
 {
     return db_get_string(&index->tableName);
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Get number of columns
+
+  \param index pointer to dbIndex
+
+  \return number of columns
+*/
 int db_get_index_number_of_columns(dbIndex * index)
 {
     return index->numColumns;
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
-int
-db_set_index_column_name(dbIndex * index, int column_num, const char *name)
+  \brief Set column name
+
+  \param index pointer to dbIndex
+  \param column_num column number
+  \param name name to be set
+
+  \return DB_OK on success
+  \return DB_FAILED on error
+*/
+int db_set_index_column_name(dbIndex * index, int column_num, const char *name)
 {
     if (column_num < 0 || column_num >= index->numColumns) {
-	db_error("db_set_index_column_name(): invalid column number");
+	db_error(_("db_set_index_column_name(): invalid column number"));
 	return db_get_error_code();
     }
     return db_set_string(&index->columnNames[column_num], name);
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
+  \brief Get column number
+
+  \param index pointer to dbIndex
+  \param column_num column number
+
+  \return string buffer with name
  */
 const char *db_get_index_column_name(dbIndex * index, int column_num)
 {
     if (column_num < 0 || column_num >= index->numColumns) {
-	db_error("db_get_index_column_name(): invalid column number");
+	db_error(_("db_get_index_column_name(): invalid column number"));
 	return ((const char *)NULL);
     }
     return db_get_string(&index->columnNames[column_num]);
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Set index type to unique
+
+  \todo return type void?
+
+  \param index pointer to dbIndex
+
+  \return 0
+*/
 int db_set_index_type_unique(dbIndex * index)
 {
     index->unique = 1;
@@ -184,11 +217,14 @@ int db_set_index_type_unique(dbIndex * index)
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Set index type to non-unique
+  
+  \void return type void?
+
+  \param index pointer to dbIndex
+
+  \return 0
+*/
 int db_set_index_type_non_unique(dbIndex * index)
 {
     index->unique = 0;
@@ -197,10 +233,12 @@ int db_set_index_type_non_unique(dbIndex * index)
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
+  \brief Test if type is unique
+
+  \param index pointer to dbIndex
+
+  \return non-zero if True
+  \return zero if False
  */
 int db_test_index_type_unique(dbIndex * index)
 {
@@ -208,11 +246,11 @@ int db_test_index_type_unique(dbIndex * index)
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Report index 
+
+  \param fd file where to print index info
+  \param index pointer to dbIndex
+*/
 void db_print_index(FILE * fd, dbIndex * index)
 {
     int i, nCols;

+ 19 - 4
lib/db/dbmi_base/interval.c

@@ -1,10 +1,25 @@
+/*!
+  \file lib/db/dbmi_base/interval.c
+  
+  \brief DBMI Library (base) - range, interval procedures
+  
+  (C) 1999-2009, 2011 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Joel Jones (CERL/UIUC), Radim Blazek
+  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
+*/
+
 #include <grass/dbmi.h>
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
+  \brief Define range based on SQL data type
+
+  \param sqltype SQL data type
+  \param[out] from 
+  \param[out] to
  */
 void db_interval_range(int sqltype, int *from, int *to)
 {

+ 21 - 5
lib/db/dbmi_base/isdir.c

@@ -1,3 +1,17 @@
+/*!
+  \file lib/db/dbmi_base/isdir.c
+  
+  \brief DBMI Library (base) - test for directories
+  
+  (C) 1999-2009, 2011 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Joel Jones (CERL/UIUC), Radim Blazek
+  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
+*/
+
 #include <grass/config.h>
 #include <grass/dbmi.h>
 #include <unistd.h>
@@ -5,11 +19,13 @@
 #include <sys/stat.h>
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Test if path is a directory
+
+  \param path pathname
+
+  \return DB_OK on success
+  \return DB_FAILED on failure
+*/
 int db_isdir(const char *path)
 {
     STRUCT_STAT x;

+ 31 - 20
lib/db/dbmi_base/legal_dbname.c

@@ -1,19 +1,33 @@
+/*!
+  \file lib/db/dbmi_base/legal_dbname.c
+  
+  \brief DBMI Library (base) - validate DB names
+
+  \todo Are we as restrictive here as for vector names?
+  
+  (C) 1999-2009, 2011 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Joel Jones (CERL/UIUC), Radim Blazek
+  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
+*/
+
 #include <grass/gis.h>
 #include <grass/dbmi.h>
 #include <grass/glocale.h>
 
-/* TODO: are we as restrictive here as for vector names? */
-
 /*!
-   \fn int db_legal_tablename (char *s)
-   \brief  Check if output is legal table name
-   \return 1 OK
-   \return -1 if name does not start with letter A..Za..z
-   or if name does not continue with A..Za..z0..9_@
-   Rule:  [A-Za-z][A-Za-z0-9_@]*
-   \param  name table name to be checked
- */
-
+  \brief Check if output is legal table name
+  
+  Rule:  [A-Za-z][A-Za-z0-9_@]*
+  \param s table name to be checked
+
+  \return 1 OK 
+  \return -1 if name does not start with letter A..Za..z or if name does
+  not continue with A..Za..z0..9_@
+*/
 int db_legal_tablename(const char *s)
 {
     char buf[GNAME_MAX];
@@ -21,17 +35,15 @@ int db_legal_tablename(const char *s)
     sprintf(buf, "%s", s);
 
     if (*s == '.' || *s == 0) {
-	fprintf(stderr,
-		_("Illegal table map name <%s>. May not contain '.' or 'NULL'.\n"),
-		buf);
+	G_warning(_("Illegal table map name <%s>. May not contain '.' or 'NULL'."),
+		  buf);
 	return DB_FAILED;
     }
 
     /* file name must start with letter */
     if (!((*s >= 'A' && *s <= 'Z') || (*s >= 'a' && *s <= 'z'))) {
-	fprintf(stderr,
-		_("Illegal table map name <%s>. Must start with a letter.\n"),
-		buf);
+	G_warning(_("Illegal table map name <%s>. Must start with a letter."),
+		  buf);
 	return DB_FAILED;
     }
 
@@ -39,9 +51,8 @@ int db_legal_tablename(const char *s)
 	if (!
 	    ((*s >= 'A' && *s <= 'Z') || (*s >= 'a' && *s <= 'z') ||
 	     (*s >= '0' && *s <= '9') || *s == '_' || *s == '@')) {
-	    fprintf(stderr,
-		    _("Illegal table map name <%s>. Character <%c> not allowed.\n"),
-		    buf, *s);
+	    G_warning(_("Illegal table map name <%s>. Character <%c> not allowed."),
+		      buf, *s);
 	    return DB_FAILED;
 	}
 

+ 22 - 21
lib/db/dbmi_base/login.c

@@ -1,5 +1,5 @@
 /*!
-  \file db/dbmi_base/login.c
+  \file lib/db/dbmi_base/login.c
   
   \brief DBMI Library (base) - login settings
   
@@ -160,15 +160,15 @@ static int write_file(LOGIN * login)
 }
 
 /*!
-   \brief Set user/password for driver/database
-   
-   \param driver driver name
-   \param database database name
-   \param user user name
-   \param password password string
-   
-   \return DB_OK
-   \return DB_FAILED
+  \brief Set user/password for driver/database
+  
+  \param driver driver name
+  \param database database name
+  \param user user name
+  \param password password string
+  
+  \return DB_OK
+  \return DB_FAILED
  */
 int db_set_login(const char *driver, const char *database, const char *user,
 		 const char *password)
@@ -212,17 +212,18 @@ int db_set_login(const char *driver, const char *database, const char *user,
     return DB_OK;
 }
 
-/*!
-   \brief Get user/password for driver/database if driver/database is not found, user/password are set to NULL
-
-   \param driver driver name
-   \param database database name
-   \param[out] user name
-   \param[out] password string
-   
-   \return DB_OK
-   \return DB_FAILED
- */
+/*!  
+  \brief Get user/password for driver/database if driver/database
+  is not found, user/password are set to NULL
+  
+  \param driver driver name
+  \param database database name
+  \param[out] user name
+  \param[out] password string
+  
+  \return DB_OK
+  \return DB_FAILED
+*/
 int db_get_login(const char *driver, const char *database, const char **user,
 		 const char **password)
 {

+ 33 - 0
lib/db/dbmi_base/ret_codes.c

@@ -1,13 +1,39 @@
+/*!
+  \file lib/db/dbmi_base/ret_codes.c
+  
+  \brief DBMI Library (base) - return codes (internal use only)
+
+  \todo Are we as restrictive here as for vector names?
+  
+  (C) 1999-2009, 2011 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Joel Jones (CERL/UIUC), Radim Blazek
+  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
+*/
+
 #include <stdlib.h>
 #include <grass/dbmi.h>
 #include "macros.h"
 
+/*!
+  \brief Send success code
+
+  \return DB_OK
+*/
 int db__send_success()
 {
     DB_SEND_INT(DB_OK);
     return DB_OK;
 }
 
+/*!
+  \brief Send failure code
+
+  \return DB_OK
+*/
 int db__send_failure()
 {
     DB_SEND_INT(DB_FAILED);
@@ -15,6 +41,13 @@ int db__send_failure()
     return DB_OK;
 }
 
+/*!
+  \brief Receive return code
+  
+  \param[out] ret_code return code
+
+  \return DB_OK on success
+*/
 int db__recv_return_code(int *ret_code)
 {
     dbString err_msg;

+ 20 - 5
lib/db/dbmi_base/sqlCtype.c

@@ -1,11 +1,26 @@
+/*!
+  \file lib/db/dbmi_base/sqlCtype.c
+  
+  \brief DBMI Library (base) - SQL data type to C data type
+
+  (C) 1999-2009, 2011 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Joel Jones (CERL/UIUC), Radim Blazek
+  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
+*/
+
 #include <grass/dbmi.h>
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Get C data type based on given SQL data type
+
+  \param sqltype SQL data type
+
+  \return related C data type
+*/
 int db_sqltype_to_Ctype(int sqltype)
 {
     switch (sqltype) {

+ 20 - 4
lib/db/dbmi_base/sqltype.c

@@ -1,11 +1,27 @@
+/*!
+  \file lib/db/dbmi_base/sqltype.c
+  
+  \brief DBMI Library (base) - SQL data type
+
+  (C) 1999-2009, 2011 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Joel Jones (CERL/UIUC), Radim Blazek
+  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
+*/
+
 #include <string.h>
 #include <grass/dbmi.h>
 
 /*!
-   \brief returns sqltype description
-   \return 
-   \param 
- */
+  \brief Get SQL data type description
+
+  \param sqltype SQL data type
+
+  \return string buffer with description
+*/
 const char *db_sqltype_name(int sqltype)
 {
     static char buf[256];

+ 3 - 3
lib/db/dbmi_base/string.c

@@ -18,9 +18,9 @@
 #include <grass/dbmi.h>
 
 /*!
-   \brief Initialize dbString 
-
-   \param[in,out] x pointer to dbString
+  \brief Initialize dbString 
+  
+  \param[out] x pointer to dbString
  */
 void db_init_string(dbString * x)
 {

+ 21 - 11
lib/db/dbmi_base/strip.c

@@ -1,17 +1,27 @@
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
-/*  db_strip(buf)
- *     char *buf         buffer to be worked on
- *
- *  'buf' is rewritten in place with leading and trailing white
- *  space removed.
- */
+  \file lib/db/dbmi_base/strip.c
+  
+  \brief DBMI Library (base) - strip strings
+  
+  (C) 1999-2009, 2011 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Joel Jones (CERL/UIUC), Radim Blazek
+  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
+*/
 
+#include <grass/dbmi.h>
 
+/*!
+  \brief Strip given string
+
+  'buf' is rewritten in place with leading and trailing white
+  space removed.
+
+  \param buf string buffer
+*/
 void db_strip(char *buf)
 {
     char *a, *b;

+ 143 - 110
lib/db/dbmi_base/table.c

@@ -1,12 +1,29 @@
+/*!
+  \file lib/db/dbmi_base/table.c
+  
+  \brief DBMI Library (base) - table management
+  
+  (C) 1999-2009, 2011 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Joel Jones (CERL/UIUC), Radim Blazek
+  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
+*/
+
 #include <stdlib.h>
 #include <string.h>
 #include <grass/gis.h>
 #include <grass/dbmi.h>
 
 /*!
-   \brief Alloacte a table with a specific number of columns
-   \param The number of columns which should be allocated
-   \return The allocated table or NULL in case of an error
+  \brief Allocate a table with a specific number of columns
+  
+  \param ncols number of columns which should be allocated
+  
+  \return allocated dbTable
+  \return NULL in case of an error
  */
 dbTable *db_alloc_table(int ncols)
 {
@@ -33,8 +50,9 @@ dbTable *db_alloc_table(int ncols)
 
 /*!
    \brief Initialize the table to zero
+   
    \param table pointer to dbTable
- */
+*/
 void db_init_table(dbTable * table)
 {
     db_zero((void *)table, sizeof(dbTable));
@@ -43,9 +61,10 @@ void db_init_table(dbTable * table)
 }
 
 /*!
- * \brief Free the table
- * \param table pointer to dbTable
- */
+  \brief Free the table
+  
+  \param table pointer to dbTable
+*/
 void db_free_table(dbTable * table)
 {
     int i;
@@ -60,30 +79,36 @@ void db_free_table(dbTable * table)
 
 /*!
    \brief Set the name of the table
- * \param table pointer to dbTable
- * \param name The name of the table
-   \return 
- */
+
+   \param table pointer to dbTable
+   \param name The name of the table
+
+   \return DB_OK on success
+*/
 int db_set_table_name(dbTable * table, const char *name)
 {
     return db_set_string(&table->tableName, name);
 }
 
 /*!
-   \brief Get the name of the table
-   \param table pointer to dbTable
-   \return name of the table
- */
+  \brief Get the name of the table
+
+  \param table pointer to dbTable
+
+  \return name of the table
+*/
 const char *db_get_table_name(dbTable * table)
 {
     return db_get_string(&table->tableName);
 }
 
 /*!
-   \brief Set the description of the table
- * \param table pointer to dbTable
- * \param name The description of the table
-   \return
+  \brief Set the description of the table
+  
+  \param table pointer to dbTable
+  \param name description of the table
+  
+  \return DB_OK
  */
 int db_set_table_description(dbTable * table, const char *description)
 {
@@ -91,31 +116,29 @@ int db_set_table_description(dbTable * table, const char *description)
 }
 
 /*!
-   \brief Get the description of the table
-   \param table pointer to dbTable
-   \return description of the table
- */
+  \brief Get the description of the table
+
+  \param table pointer to dbTable
+  
+  \return description of the table
+*/
 const char *db_get_table_description(dbTable * table)
 {
     return db_get_string(&table->description);
 }
 
 /*!
-   \brief Return the number of columns of the table
- * \param table pointer to dbTable
-   \return Number of columns
- */
+  \brief Return the number of columns of the table
+  
+  \param table pointer to dbTable
+  
+  \return number of columns
+*/
 int db_get_table_number_of_columns(dbTable * table)
 {
     return table->numColumns;
 }
 
-/*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
 static void set_all_column_privs(dbTable * table, void (*set_column_priv) ())
 {
     int col, ncols;
@@ -128,12 +151,6 @@ static void set_all_column_privs(dbTable * table, void (*set_column_priv) ())
     }
 }
 
-/*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
 static int get_all_column_privs(dbTable * table, int (*get_column_priv) ())
 {
     int priv, col, ncols;
@@ -150,67 +167,74 @@ static int get_all_column_privs(dbTable * table, int (*get_column_priv) ())
 }
 
 /*!
-   \brief Grant selection privileges for all columns
-   \param table pointer to dbTable
- */
+  \brief Grant selection privileges for all columns
+  
+  \param table pointer to dbTable
+*/
 void db_set_table_select_priv_granted(dbTable * table)
 {
     set_all_column_privs(table, db_set_column_select_priv_granted);
 }
 
 /*!
-   \brief Set selection privileges not granted for all columns
-   \param table pointer to dbTable
- */
+  \brief Set selection privileges not granted for all columns
+  
+  \param table pointer to dbTable
+*/
 void db_set_table_select_priv_not_granted(dbTable * table)
 {
     set_all_column_privs(table, db_set_column_select_priv_not_granted);
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Get table select privileges
+
+  \param table pointer to dbTable
+ 
+  \return privilages
+*/
 int db_get_table_select_priv(dbTable * table)
 {
     return get_all_column_privs(table, db_get_column_select_priv);
 }
 
 /*!
-   \brief Grant update privileges for all columns
-   \param table pointer to dbTable
- */
+  \brief Grant update privileges for all columns
+
+  \param table pointer to dbTable
+*/
 void db_set_table_update_priv_granted(dbTable * table)
 {
     set_all_column_privs(table, db_set_column_update_priv_granted);
 }
 
 /*!
-   \brief Set update privileges not granted for all columns
-   \param table pointer to dbTable
- */
+  \brief Set update privileges not granted for all columns
+  
+  \param table pointer to dbTable
+*/
 void db_set_table_update_priv_not_granted(dbTable * table)
 {
     set_all_column_privs(table, db_set_column_update_priv_not_granted);
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Get table update privileges
+
+  \param table pointer to dbTable
+
+  \return privilages
+*/
 int db_get_table_update_priv(dbTable * table)
 {
     return get_all_column_privs(table, db_get_column_update_priv);
 }
 
 /*!
-   \brief Grant insert privileges for table
-   \param table pointer to dbTable
- */
+  \brief Grant insert privileges for table
+  
+  \param table pointer to dbTable
+*/
 void db_set_table_insert_priv_granted(dbTable * table)
 {
     table->priv_insert = DB_GRANTED;
@@ -218,6 +242,7 @@ void db_set_table_insert_priv_granted(dbTable * table)
 
 /*!
    \brief Set insert privileges not granted for table
+   
    \param table pointer to dbTable
  */
 void db_set_table_insert_priv_not_granted(dbTable * table)
@@ -226,19 +251,21 @@ void db_set_table_insert_priv_not_granted(dbTable * table)
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Get table insert privileges
+
+  \param table pointer to dbTable
+
+  \return prilileges
+*/
 int db_get_table_insert_priv(dbTable * table)
 {
     return table->priv_insert;
 }
 
 /*!
-   \brief Grant delete privileges for table
-   \param table pointer to dbTable
+  \brief Grant delete privileges for table
+  
+  \param table pointer to dbTable
  */
 void db_set_table_delete_priv_granted(dbTable * table)
 {
@@ -246,26 +273,27 @@ void db_set_table_delete_priv_granted(dbTable * table)
 }
 
 /*!
-   \brief Set delete privileges not granted for table
-   \param table pointer to dbTable
- */
+  \brief Set delete privileges not granted for table
+  
+  \param table pointer to dbTable
+*/
 void db_set_table_delete_priv_not_granted(dbTable * table)
 {
     table->priv_delete = DB_NOT_GRANTED;
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Get table delete privileges
+
+  \param table pointer to dbTable
+
+  \return privileges
+*/
 int db_get_table_delete_priv(dbTable * table)
 {
     return table->priv_delete;
 }
 
-
 /*!
   \brief Returns column structure for given table and column number
 
@@ -312,15 +340,16 @@ dbColumn *db_get_table_column_by_name(dbTable * table, const char* name)
 }
 
 /*!
- * \brief Set a specific column for given table and column number
- *
- * \param table Pointer to dbTable
- * \param idx Column index (starting with '0').  The index must be in range.
- * \param column Pointer to a dbColumn to insert.
- * A copy of the column stored, so the original column can be deleted.
- * \return DB_OK on success
- * \return DB_FAILURE on error
- */
+  \brief Set a specific column for given table and column number
+  
+  \param table Pointer to dbTable
+  \param idx Column index (starting with '0').  The index must be in range.
+  \param column Pointer to a dbColumn to insert.
+  A copy of the column stored, so the original column can be deleted.
+  
+  \return DB_OK on success
+  \return DB_FAILURE on error
+*/
 int db_set_table_column(dbTable * table, int idx, dbColumn *column)
 {
     if (idx < 0 || idx >= table->numColumns)
@@ -330,14 +359,15 @@ int db_set_table_column(dbTable * table, int idx, dbColumn *column)
 }
 
 /*!
- * \brief Append a specific column to given table
- *
- * \param table Pointer to dbTable
- * \param column Pointer to a dbColumn to append.
- * A copy of the column is stored, so the original column can be deleted.
- * \return DB_OK on success
- * \return DB_FAILURE on error
- */
+  \brief Append a specific column to given table
+  
+  \param table Pointer to dbTable
+  \param column Pointer to a dbColumn to append.
+  A copy of the column is stored, so the original column can be deleted.
+  
+  \return DB_OK on success
+  \return DB_FAILURE on error
+*/
 int db_append_table_column(dbTable * table, dbColumn *column)
 {
     table->columns = (dbColumn*)db_realloc((void*)table->columns, sizeof(dbColumn)*(table->numColumns + 1));
@@ -349,14 +379,15 @@ int db_append_table_column(dbTable * table, dbColumn *column)
 }
 
 /*!
- * \brief Make a new exact copy of an existing table
- *
- * New memory is allocated for the clone, the columns-content will be copied too.
- *
- * \param src Pointer to dbTable
- * \return A new alloacted clone of the given table on success 
- * \return NULL on error
- */
+  \brief Make a new exact copy of an existing table
+  
+  New memory is allocated for the clone, the columns-content will be copied too.
+  
+  \param src Pointer to dbTable
+  
+  \return A new alloacted clone of the given table on success 
+  \return NULL on error
+*/
 dbTable *db_clone_table(dbTable *src)
 {
     int i, n = db_get_table_number_of_columns(src);
@@ -382,11 +413,13 @@ dbTable *db_clone_table(dbTable *src)
 
 /*!
    \brief Create SQL CREATE sring from table definition
-   \param table
- * \param sql The dbString to store the SQL CREATE string
- * \return DB_OK on success
- *  \return DB_FAILED on error
- */
+ 
+   \param table pointer to dbTable
+   \param sql dbString to store the SQL CREATE string
+
+   \return DB_OK on success
+   \return DB_FAILED on error
+*/
 int db_table_to_sql(dbTable * table, dbString * sql)
 {
     int col, ncols;

+ 185 - 152
lib/db/dbmi_base/value.c

@@ -1,46 +1,67 @@
+/*!
+  \file lib/db/dbmi_base/value.c
+  
+  \brief DBMI Library (base) - value management
+  
+  (C) 1999-2009, 2011 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Joel Jones (CERL/UIUC), Radim Blazek
+  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
+*/
+
 #include <stdlib.h>
 #include <grass/dbmi.h>
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Check of value is null
+
+  \param value pointer to dbValue
+
+  \return non-zero is null
+  \return zero is not null
+*/
 int db_test_value_isnull(dbValue * value)
 {
     return (value->isNull != 0);
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Get integer value
+
+  \param value pointer to dbValue
+
+  \return value
+*/
 int db_get_value_int(dbValue * value)
 {
     return (value->i);
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Get double precision value
+
+  \param value pointer to dbValue
+
+  \return value
+*/
 double db_get_value_double(dbValue * value)
 {
     return (value->d);
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
-/* for given value and C type of value returns double representation */
+  \brief Get value as double
+  
+  For given value and C type of value returns double representation.
+
+  \param value pointer to dbValue
+  \param ctype C data type
+
+  \return value
+*/
 double db_get_value_as_double(dbValue * value, int ctype)
 {
     double val;
@@ -62,110 +83,115 @@ double db_get_value_as_double(dbValue * value, int ctype)
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Get string value
+
+  \param value pointer to dbValue
+
+  \return value
+*/
 const char *db_get_value_string(dbValue * value)
 {
     return (db_get_string(&value->s));
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Get year value
+
+  \param value pointer to dbValue
+
+  \return value
+*/
 int db_get_value_year(dbValue * value)
 {
     return (value->t.year);
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Get month value
+
+  \param value pointer to dbValue
+
+  \return value
+*/
 int db_get_value_month(dbValue * value)
 {
     return (value->t.month);
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Get day value
+
+  \param value pointer to dbValue
+
+  \return value
+*/
 int db_get_value_day(dbValue * value)
 {
     return (value->t.day);
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Get hour value
+
+  \param value pointer to dbValue
+
+  \return value
+*/
 int db_get_value_hour(dbValue * value)
 {
     return (value->t.hour);
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Get minute value
+
+  \param value pointer to dbValue
+
+  \return value
+*/
 int db_get_value_minute(dbValue * value)
 {
     return (value->t.minute);
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Get seconds value
+
+  \param value pointer to dbValue
+
+  \return value
+*/
 double db_get_value_seconds(dbValue * value)
 {
     return (value->t.seconds);
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Set value to null
+
+  \param value pointer to dbValue
+*/
 void db_set_value_null(dbValue * value)
 {
     value->isNull = 1;
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Set value to not null
+
+  \param value pointer to dbValue
+*/
 void db_set_value_not_null(dbValue * value)
 {
     value->isNull = 0;
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Set integer value
+
+  \param value pointer to dbValue
+  \param i integer value
+*/
 void db_set_value_int(dbValue * value, int i)
 {
     value->i = i;
@@ -173,11 +199,11 @@ void db_set_value_int(dbValue * value, int i)
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Set double precision value
+
+  \param value pointer to dbValue
+  \param d double value
+*/
 void db_set_value_double(dbValue * value, double d)
 {
     value->d = d;
@@ -185,11 +211,11 @@ void db_set_value_double(dbValue * value, double d)
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Set string value
+
+  \param value pointer to dbValue
+  \param s string value
+*/
 int db_set_value_string(dbValue * value, const char *s)
 {
     db_set_value_not_null(value);
@@ -197,11 +223,11 @@ int db_set_value_string(dbValue * value, const char *s)
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Set year value
+
+  \param value pointer to dbValue
+  \param year year value
+*/
 void db_set_value_year(dbValue * value, int year)
 {
     value->t.year = year;
@@ -209,11 +235,11 @@ void db_set_value_year(dbValue * value, int year)
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Set month value
+
+  \param value pointer to dbValue
+  \param month month value
+*/
 void db_set_value_month(dbValue * value, int month)
 {
     value->t.month = month;
@@ -221,11 +247,11 @@ void db_set_value_month(dbValue * value, int month)
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Set day value
+
+  \param value pointer to dbValue
+  \param day day value
+*/
 void db_set_value_day(dbValue * value, int day)
 {
     value->t.day = day;
@@ -233,11 +259,11 @@ void db_set_value_day(dbValue * value, int day)
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Set hour value
+
+  \param value pointer to dbValue
+  \param hour hour value
+*/
 void db_set_value_hour(dbValue * value, int hour)
 {
     value->t.hour = hour;
@@ -245,11 +271,11 @@ void db_set_value_hour(dbValue * value, int hour)
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Set minute value
+
+  \param value pointer to dbValue
+  \param minute minute value
+*/
 void db_set_value_minute(dbValue * value, int minute)
 {
     value->t.minute = minute;
@@ -257,11 +283,11 @@ void db_set_value_minute(dbValue * value, int minute)
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Set seconds value
+
+  \param value pointer to dbValue
+  \param seconds seconds value
+*/
 void db_set_value_seconds(dbValue * value, double seconds)
 {
     value->t.seconds = seconds;
@@ -269,22 +295,23 @@ void db_set_value_seconds(dbValue * value, double seconds)
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Check if datatime is current
+
+  \param value pointer to dbValue
+
+  \return non-zero for true
+  \return zero for false
+*/
 int db_test_value_datetime_current(dbValue * value)
 {
     return (value->t.current != 0);
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Set datetime to current
+
+  \param value pointer to dbValue
+*/
 void db_set_value_datetime_current(dbValue * value)
 {
     value->t.current = 1;
@@ -292,11 +319,10 @@ void db_set_value_datetime_current(dbValue * value)
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Set value to non-current
+
+  \param value pointer to dbValue
+*/
 void db_set_value_datetime_not_current(dbValue * value)
 {
     value->t.current = 0;
@@ -304,12 +330,13 @@ void db_set_value_datetime_not_current(dbValue * value)
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
-/* copy value from src to destination */
+  \brief Copy value
+
+  Copy value from src to destination
+  
+  \param dst destination dbValue
+  \param src source dbValue
+*/
 void db_copy_value(dbValue * dst, dbValue * src)
 {
     dst->isNull = src->isNull;
@@ -327,11 +354,10 @@ void db_copy_value(dbValue * dst, dbValue * src)
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Initialize dbCatValArray
+
+  \param arr pointer to dbCatValArray to be initialized
+*/
 void db_CatValArray_init(dbCatValArray * arr)
 {
     arr->n_values = 0;
@@ -340,11 +366,10 @@ void db_CatValArray_init(dbCatValArray * arr)
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Free allocated dbCatValArray
+
+  \param arr pointer to dbCatValArray
+*/
 void db_CatValArray_free(dbCatValArray * arr)
 {
     if (arr->ctype == DB_C_TYPE_STRING || arr->ctype == DB_C_TYPE_DATETIME) {
@@ -364,11 +389,15 @@ void db_CatValArray_free(dbCatValArray * arr)
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Allocate dbCatValArray
+
+  \todo return type void?
+
+  \param arr pointer to dbCatValArray
+  \param n number of items
+
+  \return DB_OK
+*/
 int db_CatValArray_alloc(dbCatValArray * arr, int n)
 {
     arr->value = (dbCatVal *) G_calloc(n, sizeof(dbCatVal));
@@ -379,11 +408,15 @@ int db_CatValArray_alloc(dbCatValArray * arr, int n)
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Realloc dbCatValArray
+
+  \todo return code void?
+
+  \param arr pointer to dbCatValArray
+  \param n number of items
+
+  \return DB_OK
+*/
 int db_CatValArray_realloc(dbCatValArray * arr, int n)
 {
     arr->value = (dbCatVal *) G_realloc(arr->value, n * sizeof(dbCatVal));

+ 35 - 16
lib/db/dbmi_base/valuefmt.c

@@ -1,16 +1,34 @@
+/*!
+  \file lib/db/dbmi_base/valuefmt.c
+  
+  \brief DBMI Library (base) - value formating
+  
+  (C) 1999-2009, 2011 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Joel Jones (CERL/UIUC), Radim Blazek
+  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
+*/
+
 #include <stdio.h>
 #include <string.h>
 #include <grass/gis.h>
 #include <grass/dbmi.h>
+#include <grass/glocale.h>
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
+  \brief Convert string to value
+
+  \param Cstring string buffer
+  \param sqltype SQL data type
+  \param[out] value pointer to dbValue
+
+  \return DB_OK on success
+  \return DB_FAILED on error
  */
-int
-db_convert_Cstring_to_value(const char *Cstring, int sqltype, dbValue * value)
+int db_convert_Cstring_to_value(const char *Cstring, int sqltype, dbValue * value)
 {
     int i;
     double d;
@@ -31,20 +49,22 @@ db_convert_Cstring_to_value(const char *Cstring, int sqltype, dbValue * value)
     case DB_C_TYPE_DATETIME:
 	return db_convert_Cstring_to_value_datetime(Cstring, sqltype, value);
     default:
-	db_error("db_convert_Cstring_to_value(): unrecognized sqltype");
+	db_error(_("db_convert_Cstring_to_value(): unrecognized sqltype"));
 	return DB_FAILED;
     }
     return DB_OK;
 }
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
-int
-db_convert_value_to_string(dbValue * value, int sqltype, dbString * string)
+  \brief Convert value to string
+  
+  \param value pointer to dbValue
+  \param sqltype SQL data type
+  \param[out] string pointer to dbString
+
+  \return DB_OK on success
+*/
+int db_convert_value_to_string(dbValue * value, int sqltype, dbString * string)
 {
     char buf[64];
     const char *bp = buf;
@@ -68,8 +88,7 @@ db_convert_value_to_string(dbValue * value, int sqltype, dbString * string)
 	    return db_convert_value_datetime_into_string(value, sqltype,
 							 string);
 	default:
-	    db_error
-		("db_convert_value_into_string(): unrecongized sqltype-type");
+	    db_error(_("db_convert_value_into_string(): unrecongized sqltype-type"));
 	    return DB_FAILED;
 	}
     }

+ 22 - 9
lib/db/dbmi_base/whoami.c

@@ -1,16 +1,29 @@
+/*!
+  \file lib/db/dbmi_base/whoami.c
+  
+  \brief DBMI Library (base) - who am i
+  
+  (C) 1999-2009, 2011 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Joel Jones (CERL/UIUC), Radim Blazek
+  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
+*/
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <grass/gis.h>
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
-char *db_whoami()
-{
-    char *userid = G_store(getenv("LOGNAME"));
+  \brief Who am i?
 
-    return userid;
+  Check enviromental variable LOGNAME
+
+  \return string buffer with logname
+*/
+const char *db_whoami()
+{
+    return G_store(getenv("LOGNAME"));
 }

+ 27 - 15
lib/db/dbmi_base/xdr.c

@@ -1,19 +1,17 @@
+/*!
+  \file lib/db/dbmi_base/xdr.c
+  
+  \brief DBMI Library (base) - external data representation
+  
+  (C) 1999-2009, 2011 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Joel Jones (CERL/UIUC), Radim Blazek, Brad Douglas, Markus Neteler
+  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
+*/
 
-/****************************************************************************
- *
- * MODULE:       dbmi_base
- * AUTHOR(S):    CERL (Joel Jones + possible other original contributors)
- *               Radim Blazek <radim.blazek gmail.com>,
- *               Brad Douglas <rez touchofmadness.com>, 
- *               Markus Neteler <neteler itc.it>
- * PURPOSE:      database management functions for modules and drivers
- * COPYRIGHT:    (C) 2003-2006 by the GRASS Development Team
- *
- *               This program is free software under the GNU General Public
- *               License (>=v2). Read the file COPYING that comes with GRASS
- *               for details.
- *
- *****************************************************************************/
 #include "xdr.h"
 
 #ifdef __MINGW32__
@@ -68,12 +66,26 @@ static ssize_t writen(int fd, const void *buf, size_t count)
 
 #endif
 
+/*!
+  \brief ?
+  
+  \param send
+  \param recv
+*/
 void db__set_protocol_fds(FILE * send, FILE * recv)
 {
     _send = send;
     _recv = recv;
 }
 
+/*!
+  \brief ?
+
+  \param buf
+  \param size
+
+  \return
+*/
 int db__send(const void *buf, size_t size)
 {
 #if USE_STDIO

+ 26 - 0
lib/db/dbmi_base/xdrchar.c

@@ -1,6 +1,26 @@
+/*!
+  \file lib/db/dbmi_base/xdrchar.c
+  
+  \brief DBMI Library (base) - external data representation (char)
+  
+  (C) 1999-2009, 2011 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Joel Jones (CERL/UIUC), Radim Blazek, Brad Douglas, Markus Neteler
+  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
+*/
+
 #include "xdr.h"
 
+/*!
+  \brief ?
+  
+  \param d
 
+  \return
+*/
 int db__send_char(int d)
 {
     int stat = DB_OK;
@@ -15,7 +35,13 @@ int db__send_char(int d)
     return stat;
 }
 
+/*!
+  \brief ?
+
+  \param d
 
+  \return
+*/
 int db__recv_char(char *d)
 {
     int stat = DB_OK;

+ 53 - 0
lib/db/dbmi_base/xdrcolumn.c

@@ -1,7 +1,27 @@
+/*!
+  \file lib/db/dbmi_base/xdrcolumn.c
+  
+  \brief DBMI Library (base) - external data representation (column)
+  
+  (C) 1999-2009, 2011 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Joel Jones (CERL/UIUC), Radim Blazek, Brad Douglas, Markus Neteler
+  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
+*/
+
 #include <grass/dbmi.h>
 #include "macros.h"
 
+/*!
+  \brief Send column definition
+  
+  \param column pointer to dbColumn
 
+  \return DB_OK
+*/
 int db__send_column_definition(dbColumn * column)
 {
     DB_SEND_STRING(&column->columnName);
@@ -23,6 +43,13 @@ int db__send_column_definition(dbColumn * column)
     return DB_OK;
 }
 
+/*!
+  \brief Receive column definition
+
+  \param column pointer to dbColumn
+
+  \return DB_OK
+*/
 int db__recv_column_definition(dbColumn * column)
 {
     DB_RECV_STRING(&column->columnName);
@@ -44,26 +71,52 @@ int db__recv_column_definition(dbColumn * column)
     return DB_OK;
 }
 
+/*!
+  \brief Send column value
 
+  \param column pointer to dbColumn
+
+  \return
+*/
 int db__send_column_value(dbColumn * column)
 {
     return db__send_value(db_get_column_value(column),
 			  db_sqltype_to_Ctype(db_get_column_sqltype(column)));
 }
 
+/*!
+  \brief Receive column value
+
+  \param column pointer to dbColumn
 
+  \return
+*/
 int db__recv_column_value(dbColumn * column)
 {
     return db__recv_value(db_get_column_value(column),
 			  db_sqltype_to_Ctype(db_get_column_sqltype(column)));
 }
 
+/*!
+  \brief Send column default value
+
+  \param column pointer to dbColumn
+
+  \return
+*/
 int db__send_column_default_value(dbColumn * column)
 {
     return db__send_value(db_get_column_default_value(column),
 			  db_sqltype_to_Ctype(db_get_column_sqltype(column)));
 }
 
+/*!
+  \brief Receive column default value
+
+  \param column pointer to dbColumn
+
+  \return
+*/
 int db__recv_column_default_value(dbColumn * column)
 {
     return db__recv_value(db_get_column_default_value(column),

+ 27 - 0
lib/db/dbmi_base/xdrdatetime.c

@@ -1,7 +1,27 @@
+/*!
+  \file lib/db/dbmi_base/xdrdatetime.c
+  
+  \brief DBMI Library (base) - external data representation (datatime)
+  
+  (C) 1999-2009, 2011 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Joel Jones (CERL/UIUC), Radim Blazek, Brad Douglas, Markus Neteler
+  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
+*/
+
 #include <grass/dbmi.h>
 #include "macros.h"
 
+/*!
+  \brief Send datetime
+
+  \param t pointer to dbDateTime
 
+  \return DB_OK
+*/
 int db__send_datetime(dbDateTime * t)
 {
     DB_SEND_CHAR(t->current);
@@ -17,6 +37,13 @@ int db__send_datetime(dbDateTime * t)
     return DB_OK;
 }
 
+/*!
+  \brief Receive datetime
+
+  \param t pointer to dbDateTime
+
+  \return DB_OK
+*/
 int db__recv_datetime(dbDateTime * t)
 {
     DB_RECV_CHAR(&t->current);

+ 43 - 2
lib/db/dbmi_base/xdrdouble.c

@@ -1,6 +1,26 @@
+/*!
+  \file lib/db/dbmi_base/xdrdouble.c
+  
+  \brief DBMI Library (base) - external data representation (double)
+  
+  (C) 1999-2009, 2011 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Joel Jones (CERL/UIUC), Radim Blazek, Brad Douglas, Markus Neteler
+  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
+*/
+
 #include "xdr.h"
 
+/*!
+  \brief Send double
+
+  \param d
 
+  \return
+*/
 int db__send_double(double d)
 {
     int stat = DB_OK;
@@ -14,6 +34,11 @@ int db__send_double(double d)
     return stat;
 }
 
+/*!
+  \brief Receive double
+
+  \param d
+*/
 int db__recv_double(double *d)
 {
     int stat = DB_OK;
@@ -27,7 +52,14 @@ int db__recv_double(double *d)
     return stat;
 }
 
+/*!
+  \brief Send double array
+
+  \param x
+  \param n
 
+  \return
+*/							\
 int db__send_double_array(const double *x, int n)
 {
     int stat = DB_OK;
@@ -44,8 +76,17 @@ int db__send_double_array(const double *x, int n)
     return stat;
 }
 
-/* returns an allocated array of doubles */
-/* caller is responsible for free() */
+/*!
+  \brief Receive double array
+
+  Returns an allocated array of doubles
+  Caller is responsible for free()
+
+  \param x
+  \param n
+
+  \return
+*/
 int db__recv_double_array(double **x, int *n)
 {
     int stat = DB_OK;

+ 45 - 2
lib/db/dbmi_base/xdrfloat.c

@@ -1,6 +1,26 @@
+/*!
+  \file lib/db/dbmi_base/xdrfloat.c
+  
+  \brief DBMI Library (base) - external data representation (float)
+  
+  (C) 1999-2009, 2011 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Joel Jones (CERL/UIUC), Radim Blazek, Brad Douglas, Markus Neteler
+  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
+*/
+
 #include "xdr.h"
 
+/*!
+  \brief Send float
+
+  \param d
 
+  \return 
+*/
 int db__send_float(float d)
 {
     int stat = DB_OK;
@@ -14,6 +34,13 @@ int db__send_float(float d)
     return stat;
 }
 
+/*!
+  \brief Receive float
+
+  \param d
+
+  \return
+*/
 int db__recv_float(float *d)
 {
     int stat = DB_OK;
@@ -27,7 +54,14 @@ int db__recv_float(float *d)
     return stat;
 }
 
+/*!
+  \brief Send float array
 
+  \param x
+  \param n
+
+  \return
+*/
 int db__send_float_array(const float *x, int n)
 {
     int stat = DB_OK;
@@ -44,8 +78,17 @@ int db__send_float_array(const float *x, int n)
     return stat;
 }
 
-/* returns an allocated array of floats */
-/* caller is responsible for free() */
+/*!
+  \brief Receive float array
+  
+  Returns an allocated array of floats
+  Caller is responsible for free()
+
+  \param x
+  \param n
+
+  \return
+*/
 int db__recv_float_array(float **x, int *n)
 {
     int stat = DB_OK;

+ 27 - 0
lib/db/dbmi_base/xdrhandle.c

@@ -1,7 +1,27 @@
+/*!
+  \file lib/db/dbmi_base/xdrhandle.c
+  
+  \brief DBMI Library (base) - external data representation (handle)
+  
+  (C) 1999-2009, 2011 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Joel Jones (CERL/UIUC), Radim Blazek, Brad Douglas, Markus Neteler
+  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
+*/
+
 #include <grass/dbmi.h>
 #include "macros.h"
 
+/*!
+  \brief Send handle
+
+  \param handle
 
+  \return
+*/
 int db__send_handle(dbHandle * handle)
 {
     DB_SEND_STRING(&handle->dbName);
@@ -10,6 +30,13 @@ int db__send_handle(dbHandle * handle)
     return DB_OK;
 }
 
+/*!
+  \brief Receive handle
+
+  \param handle
+
+  \return
+*/
 int db__recv_handle(dbHandle * handle)
 {
     DB_RECV_STRING(&handle->dbName);

+ 42 - 0
lib/db/dbmi_base/xdrindex.c

@@ -1,7 +1,28 @@
+/*!
+  \file lib/db/dbmi_base/xdrindex.c
+  
+  \brief DBMI Library (base) - external data representation (index)
+  
+  (C) 1999-2009, 2011 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Joel Jones (CERL/UIUC), Radim Blazek, Brad Douglas, Markus Neteler
+  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
+*/
+
 #include <grass/dbmi.h>
 #include "macros.h"
 
 
+/*!
+  \brief Send index
+
+  \param index
+
+  \return
+*/
 int db__send_index(dbIndex * index)
 {
     int i;
@@ -19,6 +40,14 @@ int db__send_index(dbIndex * index)
     return DB_OK;
 }
 
+/*!
+  \brief Send index array
+
+  \param list
+  \param count
+
+  \return
+*/
 int db__send_index_array(dbIndex * list, int count)
 {
     int i;
@@ -30,6 +59,13 @@ int db__send_index_array(dbIndex * list, int count)
     return DB_OK;
 }
 
+/*!
+  \brief Receive index
+
+  \param index
+
+  \return
+*/
 int db__recv_index(dbIndex * index)
 {
     int i, ncols;
@@ -51,6 +87,12 @@ int db__recv_index(dbIndex * index)
     return DB_OK;
 }
 
+/*!
+  \brief Receive index array
+
+  \param list
+  \param count
+*/
 int db__recv_index_array(dbIndex ** list, int *count)
 {
     int i;

+ 46 - 2
lib/db/dbmi_base/xdrint.c

@@ -1,6 +1,26 @@
+/*!
+  \file lib/db/dbmi_base/xdrint.c
+  
+  \brief DBMI Library (base) - external data representation (integer)
+  
+  (C) 1999-2009, 2011 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Joel Jones (CERL/UIUC), Radim Blazek, Brad Douglas, Markus Neteler
+  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
+*/
+
 #include "xdr.h"
 
+/*!
+  \brief Send integer
+
+  \param n
 
+  \return
+*/
 int db__send_int(int n)
 {
     int stat = DB_OK;
@@ -14,6 +34,13 @@ int db__send_int(int n)
     return stat;
 }
 
+/*!
+  \brief Receive integer
+
+  \param n
+
+  \return
+*/
 int db__recv_int(int *n)
 {
     int stat = DB_OK;
@@ -27,6 +54,14 @@ int db__recv_int(int *n)
     return stat;
 }
 
+/*!
+  \brief Send integer array
+
+  \param x
+  \param n
+
+  \return
+*/
 int db__send_int_array(const int *x, int n)
 {
     int stat = DB_OK;
@@ -43,8 +78,17 @@ int db__send_int_array(const int *x, int n)
     return stat;
 }
 
-/* returns an allocated array of ints */
-/* caller is responsible for free() */
+/*!
+  \brief Receive integer array
+
+  Returns an allocated array of ints
+  Caller is responsible for free()
+
+  \param x
+  \param n
+
+  \return
+*/
 int db__recv_int_array(int **x, int *n)
 {
     int stat = DB_OK;

+ 41 - 6
lib/db/dbmi_base/xdrprocedure.c

@@ -1,8 +1,27 @@
+/*!
+  \file lib/db/dbmi_base/xdrprocedure.c
+  
+  \brief DBMI Library (base) - external data representation (procedure)
+  
+  (C) 1999-2009, 2011 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Joel Jones (CERL/UIUC), Radim Blazek, Brad Douglas, Markus Neteler
+  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
+*/
+
 #include "xdr.h"
 #include "macros.h"
 
+/*!
+  \brief ? (client only)
+
+  \param procnum
 
-/******** client only ***************/
+  \return
+*/
 int db__start_procedure_call(int procnum)
 {
     int reply;
@@ -22,12 +41,14 @@ int db__start_procedure_call(int procnum)
     return DB_OK;
 }
 
-/***** driver only *******************/
+/*!
+  \brief ? (driver only)
 
-/* return codes:
- * DB_OK  ok
- * DB_EOF eof from client
- */
+  \param n
+
+  \return DB_OK  ok
+  \returnDB_EOF eof from client
+*/
 int db__recv_procnum(int *n)
 {
     int stat = DB_OK;
@@ -38,11 +59,25 @@ int db__recv_procnum(int *n)
     return stat;
 }
 
+/*!
+  \brief ?
+
+  \param n
+
+  \return
+*/
 int db__send_procedure_ok(int n)
 {
     return db__send_int(n);
 }
 
+/*!
+  \brief ?
+
+  \param n
+
+  \return
+*/
 int db__send_procedure_not_implemented(int n)
 {
     return db__send_int(n ? 0 : -1);

+ 46 - 2
lib/db/dbmi_base/xdrshort.c

@@ -1,7 +1,27 @@
+/*!
+  \file lib/db/dbmi_base/xdrshort.c
+  
+  \brief DBMI Library (base) - external data representation (short)
+  
+  (C) 1999-2009, 2011 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Joel Jones (CERL/UIUC), Radim Blazek, Brad Douglas, Markus Neteler
+  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
+*/
+
 #include <stdlib.h>
 #include "xdr.h"
 
+/*!
+  \brief Send short
+
+  \param n
 
+  \return
+*/
 int db__send_short(int n)
 {
     int stat = DB_OK;
@@ -16,6 +36,13 @@ int db__send_short(int n)
     return stat;
 }
 
+/*!
+  \brief Receive short
+
+  \param n
+
+  \return
+*/
 int db__recv_short(short *n)
 {
     int stat = DB_OK;
@@ -29,6 +56,14 @@ int db__recv_short(short *n)
     return stat;
 }
 
+/*!
+  \brief Send short array
+
+  \param x
+  \param n
+
+  \return
+*/
 int db__send_short_array(const short *x, int n)
 {
     int stat = DB_OK;
@@ -45,8 +80,17 @@ int db__send_short_array(const short *x, int n)
     return stat;
 }
 
-/* returns an allocated array of ints */
-/* caller is responsible for free() */
+/*!
+  \brief Receive short array
+
+  Returns an allocated array of ints
+  Caller is responsible for free()
+
+  \param x
+  \param n
+
+  \return
+*/
 int db__recv_short_array(short **x, int *n)
 {
     int stat = DB_OK;

+ 52 - 9
lib/db/dbmi_base/xdrstring.c

@@ -1,7 +1,28 @@
+/*!
+  \file lib/db/dbmi_base/xdrstring.c
+  
+  \brief DBMI Library (base) - external data representation (string)
+  
+  (C) 1999-2009, 2011 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Joel Jones (CERL/UIUC), Radim Blazek, Brad Douglas, Markus Neteler
+  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
+*/
+
 #include <string.h>
 #include "xdr.h"
 
+/*!
+  \brief Send string array
+
+  \param a
+  \param count
 
+  \return
+*/
 int db__send_string_array(dbString * a, int count)
 {
     int i;
@@ -14,7 +35,14 @@ int db__send_string_array(dbString * a, int count)
     return stat;
 }
 
-/* note: dbString *a; ...(...,&a...) */
+/*!
+  \brief Receive string array
+
+  \param a
+  \param n
+
+  \return
+*/
 int db__recv_string_array(dbString ** a, int *n)
 {
     int i, count;
@@ -48,6 +76,13 @@ int db__recv_string_array(dbString ** a, int *n)
     return DB_OK;
 }
 
+/*!
+  \brief Send string
+
+  \param x
+
+  \return
+*/
 int db__send_string(dbString * x)
 {
     int stat = DB_OK;
@@ -69,14 +104,15 @@ int db__send_string(dbString * x)
     return stat;
 }
 
-/*
- * db__recv_string (dbString *x)
- *  reads a string from transport
- *
- *  returns DB_OK, DB_MEMORY_ERR, or DB_PROTOCOL_ERR
- *    x.s will be NULL if error
- *
- * NOTE: caller MUST initialize x by calling db_init_string()
+/*!
+  \brief Reads a string from transport
+ 
+  Note: caller MUST initialize x by calling db_init_string()
+
+  \param x
+
+  \return DB_OK, DB_MEMORY_ERR, or DB_PROTOCOL_ERR
+  \return NULL if error
  */
 int db__recv_string(dbString * x)
 {
@@ -104,6 +140,13 @@ int db__recv_string(dbString * x)
     return stat;
 }
 
+/*!
+  \brief Send C string
+
+  \param s
+
+  \return
+*/
 int db__send_Cstring(const char *s)
 {
     dbString x;

+ 43 - 1
lib/db/dbmi_base/xdrtable.c

@@ -1,7 +1,28 @@
+/*!
+  \file lib/db/dbmi_base/xdrtable.c
+  
+  \brief DBMI Library (base) - external data representation (table)
+  
+  (C) 1999-2009, 2011 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Joel Jones (CERL/UIUC), Radim Blazek, Brad Douglas, Markus Neteler
+  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
+*/
+
 #include <grass/dbmi.h>
+#include <grass/glocale.h>
 #include "macros.h"
 
+/*!
+  \brief Send table definition
+
+  \param table pointer to dbTable
 
+  \return
+*/
 int db__send_table_definition(dbTable * table)
 {
     int i;
@@ -20,6 +41,13 @@ int db__send_table_definition(dbTable * table)
     return DB_OK;
 }
 
+/*!
+  \brief Receive table definition
+
+  \param[out] table
+
+  \return
+*/
 int db__recv_table_definition(dbTable ** table)
 {
     int i, ncols;
@@ -43,6 +71,13 @@ int db__recv_table_definition(dbTable ** table)
     return DB_OK;
 }
 
+/*!
+  \brief Send table data
+
+  \param table
+
+  \return
+*/
 int db__send_table_data(dbTable * table)
 {
     int i, ncols;
@@ -56,6 +91,13 @@ int db__send_table_data(dbTable * table)
     return DB_OK;
 }
 
+/*!
+  \brief Receive table data
+
+  \param table
+
+  \return
+*/
 int db__recv_table_data(dbTable * table)
 {
     int i, ncols;
@@ -64,7 +106,7 @@ int db__recv_table_data(dbTable * table)
     DB_RECV_INT(&i);
 
     if (i != ncols) {
-	db_error("fetch: table has wrong number of columns");
+	db_error(_("fetch: table has wrong number of columns"));
 	return DB_FAILED;
     }
     for (i = 0; i < ncols; i++) {

+ 27 - 0
lib/db/dbmi_base/xdrtoken.c

@@ -1,11 +1,38 @@
+/*!
+  \file lib/db/dbmi_base/xdrtoken.c
+  
+  \brief DBMI Library (base) - external data representation (token)
+  
+  (C) 1999-2009, 2011 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Joel Jones (CERL/UIUC), Radim Blazek, Brad Douglas, Markus Neteler
+  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
+*/
+
 #include <grass/dbmi.h>
 
+/*!
+  \brief Send token
+
+  \param token
 
+  \return
+*/
 int db__send_token(dbToken * token)
 {
     return db__send_int(*token);
 }
 
+/*!
+  \brief Receive token
+
+  \param token
+
+  \return
+*/
 int db__recv_token(dbToken * token)
 {
     return db__recv_int(token);

+ 33 - 1
lib/db/dbmi_base/xdrvalue.c

@@ -1,6 +1,30 @@
+/*!
+  \file lib/db/dbmi_base/xdrvalue.c
+  
+  \brief DBMI Library (base) - external data representation (value)
+  
+  (C) 1999-2009, 2011 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Joel Jones (CERL/UIUC), Radim Blazek, Brad Douglas, Markus Neteler
+  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
+*/
+
 #include <grass/dbmi.h>
+#include <grass/glocale.h>
+
 #include "macros.h"
 
+/*!
+  \brief Send value
+
+  \param value
+  \param Ctype
+
+  \return
+*/
 int db__send_value(dbValue * value, int Ctype)
 {
     DB_SEND_CHAR(value->isNull);
@@ -27,6 +51,14 @@ int db__send_value(dbValue * value, int Ctype)
     return DB_OK;
 }
 
+/*!
+  \brief Receive value
+
+  \param value
+  \param Ctype
+
+  \return
+*/
 int db__recv_value(dbValue * value, int Ctype)
 {
     DB_RECV_CHAR(&value->isNull);
@@ -47,7 +79,7 @@ int db__recv_value(dbValue * value, int Ctype)
 	DB_RECV_DATETIME(&value->t);
 	break;
     default:
-	db_error("send data: invalid C-type");
+	db_error(_("send data: invalid C-type"));
 	return DB_FAILED;
     }
     return DB_OK;

+ 19 - 5
lib/db/dbmi_base/zero.c

@@ -1,11 +1,25 @@
+/*!
+  \file lib/db/dbmi_base/zero.c
+  
+  \brief DBMI Library (base) - zero 
+  
+  (C) 1999-2009, 2011 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Joel Jones (CERL/UIUC), Radim Blazek, Brad Douglas, Markus Neteler
+  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
+*/
+
 #include <grass/dbmi.h>
 
 /*!
-   \fn 
-   \brief 
-   \return 
-   \param 
- */
+  \brief Zero allocated space
+
+  \param s pointer to memory
+  \param n number of bytes
+*/
 void db_zero(void *s, int n)
 {
     char *c = (char *)s;

+ 5 - 5
lib/db/dbmi_client/c_bindupdate.c

@@ -1,5 +1,5 @@
 /*!
- * \file db/dbmi_client/c_bindupdate.c
+ * \file lib/db/dbmi_client/c_bindupdate.c
  * 
  * \brief DBMI Library (client) - bind update
  *
@@ -16,13 +16,13 @@
 #include "macros.h"
 
 /*!
-  \brief ADD
-
+  \brief ?
+  
   \param cursor db cursor
-
+  
   \return DB_OK on success
   \return DB_FAILED on failure
- */
+*/
 int db_bind_update(dbCursor * cursor)
 {
     int ret_code;

Plik diff jest za duży
+ 382 - 435
lib/db/dbmilib.dox


+ 1 - 1
lib/python/ctypes/Makefile

@@ -39,7 +39,7 @@ imagery_HDRS    = imagery.h imagedefs.h
 vector_HDRS     = vector.h vect/dig_structs.h vect/dig_defines.h
 display_HDRS    = display.h
 stats_HDRS      = stats.h
-dbmi_HDRS       = dbmi.h proto_dbmi.h
+dbmi_HDRS       = dbmi.h dbmidefs.h
 g3d_HDRS        = G3d.h
 arraystats_HDRS = arraystats.h
 cluster_HDRS    = cluster.h