added length parameter to mysql substring function in myems-api

pull/140/head
13621160019@163.com 2022-04-09 00:28:11 +08:00
parent e4fd38b18d
commit f190c9d5c3
2 changed files with 2 additions and 2 deletions

View File

@ -59,7 +59,7 @@ Install and run with waitress:
```bash ```bash
pip install waitress pip install waitress
cd myems\myems-api cd myems\myems-api
waitress-serve --listen=127.0.0.1:8000 app:api waitress-serve --listen=0.0.0.0:8000 app:api
``` ```

View File

@ -89,7 +89,7 @@ class VirtualMeterCollection:
query_variables = (" SELECT v.id, v.name, v.meter_type, v.meter_id " query_variables = (" SELECT v.id, v.name, v.meter_type, v.meter_id "
" FROM tbl_virtual_meters vm, tbl_variables v " " FROM tbl_virtual_meters vm, tbl_variables v "
" WHERE vm.id = %s AND v.virtual_meter_id = vm.id " " WHERE vm.id = %s AND v.virtual_meter_id = vm.id "
" ORDER BY SUBSTRING(v.name,2) + 0 ") " ORDER BY SUBSTRING(v.name, 2, 10) + 0 ")
cursor.execute(query_variables, (meta_result['id'],)) cursor.execute(query_variables, (meta_result['id'],))
rows_variables = cursor.fetchall() rows_variables = cursor.fetchall()
if rows_variables is not None: if rows_variables is not None: