2020年10月22日 星期四
Sqlite3 語法
https://seacatcry.pixnet.net/blog/post/20104966
root@imx6dlsabresd:~# sqlite3 /etc/system.db
SQLite version 3.14.1 2016-08-11 18:53:32
Enter ".help" for usage hints.
sqlite> .table
battery_parameter extra_func_code pre_modbus sensor_unit
canbus modbus_client rs485list system_config
exist_device modbus_server scanType system_time
sqlite>.schema
CREATE TABLE rs485list (Type INT NOT NULL, Func_code INT NOT NULL, Start_addr1 INT NOT NULL, Start_addr2 INT NOT NULL, Data_addr1 INT NOT NULL, Data_addr2 INT NOT NULL, Res_len INT NOT NULL, RW INT NOT NULL, PRIMARY KEY (Type));
CREATE TABLE battery_parameter (code INT PRIMARY KEY, type INT, battery_set INT, battery_unit INT, battery_capacity INT, in_i_limit INT, out_i_limit INT, floating_chg_v float, high_v_malfunc float, low_v_warning float, low_v_malfunc float);
CREATE TABLE extra_func_code (Type INT PRIMARY KEY, Func_code INT);
CREATE TABLE scanType (id INT PRIMARY KEY, type INT);
CREATE TABLE canbus (id INT PRIMARY KEY, time DATETIME, bmsStatus INT, bmsFault INT, voltage float, current float, soc INT, voltMax float, voltMax_no INT, voltMin float, voltMin_no INT, tempHigh float, tempHigh_no INT, tempLow float, tempLow_no INT);
CREATE TABLE modbus_client (id INT PRIMARY KEY, time DATETIME, kwTotal float, sw3005_kvar float, sw3005_kva float, kwh float, frequency float, PF float);
CREATE TABLE pre_modbus (id INT PRIMARY KEY, spm8_kw float, spm8_kvar float, spm8_kva float, spm8_kwh float, spm8_frequency float, spm8_PF float, sw3005_kw float, sw3005_kvar float, sw3005_kva float, sw3005_kwh float, sw3005_frequency float, sw3005_PF float);
CREATE TABLE modbus_server (id INT PRIMARY KEY, time DATETIME, spm8_kwTotal float, spm8_kvar float, spm8_kva float, spm8_kwh float, spm8_frequency float, spm8_PF float, kwTotal float, sw3005_kvar float, sw3005_kva float, kwh float, frequency float, PF float);
CREATE TABLE system_config (field TEXT PRIMARY KEY, value TEXT);
CREATE TABLE sensor_unit (type TEXT, field TEXT, byte_len TEXT, formula TEXT, threshold float, name TEXT, unit TEXT);
CREATE TABLE system_time (id INT, record_datetime DATETIME);
CREATE TABLE exist_device(Type NOT NULL, Num NOT NULL);
root@imx6dlsabresd:~# sqlite3 /etc/system.db "select * from rs485list;"
15|3|0|2|0|1|2|0
18|3|0|16|0|1|2|2
24|3|0|0|0|2|4|0
26|4|0|0|0|0|4|0
0|4|0|180|0|1|2|2
25|4|0|0|0|1|2|0
9|3|0|6|0|1|2|0
10|3|0|2|0|1|2|0
11|3|0|0|0|2|4|0
16|6|0|0|0|0|0|1
21|3|0|0|0|2|4|0
root@imx6dlsabresd:~# sqlite3 /etc/system.db "select * from sensor_unit;"
24|0|2|3|80.0|humidity|%RH
24|1|2|4|38.0|temperature|℃
26|0|4|5|50.0|frequency|Hz
26|1|4|5|130.0|kw_total|kW
26|2|4|5|9999999.0|kwh|0
0|0|2|2|3.0|pcsStatus|0
0|1|2|6|0.0|pcsManual|0
18|0|2|2|2.0|waterLeakage|0
18|1|2|2|1.0|veryEarly|0
18|2|2|2|1.0|smoke|0
18|3|2|2|1.0|temperature|0
15|0|2|2|1.0|floodstatus|0
25|0|2|7|2.35|electricLeakage|V
9|0|2|1|9999999.0|brightness|Lux
10|2|2|1|60.0|co2|ppm
11|0|2|3|80.0|humidity|%RH
11|1|2|4|38.0|temperature|℃
21|0|2|1|2.0|pm2.5|ug/m3
21|1|2|1|2.0|pm10|ug/m3
10|0|2|3|80.0|humidity|%RH
10|1|2|4|38.0|temperature|℃
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言