|
|
|
|
@ -58,6 +58,7 @@ static MYSQL_STMT __thread
|
|
|
|
|
*stm_close_call,
|
|
|
|
|
*stm_insert_stream,
|
|
|
|
|
*stm_close_stream,
|
|
|
|
|
*stm_delete_stream,
|
|
|
|
|
*stm_config_stream,
|
|
|
|
|
*stm_insert_metadata;
|
|
|
|
|
|
|
|
|
|
@ -75,6 +76,7 @@ static void reset_conn(void) {
|
|
|
|
|
my_stmt_close(&stm_close_call);
|
|
|
|
|
my_stmt_close(&stm_insert_stream);
|
|
|
|
|
my_stmt_close(&stm_close_stream);
|
|
|
|
|
my_stmt_close(&stm_delete_stream);
|
|
|
|
|
my_stmt_close(&stm_config_stream);
|
|
|
|
|
my_stmt_close(&stm_insert_metadata);
|
|
|
|
|
mysql_close(mysql_conn);
|
|
|
|
|
@ -139,6 +141,8 @@ static int check_conn(void) {
|
|
|
|
|
"end_timestamp = ? where id = ?"))
|
|
|
|
|
goto err;
|
|
|
|
|
}
|
|
|
|
|
if (prep(&stm_delete_stream, "delete from recording_streams where id = ?"))
|
|
|
|
|
goto err;
|
|
|
|
|
if (prep(&stm_config_stream, "update recording_streams set channels = ?, sample_rate = ? where id = ?"))
|
|
|
|
|
goto err;
|
|
|
|
|
if (prep(&stm_insert_metadata, "insert into recording_metakeys (`call`, `key`, `value`) values " \
|
|
|
|
|
@ -425,6 +429,18 @@ file:;
|
|
|
|
|
free(filename);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void db_delete_stream(output_t *op) {
|
|
|
|
|
if (check_conn())
|
|
|
|
|
return;
|
|
|
|
|
if (op->db_id == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
MYSQL_BIND b[1];
|
|
|
|
|
my_ull(&b[0], &op->db_id);
|
|
|
|
|
|
|
|
|
|
execute_wrap(&stm_delete_stream, b, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void db_config_stream(output_t *op) {
|
|
|
|
|
if (check_conn())
|
|
|
|
|
return;
|
|
|
|
|
|