From 3c315f0fff93aa072472abc10815963ac0035268 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 12 Aug 2022 09:26:11 +0200 Subject: Adding upstream version 1.36.0. Signed-off-by: Daniel Baumann --- database/sqlite/sqlite_functions.h | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'database/sqlite/sqlite_functions.h') diff --git a/database/sqlite/sqlite_functions.h b/database/sqlite/sqlite_functions.h index d24484774..e6808aa81 100644 --- a/database/sqlite/sqlite_functions.h +++ b/database/sqlite/sqlite_functions.h @@ -27,7 +27,8 @@ typedef enum db_check_action_type { #define SQL_MAX_RETRY (100) #define SQLITE_INSERT_DELAY (50) // Insert delay in case of lock -#define SQL_STORE_HOST "insert or replace into host (host_id,hostname,registry_hostname,update_every,os,timezone,tags) values (?1,?2,?3,?4,?5,?6,?7);" +#define SQL_STORE_HOST "insert or replace into host (host_id,hostname,registry_hostname,update_every,os,timezone,tags, hops) " \ + "values (?1,?2,?3,?4,?5,?6,?7,?8);" #define SQL_STORE_CHART "insert or replace into chart (chart_id, host_id, type, id, " \ "name, family, context, title, unit, plugin, module, priority, update_every , chart_type , memory_mode , " \ @@ -37,7 +38,7 @@ typedef enum db_check_action_type { "select chart_id from chart where host_id = @host and type=@type and id=@id and (name is null or name=@name);" #define SQL_STORE_ACTIVE_CHART \ - "insert or replace into chart_active (chart_id, date_created) values (@id, strftime('%s'));" + "insert or replace into chart_active (chart_id, date_created) values (@id, unixepoch());" #define SQL_STORE_DIMENSION \ "INSERT OR REPLACE into dimension (dim_id, chart_id, id, name, multiplier, divisor , algorithm) values (?0001,?0002,?0003,?0004,?0005,?0006,?0007);" @@ -46,7 +47,7 @@ typedef enum db_check_action_type { "select dim_id from dimension where chart_id=@chart and id=@id and name=@name and length(dim_id)=16;" #define SQL_STORE_ACTIVE_DIMENSION \ - "insert or replace into dimension_active (dim_id, date_created) values (@id, strftime('%s'));" + "insert or replace into dimension_active (dim_id, date_created) values (@id, unixepoch());" #define CHECK_SQLITE_CONNECTION(db_meta) \ if (unlikely(!db_meta)) { \ @@ -59,8 +60,12 @@ typedef enum db_check_action_type { extern int sql_init_database(db_check_action_type_t rebuild, int memory); extern void sql_close_database(void); +extern int bind_text_null(sqlite3_stmt *res, int position, const char *text, bool can_be_null); +extern int sql_store_host(uuid_t *guid, const char *hostname, const char *registry_hostname, int update_every, const char *os, + const char *timezone, const char *tags, int hops); + +extern int sql_store_host_info(RRDHOST *host); -extern int sql_store_host(uuid_t *guid, const char *hostname, const char *registry_hostname, int update_every, const char *os, const char *timezone, const char *tags); extern int sql_store_chart( uuid_t *chart_uuid, uuid_t *host_uuid, const char *type, const char *id, const char *name, const char *family, const char *context, const char *title, const char *units, const char *plugin, const char *module, long priority, @@ -102,4 +107,10 @@ extern void compute_chart_hash(RRDSET *st); extern int sql_set_dimension_option(uuid_t *dim_uuid, char *option); char *get_hostname_by_node_id(char *node_id); void free_temporary_host(RRDHOST *host); +int init_database_batch(sqlite3 *database, int rebuild, int init_type, const char *batch[]); +void migrate_localhost(uuid_t *host_uuid); +extern void sql_store_host_system_info(uuid_t *host_id, const struct rrdhost_system_info *system_info); +extern void sql_build_host_system_info(uuid_t *host_id, struct rrdhost_system_info *system_info); +void sql_store_host_labels(RRDHOST *host); +DICTIONARY *sql_load_host_labels(uuid_t *host_id); #endif //NETDATA_SQLITE_FUNCTIONS_H -- cgit v1.2.3