- 表名初始化
下面是JS例子:请求方式 POST action init token 通讯密钥字符串/可省略 isdel [ true | false ] 是否清空表/布尔值 table 表名 function NetDataInit(tableName, isdel, token) { isdel = isdel || false; let SenData = { "action": "init", "table": tableName, "isdel": isdel }; if (token) SenData['token'] = token; let res = http.post(SqlUrl, SenData); console.log(res.body.string()); return res.body.string() === ''; }
-
上传数据到数据库
下面是JS例子:请求方式 POST action set token 通讯密钥 key 字段key value 字段value type value数据类型 table 表名 function NetDataSet(tableName, key, value, token) { let SenData = { "action": "set", "key": key, "value": value, "table": tableName, "type": typeof value }; if (token) SenData['token'] = token; let res = http.post(SqlUrl, SenData); console.log(res.body.string()); return res.body.string() === '1'; }
-
通过key获取value和type数据
下面是JS例子:请求方式 POST action get token 通讯密钥 key 字段key isdel [ true | false ] 是否删除数据/布尔值 table 表名 function NetDataGet(tableName, key, isdel, token) { isdel = isdel || false; let SenData = { "action": "get", "key": key, "isdel": isdel, "table": tableName, }; if (token) SenData['token'] = token; let res = http.post(SqlUrl, SenData); console.log("GetData:", res.body.string()); return res.body.string(); }
-
从数据表中获取指定行数的数据
下面是JS例子:请求方式 POST action getrows token 通讯密钥 startrow 起始行/number rows 获取数量/number isdel [ true | false ] 是否删除数据/布尔值 table 表名 function NetDataGetRows(tableName, startrow, rows, isdel, token) { isdel = isdel || false; let SenData = { "action": "getrows", "startrow": startrow, "rows": rows, "isdel": isdel, "table": tableName, }; if (token) SenData['token'] = token; let res = http.post(SqlUrl, SenData); console.log("GetData:", res.body.string()); return res.body.string(); }
-
从数据表中获取数据总数量
下面是JS例子:请求方式 POST action count token 通讯密钥 key 字段key isdel [ true | false ] 是否删除数据/布尔值 table 表名 function NetDataCount(tableName, token) { let SenData = { "action": "count", "table": tableName, }; if (token) SenData['token'] = token; let res = http.post(SqlUrl, SenData); console.log(res.body.string()); return res.body.string() !== '' ? parseInt(res.body.string()) : -1; }
-
从数据表中删除指定网络数据
下面是JS例子:请求方式 POST action del token 通讯密钥 key url编码后 字段key table 表名 function NetDataDel(tableName, key, token) { let SenData = { "action": "del", "key": key, "table": tableName, }; if (token) SenData['token'] = token; let res = http.post(SqlUrl, SenData); console.log(res.body.string()); return res.body.string() === '1'; }