|
GRASS 8 Programmer's Manual 8.6.0dev(2026)-1d1e47ad9d
|
DBMI Library (base) - table management. More...

Go to the source code of this file.
Functions | |
| dbTable * | db_alloc_table (int ncols) |
| Allocate a table with a specific number of columns. | |
| void | db_init_table (dbTable *table) |
| Initialize the table to zero. | |
| void | db_free_table (dbTable *table) |
| Free the table. | |
| int | db_set_table_name (dbTable *table, const char *name) |
| Set the name of the table. | |
| const char * | db_get_table_name (dbTable *table) |
| Get the name of the table. | |
| int | db_set_table_description (dbTable *table, const char *description) |
| Set the description of the table. | |
| const char * | db_get_table_description (dbTable *table) |
| Get the description of the table. | |
| int | db_get_table_number_of_columns (dbTable *table) |
| Return the number of columns of the table. | |
| void | db_set_table_select_priv_granted (dbTable *table) |
| Grant selection privileges for all columns. | |
| void | db_set_table_select_priv_not_granted (dbTable *table) |
| Set selection privileges not granted for all columns. | |
| int | db_get_table_select_priv (dbTable *table) |
| Get table select privileges. | |
| void | db_set_table_update_priv_granted (dbTable *table) |
| Grant update privileges for all columns. | |
| void | db_set_table_update_priv_not_granted (dbTable *table) |
| Set update privileges not granted for all columns. | |
| int | db_get_table_update_priv (dbTable *table) |
| Get table update privileges. | |
| void | db_set_table_insert_priv_granted (dbTable *table) |
| Grant insert privileges for table. | |
| void | db_set_table_insert_priv_not_granted (dbTable *table) |
| Set insert privileges not granted for table. | |
| int | db_get_table_insert_priv (dbTable *table) |
| Get table insert privileges. | |
| void | db_set_table_delete_priv_granted (dbTable *table) |
| Grant delete privileges for table. | |
| void | db_set_table_delete_priv_not_granted (dbTable *table) |
| Set delete privileges not granted for table. | |
| int | db_get_table_delete_priv (dbTable *table) |
| Get table delete privileges. | |
| dbColumn * | db_get_table_column (dbTable *table, int idx) |
| Returns column structure for given table and column number. | |
| dbColumn * | db_get_table_column_by_name (dbTable *table, const char *name) |
| Returns column structure for given table and column name. | |
| int | db_set_table_column (dbTable *table, int idx, dbColumn *column) |
| Set a specific column for given table and column number. | |
| int | db_append_table_column (dbTable *table, dbColumn *column) |
| Append a specific column to given table. | |
| dbTable * | db_clone_table (dbTable *src) |
| Make a new exact copy of an existing table. | |
| int | db_table_to_sql (dbTable *table, dbString *sql) |
| Create SQL CREATE string from table definition. | |
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.
Definition in file dbmi_base/table.c.
Allocate a table with a specific number of columns.
| ncols | number of columns which should be allocated |
Definition at line 28 of file dbmi_base/table.c.
References _db_table::columns, db_calloc(), db_free(), db_init_column(), db_init_table(), db_malloc(), NULL, and _db_table::numColumns.
Referenced by db__recv_table_definition(), db_alloc_cursor_table(), db_clone_table(), P_Create_Aux2_Table(), and P_Create_Aux4_Table().
Append a specific column to given table.
| table | Pointer to dbTable |
| column | Pointer to a dbColumn to append. A copy of the column is stored, so the original column can be deleted. |
Definition at line 374 of file dbmi_base/table.c.
References _db_table::columns, db_copy_column(), DB_FAILED, DB_OK, db_realloc(), NULL, and _db_table::numColumns.
Make a new exact copy of an existing table.
New memory is allocated for the clone, the columns-content will be copied too.
| src | Pointer to dbTable |
Definition at line 396 of file dbmi_base/table.c.
References _db_table::columns, db_alloc_table(), db_copy_column(), db_copy_string(), db_get_table_number_of_columns(), _db_table::description, NULL, _db_table::priv_delete, _db_table::priv_insert, and _db_table::tableName.
Free the table.
| table | pointer to dbTable |
Definition at line 68 of file dbmi_base/table.c.
References _db_table::columns, db_free(), db_free_column(), db_free_string(), _db_table::description, _db_table::numColumns, and _db_table::tableName.
Referenced by db_column_sqltype(), db_d_create_table(), db_d_describe_table(), db_free_cursor(), db_get_column(), and Vect_write_ascii().
Returns column structure for given table and column number.
| table | pointer to dbTable |
| idx | column index (starting with '0') |
Definition at line 309 of file dbmi_base/table.c.
References _db_table::columns, NULL, and _db_table::numColumns.
Referenced by db__recv_table_data(), db__send_table_data(), db_column_sqltype(), db_get_column(), db_get_table_column_by_name(), db_print_table_definition(), db_select_CatValArray(), db_select_int(), db_select_value(), db_table_to_sql(), NetA_init_distinct(), NetA_init_timetable_from_db(), P_Aux_to_Vector(), P_Create_Aux2_Table(), P_Create_Aux4_Table(), Vect_get_column_names(), Vect_get_column_names_types(), Vect_get_column_types(), and Vect_write_ascii().
Returns column structure for given table and column name.
| table | pointer to dbTable |
| name | the name of the column |
Definition at line 325 of file dbmi_base/table.c.
References _db_column::columnName, columns, db_get_string(), db_get_table_column(), name, NULL, and _db_table::numColumns.
Get table delete privileges.
| table | pointer to dbTable |
Definition at line 295 of file dbmi_base/table.c.
References _db_table::priv_delete.
Referenced by db_print_table_definition().
Get the description of the table.
| table | pointer to dbTable |
Definition at line 126 of file dbmi_base/table.c.
References db_get_string(), and _db_table::description.
Referenced by db_print_table_definition().
Get table insert privileges.
| table | pointer to dbTable |
Definition at line 263 of file dbmi_base/table.c.
References _db_table::priv_insert.
Referenced by db_print_table_definition().
Get the name of the table.
| table | pointer to dbTable |
Definition at line 101 of file dbmi_base/table.c.
References db_get_string(), and _db_table::tableName.
Referenced by db_print_table_definition(), and db_table_to_sql().
Return the number of columns of the table.
| table | pointer to dbTable |
Definition at line 138 of file dbmi_base/table.c.
References _db_table::numColumns.
Referenced by db_clone_table(), db_column_sqltype(), db_get_column(), db_get_cursor_number_of_columns(), db_print_table_definition(), db_table_to_sql(), Vect_get_column_names(), Vect_get_column_names_types(), Vect_get_column_types(), and Vect_write_ascii().
Get table select privileges.
| table | pointer to dbTable |
Definition at line 199 of file dbmi_base/table.c.
References db_get_column_select_priv().
Get table update privileges.
| table | pointer to dbTable |
Definition at line 231 of file dbmi_base/table.c.
References db_get_column_update_priv().
Initialize the table to zero.
| table | pointer to dbTable |
Definition at line 56 of file dbmi_base/table.c.
References db_init_string(), db_zero(), _db_table::description, and _db_table::tableName.
Referenced by db_alloc_table().
Set a specific column for given table and column number.
| table | Pointer to dbTable |
| idx | Column index (starting with '0'). The index must be in range. |
| column | Pointer to a dbColumn to insert. A copy of the column stored, so the original column can be deleted. |
Definition at line 356 of file dbmi_base/table.c.
References _db_table::columns, db_copy_column(), DB_FAILED, DB_OK, and _db_table::numColumns.
Grant delete privileges for table.
| table | pointer to dbTable |
Definition at line 273 of file dbmi_base/table.c.
References DB_GRANTED, and _db_table::priv_delete.
Set delete privileges not granted for table.
| table | pointer to dbTable |
Definition at line 283 of file dbmi_base/table.c.
References DB_NOT_GRANTED, and _db_table::priv_delete.
Set the description of the table.
| table | pointer to dbTable |
| description | description of the table |
Definition at line 114 of file dbmi_base/table.c.
References db_set_string(), and _db_table::description.
Referenced by P_Create_Aux2_Table(), and P_Create_Aux4_Table().
Grant insert privileges for table.
| table | pointer to dbTable |
Definition at line 241 of file dbmi_base/table.c.
References DB_GRANTED, and _db_table::priv_insert.
Set insert privileges not granted for table.
| table | pointer to dbTable |
Definition at line 251 of file dbmi_base/table.c.
References DB_NOT_GRANTED, and _db_table::priv_insert.
Set the name of the table.
| table | pointer to dbTable |
| name | The name of the table |
Definition at line 89 of file dbmi_base/table.c.
References db_set_string(), name, and _db_table::tableName.
Referenced by db_d_describe_table(), P_Create_Aux2_Table(), and P_Create_Aux4_Table().
Grant selection privileges for all columns.
| table | pointer to dbTable |
Definition at line 177 of file dbmi_base/table.c.
References db_set_column_select_priv_granted().
Set selection privileges not granted for all columns.
| table | pointer to dbTable |
Definition at line 187 of file dbmi_base/table.c.
References db_set_column_select_priv_not_granted().
Grant update privileges for all columns.
| table | pointer to dbTable |
Definition at line 209 of file dbmi_base/table.c.
References db_set_column_update_priv_granted().
Set update privileges not granted for all columns.
| table | pointer to dbTable |
Definition at line 219 of file dbmi_base/table.c.
References db_set_column_update_priv_not_granted().
Create SQL CREATE string from table definition.
| table | pointer to dbTable |
| sql | dbString to store the SQL CREATE string |
Definition at line 428 of file dbmi_base/table.c.
References db_append_string(), DB_FAILED, db_get_column_length(), db_get_column_name(), db_get_column_sqltype(), db_get_string(), db_get_table_column(), db_get_table_name(), db_get_table_number_of_columns(), DB_OK, db_set_string(), DB_SQL_TYPE_CHARACTER, DB_SQL_TYPE_DATE, DB_SQL_TYPE_DECIMAL, DB_SQL_TYPE_DOUBLE_PRECISION, DB_SQL_TYPE_INTEGER, DB_SQL_TYPE_INTERVAL, DB_SQL_TYPE_NUMERIC, DB_SQL_TYPE_REAL, DB_SQL_TYPE_SMALLINT, DB_SQL_TYPE_TEXT, DB_SQL_TYPE_TIME, DB_SQL_TYPE_TIMESTAMP, db_sqltype_name(), G_debug(), and G_warning().