Skip to content
Snippets Groups Projects
Commit 045e0df7 authored by Lan Dam's avatar Lan Dam
Browse files

add code to execute db

parent 986e84bc
No related branches found
No related tags found
1 merge request!211Implement dialog to add/edit a single channel in database
Pipeline #3183 passed with stage
in 4 minutes and 28 seconds
......@@ -10,6 +10,8 @@ from sohstationviewer.view.util.plot_func_names import plot_functions
from sohstationviewer.view.db_config.add_edit_single_channel_helper import (
get_params, get_channel_info, get_param_info)
from sohstationviewer.database.process_db import execute_db
def get_db_str_with_null(col, val):
"""
......@@ -317,7 +319,7 @@ class AddEditSingleChannelDialog(QDialog):
height = f"height={self.height_spnbox.value()}"
sql = (f"UPDATE Parameters SET {plot_type}, {value_colorb}, "
f"{value_colorw}, {height} WHERE {param}")
print('NEED TO EXECUTE: param sql:', sql)
execute_db(sql)
def insert_channel_info(self):
sql = ("INSERT INTO Channels VALUES ("
......@@ -329,7 +331,7 @@ class AddEditSingleChannelDialog(QDialog):
f"'{self.unit_lnedit.text()}', "
f"{self.fix_point_spnbox.value()}, "
f"'{self.data_type_lnedit.text()}')")
print('NEED TO EXECUTE: insert channel sql:', sql)
execute_db(sql)
def update_channel_info(self):
channel = f"channel='{self.name_lnedit.text()}'"
......@@ -343,7 +345,7 @@ class AddEditSingleChannelDialog(QDialog):
sql = (f"UPDATE Channels SET {label}, {param}, {linked_chan}, "
f"{convert_factor}, {unit}, {fix_point}, {data_type} "
f"WHERE {channel}")
print('NEED TO EXECUTE: update channel sql:', sql)
execute_db(sql)
if __name__ == '__main__':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment