20 #include <sys/types.h>
39 int num_dblinks, ncols, col;
45 const char **col_names;
52 G_debug(3,
"Displaying column names for database connection of layer %d:",
69 col_names =
G_malloc(ncols *
sizeof(
char *));
70 for (col = 0; col < ncols; col++)
94 int num_dblinks, ncols, col;
100 const char **sqltype_names;
104 if (num_dblinks <= 0)
107 G_debug(3,
"Displaying column types for database connection of layer %d:",
124 sqltype_names =
G_malloc(ncols *
sizeof(
char *));
125 for (col = 0; col < ncols; col++)
151 int num_dblinks, ncols, col;
157 const char **col_type_names;
161 if (num_dblinks <= 0)
164 G_debug(3,
"Displaying column types for database connection of layer %d:",
181 col_type_names =
G_malloc(ncols *
sizeof(
char *));
182 for (col = 0; col < ncols; col++) {
185 sprintf(buf,
"%s(%s)",
189 col_type_names[col] = buf;
const char * Vect_get_column_names(struct Map_info *Map, int field)
Fetches list of DB column names of vector map attribute table.
const char * Vect_get_column_types(struct Map_info *Map, int field)
Fetches list of DB column types of vector map attribute table.
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.
const char * db_sqltype_name(int)
Get SQL data type description.
int db_describe_table(dbDriver *, dbString *, dbTable **)
Describe table.
dbColumn * db_get_table_column(dbTable *, int)
Returns column structure for given table and column number.
int db_shutdown_driver(dbDriver *)
Closedown the driver, and free the driver structure.
dbDriver * db_start_driver(const char *)
Initialize a new dbDriver for db transaction.
int db_get_column_sqltype(dbColumn *)
Returns column sqltype for column.
int db_open_database(dbDriver *, dbHandle *)
Open database connection.
int db_set_string(dbString *, const char *)
Inserts string to dbString (enlarge string)
int db_set_handle(dbHandle *, const char *, const char *)
Set handle (database and schema name)
int db_close_database(dbDriver *)
Close database connection.
void db_init_handle(dbHandle *)
Initialize handle (i.e database/schema)
void db_init_string(dbString *)
Initialize dbString.
const char * db_get_column_name(dbColumn *)
Returns column name for given column.
int db_get_table_number_of_columns(dbTable *)
Return the number of columns of the table.
void G_free(void *)
Free allocated memory.
char * G_str_concat(const char **, int, const char *, int)
String concatenation.
int G_debug(int, const char *,...) __attribute__((format(printf
char * G_store(const char *)
Copy string to allocated memory.
int Vect_get_num_dblinks(struct Map_info *)
Get number of defined dblinks.
struct field_info * Vect_get_field(struct Map_info *, int)
Get information about link to database (by layer number)
Layer (old: field) information.
char * table
Name of DB table.
char * driver
Name of DB driver ('sqlite', 'dbf', ...)