加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

javascript + sql编写SQL客户端工具tabris

发布时间:2020-12-15 04:41:53 所属栏目:百科 来源:网络整理
导读:div style="font-size: 14px; white-space: pre-wrap; text-align: left; line-height: 1.75;"祝大家2018新年快乐, div style="font-size: 14px; white-space: pre-wrap; text-align: left; line-height: 1.75;"前不久发现了一个创意的脚本span style="font

<div style="font-size: 14px; white-space: pre-wrap; text-align: left; line-height: 1.75;">祝大家2018新年快乐,
<div style="font-size: 14px; white-space: pre-wrap; text-align: left; line-height: 1.75;">前不久发现了一个创意的脚本<span style="font-size: 28px; color: #24292e;">JtSQL(java编写)

别误会成客户端运行啊...)?
开源地址为:
1?包含JtSQL的所有特性

封装的sql log http 三大组件 在编辑器上的方法能代码智能提示?

<img src="https://www.52php.cn/res/2019/02-15/23/ca9db959d20a7a764f492d9c788c47ea.png" alt="">

<img src="https://www.52php.cn/res/2019/02-15/23/97887748187337470b0dddf4ffaa4fc6.png" alt="">
<div class="cnblogs_code">


 db = .tabris.create('SQL''testorm''mysql'<span style="color: #008000;">//<span style="color: #008000;">http处理器
<span style="color: #0000ff;">var
http = <span style="color: #0000ff;">this
.tabris.create('HTTP'<span style="color: #000000;">,{
method:
'GET'<span style="color: #000000;">
});

<span style="color: #008000;">//<span style="color: #008000;">log处理器
<span style="color: #0000ff;">var log = <span style="color: #0000ff;">this.tabris.create('LOG'<span style="color: #000000;">,{
trace:<span style="color: #0000ff;">true<span style="color: #000000;">
});

db.<span style="color: #0000ff;">delete('delete from child_district'<span style="color: #000000;">);

<span style="color: #008000;">//<span style="color: #008000;">从district表里面获取所有城市的Code
<span style="color: #0000ff;">var get_district_sql = "select Code from district"<span style="color: #000000;">;

<span style="color: #0000ff;">var district_code_list =<span style="color: #000000;"> db.query(get_district_sql);

<span style="color: #0000ff;">for (<span style="color: #0000ff;">var index = 0; index < district_code_list.length; index++<span style="color: #000000;">) {
getChildDistrictAndInsertToDb(district_code_list[index].Code);
}

<span style="color: #008000;">//<span style="color: #008000;">远程获取
<span style="color: #0000ff;">function<span style="color: #000000;"> getChildDistrictAndInsertToDb(parentCode){
log.info(parentCode);
<span style="color: #0000ff;">var re =<span style="color: #000000;"> http.getJson({
url:'https://fuwu.sf-express.com/service/address/newAddr/getNewSubAddress?parentCode=' +<span style="color: #000000;"> parentCode
});
<span style="color: #0000ff;">if(!re.subAddressList || !re.subAddressList.length) <span style="color: #0000ff;">return<span style="color: #000000;">;
<span style="color: #0000ff;">for (<span style="color: #0000ff;">var index = 0; index < re.subAddressList.length; index++<span style="color: #000000;">) {
<span style="color: #0000ff;">var child =<span style="color: #000000;"> re.subAddressList[index];
<span style="color: #0000ff;">var insertSql = "insert into child_district (Name,Code,DataChange_LastTime) VALUES('"+ child.distCnName +"','"+ child.distCode +"',now())"<span style="color: #000000;">;
<span style="color: #0000ff;">var insertResult =<span style="color: #000000;"> db.insert(insertSql)
<span style="color: #0000ff;">if(insertResult!=1<span style="color: #000000;">){
log.error(child.distCnName + '插入db失败!'<span style="color: #000000;">);
}<span style="color: #0000ff;">else<span style="color: #000000;">{
log.info(child.distCnName + '插入db成功!'<span style="color: #000000;">)
}
}
}

下载地址

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读