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