Commit ca256752 authored by Lluis Alonso's avatar Lluis Alonso
Browse files

Fixed several MySQL errors

parent d7e206ab
......@@ -203,6 +203,8 @@ MYSQL *mysql_create_connection()
return NULL;
}
unsigned int time_out = 20;
mysql_options(connection,MYSQL_OPT_CONNECT_TIMEOUT,(char*)&time_out);
if (!mysql_real_connect(connection, db_config->ip, db_config->user, db_config->pass, db_config->database, db_config->port, NULL, 0))
{
verbose(VDBH, "ERROR connecting to the database: %s", mysql_error(connection));
......
......@@ -2394,14 +2394,16 @@ int mysql_batch_insert_periodic_metrics(MYSQL *connection, periodic_metric_t *pe
bind[5+offset].buffer = (char *)&per_mets[i].step_id;
if (node_detail)
{
bind[8 + offset].buffer_type = bind[9 + offset].buffer_type = bind[10 + offset].buffer_type = MYSQL_TYPE_LONGLONG;
bind[8 + offset].is_unsigned = bind[9 + offset].is_unsigned = bind[10 + offset].is_unsigned = 1;
bind[8 + offset].buffer_type = bind[9 + offset].buffer_type = MYSQL_TYPE_LONGLONG;
bind[8 + offset].is_unsigned = bind[9 + offset].is_unsigned = 1;
bind[6+offset].buffer = (char *)&per_mets[i].avg_f;
bind[7+offset].buffer = (char *)&per_mets[i].temp;
bind[8+offset].buffer = (char *)&per_mets[i].DRAM_energy;
bind[9+offset].buffer = (char *)&per_mets[i].PCK_energy;
#if USE_GPUS
bind[10+offset].buffer_type = MYSQL_TYPE_LONGLONG;
bind[10+offset].is_unsigned = 1;
bind[10+offset].buffer = (char *)&per_mets[i].GPU_energy;
#endif
}
......
  •     bind[8 + offset].is_unsigned = bind[9 + offset].is_unsigned = bind[10 + offset].is_unsigned = 1;
                bind[8 + offset].buffer_type = bind[9 + offset].buffer_type = MYSQL_TYPE_LONGLONG;
                bind[8 + offset].is_unsigned = bind[9 + offset].is_unsigned = 1;
    
                bind[6+offset].buffer = (char *)&per_mets[i].avg_f;
                bind[7+offset].buffer = (char *)&per_mets[i].temp;   
                bind[8+offset].buffer = (char *)&per_mets[i].DRAM_energy;
                bind[9+offset].buffer = (char *)&per_mets[i].PCK_energy;
    #if USE_GPUS
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment