21static int cmp(
const void *
pa,
const void *pb)
60 const char *where,
const char *select,
const char *
selcol,
79 "db_copy_table():\n from driver = %s, db = %s, table = %s\n"
80 " to driver = %s, db = %s, table = %s, where = %s, select = %s",
92 G_warning(
_(
"Array of values to select from column <%s> is empty"),
123 G_debug(3,
"Use the same driver");
135 G_warning(
_(
"Unable to open database <%s> by driver <%s>"),
161 for (i = 0; i <
count; i++) {
192 G_warning(
_(
"Table <%s> already exists in database and will be "
198 G_warning(
_(
"Table <%s> already exists in database <%s>"),
253 G_debug(3,
"Select cursor opened");
257 G_debug(3,
"ncols = %d", ncols);
327 G_debug(3,
"Select cursor opened");
331 G_debug(3,
"ncols = %d", ncols);
int db_copy_table_where(const char *from_drvname, const char *from_dbname, const char *from_tblname, const char *to_drvname, const char *to_dbname, const char *to_tblname, const char *where)
Copy a table (by where statement)
int db_copy_table(const char *from_drvname, const char *from_dbname, const char *from_tblname, const char *to_drvname, const char *to_dbname, const char *to_tblname)
Copy a table.
int db_copy_table_by_ints(const char *from_drvname, const char *from_dbname, const char *from_tblname, const char *to_drvname, const char *to_dbname, const char *to_tblname, const char *selcol, int *ivals, int nvals)
Copy a table (by keys)
int db_copy_table_select(const char *from_drvname, const char *from_dbname, const char *from_tblname, const char *to_drvname, const char *to_dbname, const char *to_tblname, const char *select)
Copy a table (by select statement)
Main header of GRASS DataBase Management Interface.
#define DB_C_TYPE_DATETIME
int db_test_value_isnull(dbValue *)
Check of value is null.
int db_convert_value_to_string(dbValue *, int, dbString *)
Convert value to string.
int db_commit_transaction(dbDriver *)
Commit transaction.
const char * db_get_column_description(dbColumn *)
Returns column description for given column.
int db_get_column_length(dbColumn *)
Get column's length.
dbColumn * db_get_table_column(dbTable *, int)
Returns column structure for given table and column number.
int db_sqltype_to_Ctype(int)
Get C data type based on given SQL data type.
dbValue * db_get_column_value(dbColumn *)
Returns column value for given column structure.
void db_set_column_length(dbColumn *, int)
Set column's length.
int db_get_column_sqltype(dbColumn *)
Returns column sqltype for column.
void db_set_column_sqltype(dbColumn *, int)
Define column sqltype for column.
void db_set_column_precision(dbColumn *, int)
Set column precision.
int db_open_database(dbDriver *, dbHandle *)
Open database connection.
int db_close_database_shutdown_driver(dbDriver *)
Close driver/database connection.
int db_begin_transaction(dbDriver *)
Begin transaction.
dbTable * db_alloc_table(int)
Allocate a table with a specific number of columns.
char * db_get_string(const dbString *)
Get string.
int db_drop_table(dbDriver *, dbString *)
Drop table.
int db_get_connection(dbConnection *)
Get default DB connection settings for the current mapset.
int db_set_column_description(dbColumn *, const char *)
Set column description.
dbTable * db_get_cursor_table(dbCursor *)
Get table allocated by cursor.
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)
const char * db_get_column_name(dbColumn *)
Returns column name for given column.
int db_set_handle(dbHandle *, const char *, const char *)
Set handle (database and schema name)
int db_execute_immediate(dbDriver *, dbString *)
Execute SQL statements.
int db_get_column_scale(dbColumn *)
Get column scale.
int db_list_tables(dbDriver *, dbString **, int *, int)
List available tables for given connection.
dbDriver * db_start_driver(const char *)
Initialize a new dbDriver for db transaction.
void db_double_quote_string(dbString *)
Replace each ' is replaced by ''.
void db_init_handle(dbHandle *)
Initialize handle (i.e database/schema)
void db_init_string(dbString *)
Initialize dbString.
int db_close_cursor(dbCursor *)
Close cursor.
int db_open_select_cursor(dbDriver *, dbString *, dbCursor *, int)
Open select cursor.
const char * db_sqltype_name(int)
Get SQL data type description.
int db_set_column_name(dbColumn *, const char *)
Set column name.
int db_get_column_precision(dbColumn *)
Get column precision.
void db_set_column_scale(dbColumn *, int)
Set column scale.
int db_append_string(dbString *, const char *)
Append string to dbString.
int db_create_table(dbDriver *, dbTable *)
Create table.
int db_fetch(dbCursor *, int, int *)
Fetch data from open cursor.
int db_get_table_number_of_columns(dbTable *)
Return the number of columns of the table.
void G_free(void *)
Free allocated memory.
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
void G_warning(const char *,...) __attribute__((format(printf
int G_get_overwrite(void)
Get overwrite value.
int int G_strcasecmp(const char *, const char *)
String compare ignoring case (upper or lower)
char * G_store(const char *)
Copy string to allocated memory.
int G_debug(int, const char *,...) __attribute__((format(printf