24 #include <sys/types.h>
26 #include <grass/glocale.h>
27 #include <grass/gis.h>
28 #include <grass/Vect.h>
29 #include <grass/dbmi.h>
42 int num_dblinks, ncols, col;
43 struct field_info *fi;
48 char buf[2000], temp_buf[2000];
56 "Displaying column names for database connection of layer %d:",
74 for (col = 0; col < ncols; col++) {
81 strcat(buf, temp_buf);
103 int num_dblinks, ncols, col;
104 struct field_info *fi;
109 char buf[2000], temp_buf[2000];
113 if (num_dblinks <= 0)
117 "Displaying column types for database connection of layer %d:",
135 for (col = 0; col < ncols; col++) {
144 strcat(buf, temp_buf);
167 int num_dblinks, ncols, col;
168 struct field_info *fi;
173 char buf[2000], temp_buf[2000];
177 if (num_dblinks <= 0)
181 "Displaying column types for database connection of layer %d:",
199 for (col = 0; col < ncols; col++) {
210 strcat(buf, temp_buf);
dbColumn * db_get_table_column(dbTable *table, int n)
returns column structure for given table and column number
sprintf(buf2,"%s", G3D_CATS_ELEMENT)
const char * db_sqltype_name(int sqltype)
returns sqltype description
struct field_info * Vect_get_field(struct Map_info *Map, int field)
Get information about link to database.
char * G_store(const char *s)
Copy string to allocated memory.
const char * db_get_column_name(dbColumn *column)
returns column name for given column
int db_describe_table(dbDriver *driver, dbString *name, dbTable **table)
Describe table.
int db_shutdown_driver(dbDriver *driver)
Closedown the driver, and free the driver structure.
int db_close_database(dbDriver *driver)
Close database connection.
char * G_chop(char *line)
Chop leading and trailing white spaces:
const char * Vect_get_column_names_types(struct Map_info *Map, int field)
Fetches list of DB column names and types of vector map attribute table.
int db_get_column_sqltype(dbColumn *column)
returns column sqltype for column (the function db_sqltype_name() returns sqltype description) ...
int db_get_table_number_of_columns(dbTable *table)
int Vect_get_num_dblinks(struct Map_info *map)
Get number of defined dblinks.
int db_set_handle(dbHandle *handle, const char *dbName, const char *dbSchema)
char buf[GNAME_MAX+sizeof(G3D_DIRECTORY)+2]
int G_debug(int level, const char *msg,...)
Print debugging message.
void db_init_handle(dbHandle *handle)
const char * Vect_get_column_names(struct Map_info *Map, int field)
Fetches list of DB column names of vector map attribute table.
int db_set_string(dbString *x, const char *s)
int db_open_database(dbDriver *driver, dbHandle *handle)
Open database connection.
const char * Vect_get_column_types(struct Map_info *Map, int field)
Fetches list of DB column types of vector map attribute table.
dbDriver * db_start_driver(const char *name)
Initialize a new dbDriver for db transaction.
void db_init_string(dbString *x)