GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-57a646b4a4
defs/dbmi.h
Go to the documentation of this file.
1 #ifndef GRASS_DBMIDEFS_H
2 #define GRASS_DBMIDEFS_H
3 
4 void db_Cstring_to_lowercase(char *);
5 void db_Cstring_to_uppercase(char *);
17 int db_append_string(dbString *, const char *);
18 void db_auto_print_errors(int);
21 void *db_calloc(int, int);
31 void db_char_to_lowercase(char *);
32 void db_char_to_uppercase(char *);
33 void db_clear_error(void);
35 void db__close_all_cursors(void);
39 int db_column_sqltype(dbDriver *, const char *, const char *);
40 int db_column_Ctype(dbDriver *, const char *, const char *);
42 int db_convert_Cstring_to_column_value(const char *, dbColumn *);
43 int db_convert_Cstring_to_value(const char *, int, dbValue *);
44 int db_convert_Cstring_to_value_datetime(const char *, int, dbValue *);
51 int db_copy_string(dbString *, const dbString *);
53 int db_copy_table(const char *, const char *, const char *, const char *,
54  const char *, const char *);
55 int db_copy_table_where(const char *, const char *, const char *, const char *,
56  const char *, const char *, const char *);
57 int db_copy_table_select(const char *, const char *, const char *, const char *,
58  const char *, const char *, const char *);
59 int db_copy_table_by_ints(const char *, const char *, const char *,
60  const char *, const char *, const char *,
61  const char *, int *, int);
62 void db_copy_value(dbValue *, dbValue *);
65 int db_create_index2(dbDriver *, const char *, const char *);
67 int db_d_add_column(void);
68 int db_d_bind_update(void);
69 const char *db_dbmscap_filename(void);
70 int db_d_close_cursor(void);
71 int db_d_close_database(void);
72 int db_d_create_database(void);
73 int db_d_create_index(void);
74 int db_d_create_table(void);
75 int db_d_delete(void);
76 int db_d_delete_database(void);
77 int db_d_describe_table(void);
78 int db_d_drop_column(void);
79 int db_d_drop_index(void);
80 int db_d_drop_table(void);
81 void db_debug(const char *);
82 void db_debug_off(void);
83 void db_debug_on(void);
84 int db_delete(dbCursor *);
86 int db_delete_table(const char *, const char *, const char *);
88 int db_d_execute_immediate(void);
89 int db_d_begin_transaction(void);
90 int db_d_commit_transaction(void);
91 int db_d_fetch(void);
92 int db_d_find_database(void);
93 int db_d_get_num_rows(void);
94 int db_d_grant_on_table(void);
95 int db_d_insert(void);
96 void db_d_init_error(const char *);
97 void db_d_append_error(const char *, ...) __attribute__((format(printf, 1, 2)));
98 void db_d_report_error(void);
99 dbDirent *db_dirent(const char *, int *);
100 int db_d_list_databases(void);
101 int db_d_list_indexes(void);
102 int db_d_list_tables(void);
103 int db_d_open_database(void);
104 int db_d_open_insert_cursor(void);
105 int db_d_open_select_cursor(void);
106 int db_d_open_update_cursor(void);
108 int db_driver(int, char **);
109 
110 int db_driver_mkdir(const char *, int, int);
115 void db_drop_token(dbToken);
116 int db_d_update(void);
117 int db_d_version(void);
118 int db_enlarge_string(dbString *, int);
119 void db_error(const char *);
123 int db_fetch(dbCursor *, int, int *);
124 int db_find_database(dbDriver *, dbHandle *, int *);
126 void db_free(void *);
127 void db_free_column(dbColumn *);
128 void db_free_cursor(dbCursor *);
130 void db_free_dbmscap(dbDbmscap *);
131 void db_free_dirent_array(dbDirent *, int);
132 void db_free_handle(dbHandle *);
133 void db_free_handle_array(dbHandle *, int);
134 void db_free_index(dbIndex *);
135 void db_free_index_array(dbIndex *, int);
136 void db_free_string(dbString *);
137 void db_free_string_array(dbString *, int);
138 void db_free_table(dbTable *);
139 int db_get_column(dbDriver *, const char *, const char *, dbColumn **);
141 const char *db_get_column_description(dbColumn *);
144 const char *db_get_column_name(dbColumn *);
155 const char *db_get_default_driver_name(void);
156 const char *db_get_default_database_name(void);
157 const char *db_get_default_schema_name(void);
158 const char *db_get_default_group_name(void);
160 int db_get_error_code(void);
161 const char *db_get_error_msg(void);
162 const char *db_get_error_who(void);
163 const char *db_get_handle_dbname(dbHandle *);
164 const char *db_get_handle_dbschema(dbHandle *);
165 const char *db_get_index_column_name(dbIndex *, int);
166 const char *db_get_index_name(dbIndex *);
168 const char *db_get_index_table_name(dbIndex *);
170 char *db_get_string(const dbString *);
174 const char *db_get_table_description(dbTable *);
176 const char *db_get_table_name(dbTable *);
181 double db_get_value_as_double(dbValue *, int);
183 double db_get_value_double(dbValue *);
188 double db_get_value_seconds(dbValue *);
189 const char *db_get_value_string(dbValue *);
191 int db_grant_on_table(dbDriver *, const char *, int, int);
192 int db_has_dbms(void);
193 void db_init_column(dbColumn *);
194 void db_init_cursor(dbCursor *);
195 void db__init_driver_state(void);
196 void db_init_handle(dbHandle *);
197 void db_init_index(dbIndex *);
198 void db_init_string(dbString *);
199 void db_init_table(dbTable *);
200 int db_insert(dbCursor *);
201 void db_interval_range(int, int *, int *);
202 int db_isdir(const char *);
203 int db_legal_tablename(const char *);
204 int db_list_databases(dbDriver *, dbString *, int, dbHandle **, int *);
205 const char *db_list_drivers(void);
206 int db_list_indexes(dbDriver *, dbString *, dbIndex **, int *);
207 int db_list_tables(dbDriver *, dbString **, int *, int);
208 void *db_malloc(int);
209 void db__mark_database_closed(void);
210 void db__mark_database_open(const char *, const char *);
211 void db_memory_error(void);
213 int db_nocase_compare(const char *, const char *);
214 void db_noproc_error(int);
219  int);
220 void db_print_column_definition(FILE *, dbColumn *);
221 void db_print_error(void);
222 void db_print_index(FILE *, dbIndex *);
223 void db_print_table_definition(FILE *, dbTable *);
224 void db_procedure_not_implemented(const char *);
225 void db_protocol_error(void);
227 void *db_realloc(void *, int);
228 int db__recv_char(char *);
233 int db__recv_double(double *);
234 int db__recv_double_array(double **, int *);
235 int db__recv_float(float *);
236 int db__recv_float_array(float **, int *);
238 int db__recv_index(dbIndex *);
239 int db__recv_index_array(dbIndex **, int *);
240 int db__recv_int(int *);
241 int db__recv_int_array(int **, int *);
242 int db__recv_procnum(int *);
243 int db__recv_return_code(int *);
244 int db__recv_short(short *);
245 int db__recv_short_array(short **, int *);
247 int db__recv_string_array(dbString **, int *);
250 int db__recv_token(dbToken *);
251 int db__recv_value(dbValue *, int);
252 int db__send_Cstring(const char *);
253 int db__send_char(int);
258 int db__send_double(double);
259 int db__send_double_array(const double *, int);
260 int db__send_failure(void);
261 int db__send_float(float);
262 int db__send_float_array(const float *, int);
264 int db__send_index(dbIndex *);
265 int db__send_index_array(dbIndex *, int);
266 int db__send_int(int);
267 int db__send_int_array(const int *, int);
269 int db__send_procedure_ok(int);
270 int db__send_short(int);
271 int db__send_short_array(const short *, int);
273 int db__send_string_array(dbString *, int);
274 int db__send_success(void);
277 int db__send_token(dbToken *);
278 int db__send_value(dbValue *, int);
279 int db_select_CatValArray(dbDriver *, const char *, const char *, const char *,
280  const char *, dbCatValArray *);
281 int db_select_int(dbDriver *, const char *, const char *, const char *, int **);
282 int db_select_value(dbDriver *, const char *, const char *, int, const char *,
283  dbValue *);
284 int db_set_column_description(dbColumn *, const char *);
287 void db_set_column_host_type(dbColumn *, int);
288 void db_set_column_length(dbColumn *, int);
289 int db_set_column_name(dbColumn *, const char *);
291 void db_set_column_precision(dbColumn *, int);
292 void db_set_column_scale(dbColumn *, int);
295 void db_set_column_sqltype(dbColumn *, int);
302 void db_set_cursor_mode(dbCursor *, int);
310 int db_set_default_connection(void);
311 void db_set_error_who(const char *);
312 int db_set_handle(dbHandle *, const char *, const char *);
315 int db_set_index_column_name(dbIndex *, int, const char *);
316 int db_set_index_name(dbIndex *, const char *);
317 int db_set_index_table_name(dbIndex *, const char *);
320 void db__set_protocol_fds(FILE *, FILE *);
321 int db_set_string(dbString *, const char *);
322 int db_set_string_no_copy(dbString *, char *);
323 int db_set_table_column(dbTable *, int, dbColumn *);
326 int db_set_table_description(dbTable *, const char *);
329 int db_set_table_name(dbTable *, const char *);
336 void db_set_value_day(dbValue *, int);
337 void db_set_value_double(dbValue *, double);
338 void db_set_value_hour(dbValue *, int);
339 void db_set_value_int(dbValue *, int);
340 void db_set_value_minute(dbValue *, int);
341 void db_set_value_month(dbValue *, int);
343 void db_set_value_null(dbValue *);
344 void db_set_value_seconds(dbValue *, double);
345 int db_set_value_string(dbValue *, const char *);
346 void db_set_value_year(dbValue *, int);
348 const char *db_sqltype_name(int);
349 int db_sqltype_to_Ctype(int);
350 dbDriver *db_start_driver(const char *);
351 dbDriver *db_start_driver_open_database(const char *, const char *);
352 int db__start_procedure_call(int);
353 char *db_store(const char *);
354 void db_strip(char *);
355 void db_syserror(const char *);
356 int db_table_exists(const char *, const char *, const char *);
371 int db__test_database_open(void);
383 int db_update(dbCursor *);
385 const char *db_whoami(void);
386 void db_zero(void *, int);
387 void db_zero_string(dbString *);
388 unsigned int db_sizeof_string(const dbString *);
389 int db_set_login(const char *, const char *, const char *, const char *,
390  const char *, const char *, int);
391 int db_set_login2(const char *, const char *, const char *, const char *,
392  const char *, const char *, int);
393 int db_get_login(const char *, const char *, const char **, const char **,
394  const char **, const char **);
395 int db_get_login2(const char *, const char *, const char **, const char **,
396  const char **, const char **);
397 int db_get_login_dump(FILE *);
398 
399 #endif
int dbToken
Definition: dbmi.h:145
void * dbAddress
Definition: dbmi.h:144
void db_CatValArray_free(dbCatValArray *)
Free allocated dbCatValArray.
Definition: value.c:373
const char * db_get_error_who(void)
const char * db_sqltype_name(int)
Get SQL data type description.
Definition: sqltype.c:25
void db_copy_value(dbValue *, dbValue *)
Copy value.
Definition: value.c:340
int db_alloc_cursor_table(dbCursor *, int)
Allocate table for cursor.
Definition: cursor.c:38
int db_CatValArray_get_value_int(dbCatValArray *, int, int *)
Find value (integer) by key.
int db__recv_double(double *)
Receive double.
Definition: xdrdouble.c:42
int db_get_column_select_priv(dbColumn *)
Get select privileges.
void db_CatValArray_init(dbCatValArray *)
Initialize dbCatValArray.
Definition: value.c:361
int db__recv_column_value(dbColumn *)
Receive column value.
Definition: xdrcolumn.c:94
int db__recv_int_array(int **, int *)
Receive integer array.
Definition: xdrint.c:92
int db_test_cursor_type_insert(dbCursor *)
Check if cursor type is 'insert'.
Definition: cursor.c:171
int db_column_Ctype(dbDriver *, const char *, const char *)
Get column ctype.
int db_get_value_month(dbValue *)
Get month value.
Definition: value.c:116
void db_set_value_hour(dbValue *, int)
Set hour value.
Definition: value.c:267
void db_set_column_update_priv_not_granted(dbColumn *)
Unset update privileges.
int db_test_value_isnull(dbValue *)
Check of value is null.
Definition: value.c:26
int db_d_bind_update(void)
ADD.
Definition: d_bindupdate.c:25
int db_CatValArray_sort_by_value(dbCatValArray *)
Sort key/value array by value.
int db__send_procedure_ok(int)
?
Definition: xdrprocedure.c:69
void db_unset_cursor_column_flag(dbCursor *, int)
Unset column's flag.
Definition: cursor.c:368
int db__send_int(int)
Send integer.
Definition: xdrint.c:24
int db_alloc_cursor_column_flags(dbCursor *)
Allocate columns' flags for cursor.
Definition: cursor.c:275
int db_get_column(dbDriver *, const char *, const char *, dbColumn **)
Get column structure by table and column name.
int db__send_column_default_value(dbColumn *)
Send column default value.
Definition: xdrcolumn.c:107
int db__recv_short_array(short **, int *)
Receive short array.
Definition: xdrshort.c:94
void db_init_table(dbTable *)
Initialize the table to zero.
void db_set_table_select_priv_not_granted(dbTable *)
Set selection privileges not granted for all columns.
int db_d_find_database(void)
Find database.
Definition: d_finddb.c:26
int db__send_index_array(dbIndex *, int)
Send index array.
Definition: xdrindex.c:50
int db_d_list_indexes(void)
List indexes.
Definition: d_list_idx.c:26
int db_d_begin_transaction(void)
Begin transaction.
Definition: d_execute.c:56
int db_copy_string(dbString *, const dbString *)
Copy dbString.
Definition: string.c:230
const char * db_get_value_string(dbValue *)
Get string value.
Definition: value.c:92
int db__recv_procnum(int *)
? (driver only)
Definition: xdrprocedure.c:52
int db_isdir(const char *)
Test if path is a directory.
Definition: isdir.c:29
int db_list_databases(dbDriver *, dbString *, int, dbHandle **, int *)
List databases.
Definition: c_listdb.c:30
int db_gversion(dbDriver *, dbString *, dbString *)
Get version info.
Definition: c_version.c:31
void db_set_table_delete_priv_not_granted(dbTable *)
Set delete privileges not granted for table.
int db_describe_table(dbDriver *, dbString *, dbTable **)
Describe table.
Definition: c_desc_table.c:28
int db_get_value_day(dbValue *)
Get day value.
Definition: value.c:128
int db_enlarge_string(dbString *, int)
Enlarge dbString.
Definition: string.c:120
int db__send_datetime(dbDateTime *)
Send datetime.
Definition: xdrdatetime.c:25
dbValue * db_get_column_value(dbColumn *)
Returns column value for given column structure.
int db_d_delete_database(void)
Delete database.
Definition: d_deletedb.c:26
int db_list_indexes(dbDriver *, dbString *, dbIndex **, int *)
List indexes.
Definition: c_list_idx.c:29
int db_convert_column_default_value_to_string(dbColumn *, dbString *)
?
Definition: columnfmt.c:80
void db_copy_dbmscap_entry(dbDbmscap *, dbDbmscap *)
Copy dbmscap entry.
Definition: dbmscap.c:79
int db_drop_column(dbDriver *, dbString *, dbString *)
Drop column.
Definition: c_drop_col.c:28
int db_copy_table_select(const char *, const char *, const char *, const char *, const char *, const char *, const char *)
Copy a table (by select statement)
Definition: copy_tab.c:488
int db_d_add_column(void)
Add column to table.
Definition: d_add_col.c:26
int db__recv_index(dbIndex *)
Receive index.
Definition: xdrindex.c:68
int db_CatValArray_realloc(dbCatValArray *, int)
Realloc dbCatValArray.
Definition: value.c:420
dbColumn * db_get_table_column(dbTable *, int)
Returns column structure for given table and column number.
int db_test_cursor_type_fetch(dbCursor *)
Check cursor type.
Definition: cursor.c:144
int db__recv_column_default_value(dbColumn *)
Receive column default value.
Definition: xdrcolumn.c:120
int db_convert_value_to_string(dbValue *, int, dbString *)
Convert value to string.
Definition: valuefmt.c:68
int db_CatValArray_alloc(dbCatValArray *, int)
Allocate dbCatValArray.
Definition: value.c:401
void db_unset_cursor_mode_scroll(dbCursor *)
Unset 'scroll' cursor mode.
Definition: cursor.c:206
void db_set_value_datetime_current(dbValue *)
Set datetime to current.
Definition: value.c:315
int db_set_index_name(dbIndex *, const char *)
Set index name.
int db_commit_transaction(dbDriver *)
Commit transaction.
Definition: c_execute.c:82
int db_get_login2(const char *, const char *, const char **, const char **, const char **, const char **)
Get login parameters for driver/database.
Definition: login.c:360
void db_debug_off(void)
Turn off debugging.
int db__start_procedure_call(int)
? (client only)
Definition: xdrprocedure.c:25
int db_d_update(void)
?
Definition: d_update.c:25
int db_get_column_length(dbColumn *)
Get column's length.
int db_select_value(dbDriver *, const char *, const char *, int, const char *, dbValue *)
Select one (first) value from table/column for key/id.
const char * db_get_index_column_name(dbIndex *, int)
Get column number.
dbColumn * db_copy_column(dbColumn *, dbColumn *)
Copy a db column from source to destination.
void db_d_init_error(const char *)
Init error message for DB driver.
Definition: d_error.c:47
dbToken db_new_token(dbAddress)
Add new token.
int db_copy_table_by_ints(const char *, const char *, const char *, const char *, const char *, const char *, const char *, int *, int)
Copy a table (by keys)
Definition: copy_tab.c:513
dbToken db_get_cursor_token(dbCursor *)
Get cursor token.
Definition: cursor.c:90
double db_get_value_double(dbValue *)
Get double precision value.
Definition: value.c:50
dbDirent * db_dirent(const char *, int *)
Read directory and build an array of dbDirent's.
Definition: dirent.c:49
int db_shutdown_driver(dbDriver *)
Closedown the driver, and free the driver structure.
Definition: shutdown.c:36
void db_print_table_definition(FILE *, dbTable *)
Print table definition info.
Definition: printtab.c:26
const char * db_get_table_name(dbTable *)
Get the name of the table.
int db_d_create_index(void)
Create index.
Definition: d_create_idx.c:26
void db_unset_column_use_default_value(dbColumn *)
Unset default value to be used.
int db_convert_Cstring_to_column_default_value(const char *, dbColumn *)
?
Definition: columnfmt.c:43
void db_set_column_select_priv_not_granted(dbColumn *)
Unset select privileges.
void db_set_table_insert_priv_granted(dbTable *)
Grant insert privileges for table.
int db_d_list_databases(void)
List databases.
Definition: d_listdb.c:26
void db_Cstring_to_lowercase(char *)
Convert string to lowercase.
Definition: case.c:44
const char * db_whoami(void)
Who am i?
int db_set_value_string(dbValue *, const char *)
Set string value.
Definition: value.c:219
int db__send_token(dbToken *)
Send token.
Definition: xdrtoken.c:24
int db_sqltype_to_Ctype(int)
Get C data type based on given SQL data type.
Definition: sqlCtype.c:24
void db_init_cursor(dbCursor *)
Initialize dbCursor.
Definition: cursor.c:23
dbDriver * db_start_driver(const char *)
Initialize a new dbDriver for db transaction.
Definition: start.c:51
int db_open_update_cursor(dbDriver *, dbString *_name, dbString *, dbCursor *, int)
Open update cursor.
Definition: c_openupdate.c:30
void db_set_column_length(dbColumn *, int)
Set column's length.
void db_print_error(void)
Print error.
void * db_calloc(int, int)
Allocate memory.
int db_set_login(const char *, const char *, const char *, const char *, const char *, const char *, int)
Set login parameters for driver/database.
Definition: login.c:289
int db_table_to_sql(dbTable *, dbString *)
Create SQL CREATE string from table definition.
void db_set_value_year(dbValue *, int)
Set year value.
Definition: value.c:231
dbIndex * db_alloc_index_array(int)
Allocate index array.
void db_init_index(dbIndex *)
Initialize dbIndex.
void db_free_index_array(dbIndex *, int)
Free index array.
void db_unset_column_has_default_value(dbColumn *)
Unset default value identificator.
int db_get_column_sqltype(dbColumn *)
Returns column sqltype for column.
dbDriver * db_start_driver_open_database(const char *, const char *)
Open driver/database connection.
Definition: db.c:28
int db__send_string_array(dbString *, int)
Send string array.
Definition: xdrstring.c:26
double db_get_value_seconds(dbValue *)
Get seconds value.
Definition: value.c:164
void db_set_error_who(const char *)
Set 'who' for error messages.
void db_set_column_sqltype(dbColumn *, int)
Define column sqltype for column.
int db_test_column_null_allowed(dbColumn *)
Checks if null value is allowed.
int db_test_column_has_defined_default_value(dbColumn *)
Check if column has defined default value.
int db_convert_value_datetime_into_string(dbValue *, int, dbString *)
Convert datetime value into string.
Definition: datetime.c:31
int db_get_index_number_of_columns(dbIndex *)
Get number of columns.
void db_set_cursor_type_readonly(dbCursor *)
Set cursor to be read-only (select)
Definition: cursor.c:111
void db_set_cursor_type_insert(dbCursor *)
Set cursor to be writable (insert)
Definition: cursor.c:131
void db_unset_cursor_mode_insensitive(dbCursor *)
Unset 'intensive' cursor mode.
Definition: cursor.c:236
void db_free_table(dbTable *)
Free the table.
void db_debug_on(void)
Turn on debugging.
int db_get_num_rows(dbCursor *)
Get number of selected rows.
Definition: c_rows.c:26
unsigned int db_sizeof_string(const dbString *)
Get string size.
Definition: string.c:67
int db__recv_table_data(dbTable *)
Receive table data.
Definition: xdrtable.c:101
int db__recv_index_array(dbIndex **, int *)
Receive index array.
Definition: xdrindex.c:95
int db_d_version(void)
Get version info.
Definition: d_version.c:24
int db__recv_int(int *)
Receive integer.
Definition: xdrint.c:44
void db_set_column_precision(dbColumn *, int)
Set column precision.
void db_noproc_error(int)
Report no procedure error.
int db_delete_table(const char *, const char *, const char *)
Delete table.
Definition: delete_tab.c:29
dbAddress db_find_token(dbToken)
Find token.
int db_delete_database(dbDriver *, dbHandle *)
Delete database.
Definition: c_deletedb.c:27
void db_unset_cursor_mode(dbCursor *)
Unset cursor mode.
Definition: cursor.c:216
int db__send_index(dbIndex *)
Send index.
Definition: xdrindex.c:25
int db_open_database(dbDriver *, dbHandle *)
Open database connection.
Definition: c_opendb.c:27
int db_d_drop_column(void)
Drop column.
Definition: d_drop_col.c:26
int db_set_index_table_name(dbIndex *, const char *)
Set table name.
int db_d_list_tables(void)
List available tables for given connection.
Definition: d_list_tabs.c:25
void db_clear_error(void)
Clear error status.
dbTable * db_get_cursor_table(dbCursor *)
Get table allocated by cursor.
Definition: cursor.c:67
int db_get_value_year(dbValue *)
Get year value.
Definition: value.c:104
int db_set_table_description(dbTable *, const char *)
Set the description of the table.
void db_CatValArray_sort(dbCatValArray *)
Sort key/value array by key.
void db_procedure_not_implemented(const char *)
Report 'not implemented' error.
int db__send_table_definition(dbTable *)
Send table definition.
Definition: xdrtable.c:26
int db__recv_string(dbString *)
Reads a string from transport.
Definition: xdrstring.c:117
int db__recv_short(short *)
Receive short.
Definition: xdrshort.c:46
int db_d_create_table(void)
Create table.
Definition: d_create_tab.c:26
int db_copy_table_where(const char *, const char *, const char *, const char *, const char *, const char *, const char *)
Copy a table (by where statement)
Definition: copy_tab.c:465
int db_convert_Cstring_to_value(const char *, int, dbValue *)
Convert string to value.
Definition: valuefmt.c:31
void db_set_value_double(dbValue *, double)
Set double precision value.
Definition: value.c:207
int db__send_success(void)
Send success code.
Definition: ret_codes.c:26
void db_set_column_null_allowed(dbColumn *)
Set null value to be allowed.
int db__send_Cstring(const char *)
Send C string.
Definition: xdrstring.c:150
const char * db_list_drivers(void)
Return comma separated list of existing DB drivers, used for driver parameter options.
void db_zero_string(dbString *)
Zero string.
Definition: string.c:79
int db_close_database_shutdown_driver(dbDriver *)
Close driver/database connection.
Definition: db.c:61
void db__close_all_cursors(void)
Close all cursors.
Definition: driver_state.c:120
dbDriverState * db__get_driver_state(void)
Get driver state.
Definition: driver_state.c:34
int db_begin_transaction(dbDriver *)
Begin transaction.
Definition: c_execute.c:56
void db_free_string_array(dbString *, int)
Free allocated dbString array.
Definition: string.c:163
void db_strip(char *)
Strip given string.
Definition: strip.c:25
int db__test_database_open(void)
Test database connection.
Definition: driver_state.c:45
int db__send_short(int)
Send short.
Definition: xdrshort.c:25
void db_free_string(dbString *)
Free allocated space for dbString.
Definition: string.c:150
const char * db_get_handle_dbname(dbHandle *)
Get handle database name.
Definition: handle.c:57
int db_add_column(dbDriver *, dbString *, dbColumn *)
Add column to table.
Definition: c_add_col.c:28
int db_d_drop_table(void)
Drop table.
Definition: d_drop_tab.c:26
int db_convert_Cstring_to_value_datetime(const char *, int, dbValue *)
Convert datetime string to value.
Definition: datetime.c:196
int db_set_table_column(dbTable *, int, dbColumn *)
Set a specific column for given table and column number.
int db_open_insert_cursor(dbDriver *, dbCursor *)
Open insert cursor.
Definition: c_openinsert.c:27
int db_CatValArray_get_value(dbCatValArray *, int, dbCatVal **)
Find value by key.
int db__send_failure(void)
Send failure code.
Definition: ret_codes.c:37
int db__send_float(float)
Send float.
Definition: xdrfloat.c:24
int db_d_describe_table(void)
Describe table.
Definition: d_desc_table.c:26
int db_set_login2(const char *, const char *, const char *, const char *, const char *, const char *, int)
Set login parameters for driver/database.
Definition: login.c:267
int db__recv_string_array(dbString **, int *)
Receive string array.
Definition: xdrstring.c:46
int db_test_cursor_mode_insensitive(dbCursor *)
Check if cursor mode is 'intensive'.
Definition: cursor.c:262
void db_print_column_definition(FILE *, dbColumn *)
Print column definition info.
Definition: printtab.c:51
double db_get_value_as_double(dbValue *, int)
Get value as double.
Definition: value.c:65
dbTable * db_clone_table(dbTable *)
Make a new exact copy of an existing table.
int db_d_open_database(void)
Open database connection.
Definition: d_opendb.c:26
int db_drop_table(dbDriver *, dbString *)
Drop table.
Definition: c_drop_tab.c:28
int db_get_table_insert_priv(dbTable *)
Get table insert privileges.
int db_delete(dbCursor *)
Delete record (?)
Definition: c_delete.c:26
int db_test_cursor_column_flag(dbCursor *, int)
Checks column's flag.
Definition: cursor.c:383
void db_set_cursor_type_update(dbCursor *)
Set cursor to be writable (update)
Definition: cursor.c:121
const char * db_dbmscap_filename(void)
Get dbmscap file name.
Definition: dbmscap.c:57
int db_get_error_code(void)
Get error code.
void db_set_column_has_undefined_default_value(dbColumn *)
Unset default value identificator.
int db_create_index2(dbDriver *, const char *, const char *)
Create unique index.
Definition: c_create_idx.c:61
dbHandle * db_alloc_handle_array(int)
Allocate array of handles.
Definition: handle.c:109
int db_get_table_delete_priv(dbTable *)
Get table delete privileges.
void db_unset_cursor_column_for_update(dbCursor *, int)
Unset 'update' column flag.
Definition: cursor.c:318
int db__send_procedure_not_implemented(int)
?
Definition: xdrprocedure.c:81
dbDirent * db_alloc_dirent_array(int)
Allocate dirent array.
Definition: dirent.c:163
void db_free_cursor(dbCursor *)
Free allocated dbCursor.
Definition: cursor.c:51
int db__send_value(dbValue *, int)
Send value.
Definition: xdrvalue.c:28
int db_get_connection(dbConnection *)
Get default DB connection settings for the current mapset.
int db_d_open_update_cursor(void)
Open update cursor.
Definition: d_openupdate.c:26
void db__mark_database_open(const char *, const char *)
Mark database as opened.
Definition: driver_state.c:56
int db_set_column_description(dbColumn *, const char *)
Set column description.
void db_set_value_int(dbValue *, int)
Set integer value.
Definition: value.c:195
int db_set_index_column_name(dbIndex *, int, const char *)
Set column name.
void db_set_column_select_priv_granted(dbColumn *)
Set select privileges to be granted.
int db_append_table_column(dbTable *, dbColumn *)
Append a specific column to given table.
void db_set_value_datetime_not_current(dbValue *)
Set value to non-current.
Definition: value.c:326
int db_grant_on_table(dbDriver *, const char *, int, int)
Grant privileges on table.
Definition: c_priv.c:29
const char * db_get_index_table_name(dbIndex *)
Get table name.
void db_free_cursor_column_flags(dbCursor *)
Free columns' flags of cursor.
Definition: cursor.c:294
int db__send_double(double)
Send double.
Definition: xdrdouble.c:24
int db_select_int(dbDriver *, const char *, const char *, const char *, int **)
Select array of ordered integers from table/column.
int db_test_column_has_undefined_default_value(dbColumn *)
Check if column has defined default value.
int db_d_grant_on_table(void)
Grant privileges on table.
Definition: d_priv.c:26
void db_auto_print_protocol_errors(int)
Set auto print protocol error.
int db_get_login(const char *, const char *, const char **, const char **, const char **, const char **)
Get login parameters for driver/database.
Definition: login.c:381
int db_test_cursor_any_column_flag(dbCursor *)
Checks columns' flag.
Definition: cursor.c:413
void db_set_column_update_priv_granted(dbColumn *)
Set update privileges to be granted.
int db_select_CatValArray(dbDriver *, const char *, const char *, const char *, const char *, dbCatValArray *)
Select pairs key/value to array, values are sorted by key (must be integer)
void db_set_cursor_token(dbCursor *, dbToken)
Set cursor token.
Definition: cursor.c:101
void db_set_cursor_column_flag(dbCursor *, int)
Set column's flag.
Definition: cursor.c:356
int db_d_create_database(void)
Create database.
Definition: d_createdb.c:26
void db_set_table_select_priv_granted(dbTable *)
Grant selection privileges for all columns.
void db_set_column_host_type(dbColumn *, int)
Set column host data type.
int db_set_table_name(dbTable *, const char *)
Set the name of the table.
int db_set_string(dbString *, const char *)
Inserts string to dbString (enlarge string)
Definition: string.c:41
void db_free_handle_array(dbHandle *, int)
Free array of handles.
Definition: handle.c:91
int db__send_double_array(const double *, int)
Send double array.
Definition: xdrdouble.c:63
void db_set_table_update_priv_not_granted(dbTable *)
Set update privileges not granted for all columns.
int db_test_cursor_any_column_for_update(dbCursor *)
Check if columns' flag is 'update'.
Definition: cursor.c:345
void db_set_value_minute(dbValue *, int)
Set minute value.
Definition: value.c:279
void db_init_column(dbColumn *)
Initialize dbColumn.
void db_unset_column_null_allowed(dbColumn *)
Unset null value to be allowed.
void db_set_value_seconds(dbValue *, double)
Set seconds value.
Definition: value.c:291
int db_create_index(dbDriver *, dbIndex *)
Create index.
Definition: c_create_idx.c:28
const char * db_get_error_msg(void)
Get error message.
void db_set_table_delete_priv_granted(dbTable *)
Grant delete privileges for table.
int db__recv_double_array(double **, int *)
Receive double array.
Definition: xdrdouble.c:90
void db_free_dirent_array(dbDirent *, int)
Free dbDirent.
Definition: dirent.c:114
int db_d_fetch(void)
Fetch data.
Definition: d_fetch.c:27
int db_set_handle(dbHandle *, const char *, const char *)
Set handle (database and schema name)
Definition: handle.c:39
int db_execute_immediate(dbDriver *, dbString *)
Execute SQL statements.
Definition: c_execute.c:27
void db_set_cursor_mode_scroll(dbCursor *)
Set 'scroll' cursor mode.
Definition: cursor.c:196
void db_set_table_update_priv_granted(dbTable *)
Grant update privileges for all columns.
void db_debug(const char *)
Print debug message.
int db__send_char(int)
?
Definition: xdrchar.c:24
void db_free(void *)
Free allocated memory.
const char * db_get_handle_dbschema(dbHandle *)
Get handle schema name.
Definition: handle.c:69
void db_char_to_uppercase(char *)
Convert character to uppercase.
Definition: case.c:33
dbTable * db_alloc_table(int)
Allocate a table with a specific number of columns.
int db__send_float_array(const float *, int)
Send float array.
Definition: xdrfloat.c:65
void db_set_table_insert_priv_not_granted(dbTable *)
Set insert privileges not granted for table.
int db_close_database(dbDriver *)
Close database connection.
Definition: c_closedb.c:26
int db_get_value_int(dbValue *)
Get integer value.
Definition: value.c:38
void db__init_driver_state(void)
Initialize driver state.
Definition: driver_state.c:24
int db_legal_tablename(const char *)
Check if output is legal table name.
Definition: legal_dbname.c:31
int db_convert_Cstring_to_column_value(const char *, dbColumn *)
?
Definition: columnfmt.c:25
void db_drop_token(dbToken)
Drop token.
int db_test_column_use_default_value(dbColumn *)
Checks if default value is used.
int db_get_login_dump(FILE *)
Print all connection settings to file.
Definition: login.c:395
int db_set_string_no_copy(dbString *, char *)
Inserts string to dbString (overwrite current value)
Definition: string.c:55
void db__set_protocol_fds(FILE *, FILE *)
?
int db_table_exists(const char *, const char *, const char *)
Check if table exists.
int db_get_column_scale(dbColumn *)
Get column scale.
void db_free_column(dbColumn *)
Frees column structure.
int db_get_value_hour(dbValue *)
Get hour value.
Definition: value.c:140
int db_has_dbms(void)
Check dbms.
Definition: dbmscap.c:68
void db_zero(void *, int)
Zero allocated space.
int db_list_tables(dbDriver *, dbString **, int *, int)
List available tables for given connection.
Definition: c_list_tabs.c:39
void db_double_quote_string(dbString *)
Replace each ' is replaced by ''.
Definition: string.c:240
int db_d_open_select_cursor(void)
Open select cursor.
Definition: d_openselect.c:26
void db_init_handle(dbHandle *)
Initialize handle (i.e database/schema)
Definition: handle.c:23
int db_set_connection(dbConnection *)
Set default DB connection settings.
void db_free_handle(dbHandle *)
Free dbHandle structure.
Definition: handle.c:79
int db__send_int_array(const int *, int)
Send integer array.
Definition: xdrint.c:65
void db_set_cursor_mode_insensitive(dbCursor *)
Set 'intensive' cursor mode.
Definition: cursor.c:226
int db_get_cursor_number_of_columns(dbCursor *)
Get number of columns.
Definition: cursor.c:393
void db__mark_database_closed(void)
Mark database as closed.
Definition: driver_state.c:66
int db_d_close_database(void)
Close database connection.
Definition: d_closedb.c:25
int db_d_drop_index(void)
Drop index.
Definition: d_drop_index.c:26
int db_d_delete(void)
Delete record (?)
Definition: d_delete.c:25
void db_init_string(dbString *)
Initialize dbString.
Definition: string.c:25
int db__send_handle(dbHandle *)
Send handle.
Definition: xdrhandle.c:25
int db_close_cursor(dbCursor *)
Close cursor.
Definition: c_close_cur.c:27
int db_set_default_connection(void)
Sets up database connection settings using GRASS default from dbmi.h.
int db_bind_update(dbCursor *)
?
Definition: c_bindupdate.c:26
void db_d_append_error(const char *,...) __attribute__((format(printf
void db_error(const char *)
Report error message.
int db__send_string(dbString *)
Send string.
Definition: xdrstring.c:86
void db__add_cursor_to_driver_state(dbCursor *)
Add cursor do driver state.
Definition: driver_state.c:78
void void db_d_report_error(void)
Report error message for DB driver.
Definition: d_error.c:94
int db_open_select_cursor(dbDriver *, dbString *, dbCursor *, int)
Open select cursor.
Definition: c_openselect.c:37
int db_set_column_name(dbColumn *, const char *)
Set column name.
int db_set_index_type_non_unique(dbIndex *)
Set index type to non-unique.
int db_get_column_precision(dbColumn *)
Get column precision.
int db_test_cursor_type_update(dbCursor *)
Check if cursor type is 'update'.
Definition: cursor.c:158
int db_d_execute_immediate(void)
Execute SQL statements.
Definition: d_execute.c:26
int db_d_open_insert_cursor(void)
Open insert cursor.
Definition: d_openinsert.c:25
int db_test_cursor_column_for_update(dbCursor *, int)
Check if column flag is 'update'.
Definition: cursor.c:332
int db__recv_column_definition(dbColumn *)
Receive column definition.
Definition: xdrcolumn.c:53
void db_set_cursor_column_for_update(dbCursor *, int)
Set Column flag to 'update'.
Definition: cursor.c:307
void db_syserror(const char *)
Report system error.
int db__send_short_array(const short *, int)
Send short array.
Definition: xdrshort.c:67
char * db_store(const char *)
Make a copy of string buffer.
int db_test_cursor_mode_scroll(dbCursor *)
Check if cursor mode is 'scroll'.
Definition: cursor.c:249
dbColumn * db_get_table_column_by_name(dbTable *, const char *)
Returns column structure for given table and column name.
int db_update(dbCursor *)
?
Definition: c_update.c:26
int db_test_column_has_default_value(dbColumn *)
Check if column has defined default value.
int db_get_table_number_of_rows(dbDriver *, dbString *)
Get number of rows of table.
void db_set_column_scale(dbColumn *, int)
Set column scale.
void db_set_value_not_null(dbValue *)
Set value to not null.
Definition: value.c:184
const char * db_get_default_database_name(void)
Get database name from current DB connection settings.
void db_set_cursor_table(dbCursor *, dbTable *)
Set table for given cursor.
Definition: cursor.c:78
void db_char_to_lowercase(char *)
Convert character to lowercase.
Definition: case.c:22
int db_copy_table(const char *, const char *, const char *, const char *, const char *, const char *)
Copy a table.
Definition: copy_tab.c:443
int db_d_commit_transaction(void)
Commit transaction.
Definition: d_execute.c:80
const char * db_get_column_name(dbColumn *)
Returns column name for given column.
dbString * db_alloc_string_array(int)
Allocate dbString array.
Definition: string.c:181
int db_get_value_minute(dbValue *)
Get minute value.
Definition: value.c:152
void db_set_column_use_default_value(dbColumn *)
Set default value to be used.
void db_set_error_handler_driver(dbDriver *)
Define standard error handler for open database connection.
const char * db_get_default_group_name(void)
Get group name from current DB connection settings.
int db_append_string(dbString *, const char *)
Append string to dbString.
Definition: string.c:205
int db_drop_index(dbDriver *, dbString *)
Drop index.
Definition: c_drop_index.c:27
void db_set_column_has_defined_default_value(dbColumn *)
Set default value identificator.
int db_nocase_compare(const char *, const char *)
Compare strings case-insensitive.
Definition: case.c:69
void db_protocol_error(void)
Report protocol error.
int db_get_table_select_priv(dbTable *)
Get table select privileges.
void db__drop_cursor_from_driver_state(dbCursor *)
Drop cursor from driver state.
Definition: driver_state.c:108
dbValue * db_get_column_default_value(dbColumn *)
Returns column default value for given column structure.
const char * db_get_table_description(dbTable *)
Get the description of the table.
void db_free_dbmscap(dbDbmscap *)
Free dbmscap.
Definition: dbmscap.c:262
int db_get_column_update_priv(dbColumn *)
Get update privileges.
void db_print_index(FILE *, dbIndex *)
Report index.
void db_free_index(dbIndex *)
Free allocated dbIndex.
int db__recv_token(dbToken *)
Receive token.
Definition: xdrtoken.c:36
int db_get_column_host_type(dbColumn *)
Get column host type.
int db_get_table_update_priv(dbTable *)
Get table update privileges.
int db_column_sqltype(dbDriver *, const char *, const char *)
Get column sqltype.
int db_convert_column_value_to_string(dbColumn *, dbString *)
?
Definition: columnfmt.c:62
int db__send_column_definition(dbColumn *)
Send column definition.
Definition: xdrcolumn.c:25
int db__recv_float(float *)
Receive float.
Definition: xdrfloat.c:44
int db_set_index_type_unique(dbIndex *)
Set index type to unique.
int db_create_database(dbDriver *, dbHandle *)
Create database.
Definition: c_createdb.c:27
int db_d_close_cursor(void)
Close cursor.
Definition: d_close_cur.c:26
const char * db_get_default_driver_name(void)
Get driver name from current DB connection settings.
int db_test_index_type_unique(dbIndex *)
Test if type is unique.
int db_test_value_datetime_current(dbValue *)
Check if datatime is current.
Definition: value.c:305
const char * db_get_index_name(dbIndex *)
Get index name.
dbDbmscap * db_read_dbmscap(void)
Read dbmscap.
Definition: dbmscap.c:98
int db__recv_float_array(float **, int *)
Receive float array.
Definition: xdrfloat.c:92
char * db_get_string(const dbString *)
Get string.
Definition: string.c:140
int db_create_table(dbDriver *, dbTable *)
Create table.
Definition: c_create_tab.c:27
void db_set_value_day(dbValue *, int)
Set day value.
Definition: value.c:255
void * db_realloc(void *, int)
Reallocate memory.
int db__recv_handle(dbHandle *)
Receive handle.
Definition: xdrhandle.c:40
int db_insert(dbCursor *)
Insert new record into table.
Definition: c_insert.c:26
int db__recv_char(char *)
?
Definition: xdrchar.c:45
void * db_malloc(int)
Allocate memory.
void db_set_value_null(dbValue *)
Set value to null.
Definition: value.c:174
int db__recv_return_code(int *)
Receive return code.
Definition: ret_codes.c:51
int db__recv_datetime(dbDateTime *)
Receive datetime.
Definition: xdrdatetime.c:47
int db_alloc_index_columns(dbIndex *, int)
Allocate index columns.
int db_fetch(dbCursor *, int, int *)
Fetch data from open cursor.
Definition: c_fetch.c:28
int db_d_get_num_rows(void)
Get number of selected rows.
Definition: d_rows.c:25
const char * db_get_default_schema_name(void)
Get schema name from current DB connection settings.
void db_unset_error_handler_driver(dbDriver *)
Remove error handler before closing the driver.
void db_memory_error(void)
Report memory error.
int db__send_column_value(dbColumn *)
Send column value.
Definition: xdrcolumn.c:81
const char * db_get_column_description(dbColumn *)
Returns column description for given column.
int db_d_insert(void)
Insert new record into table.
Definition: d_insert.c:25
void db_set_value_month(dbValue *, int)
Set month value.
Definition: value.c:243
void db_auto_print_errors(int)
Toggles printing of DBMI error messages.
int db_get_table_number_of_columns(dbTable *)
Return the number of columns of the table.
int db__recv_value(dbValue *, int)
Receive value.
Definition: xdrvalue.c:62
int db_driver(int, char **)
void db_Cstring_to_uppercase(char *)
Convert string to lowercase.
Definition: case.c:55
int db_find_database(dbDriver *, dbHandle *, int *)
Find database.
Definition: c_finddb.c:29
void db_interval_range(int, int *, int *)
Define range based on SQL data type.
Definition: interval.c:24
int db__send_table_data(dbTable *)
Send table data.
Definition: xdrtable.c:81
int db_driver_mkdir(const char *, int, int)
Create db directory.
Definition: d_mkdir.c:36
int db_CatValArray_get_value_double(dbCatValArray *, int, double *)
Find value (double) by key.
void db_set_cursor_mode(dbCursor *, int)
Set cursor mode.
Definition: cursor.c:186
int db__recv_table_definition(dbTable **)
Receive table definition.
Definition: xdrtable.c:51
#define __attribute__(x)
Definition: gis.h:36
Definition: dbmi.h:152
Definition: dbmi.h:253