这样的执行有问题吗?

[复制链接]
查看11 | 回复7 | 2017-9-26 13:06:30 | 显示全部楼层 |阅读模式
public boolean saveCallResult(String callId,String starttime,String endtime){

boolean baddcallresult=false;

insert_sql ='insert *****'
update_sql='update *****';



try{


conn = com.suntek.util.sql.ConnectionManage.getConnection(dsn);

st = conn.createStatement();

int rowCount_insert = st.executeUpdate(insert_sql);

int rowCount_update = st.executeUpdate(update_sql);


if(rowCount_update != 0 && rowCount_insert != 0)

baddcallresult = true;

}


catch(Exception e){

System.err.print("保存错误: "+e.getMessage()+"sql:"+insert_sql);


}

finally{

com.suntek.util.sql.ConnectionManage.close(conn,st);

return baddcallresult;

}

}
回复

使用道具 举报

千问 | 2017-9-26 13:06:30 | 显示全部楼层
还行啊,
回复

使用道具 举报

千问 | 2017-9-26 13:06:30 | 显示全部楼层
conn的autocommit的状态有没有指定过。
是 true 还是false
回复

使用道具 举报

千问 | 2017-9-26 13:06:30 | 显示全部楼层
最初由 seraphin 发布
[B]conn的autocommit的状态有没有指定过。
是 true 还是false [/B]

他没要求说要transaction
回复

使用道具 举报

千问 | 2017-9-26 13:06:30 | 显示全部楼层
最初由 seraphin 发布
[B]conn的autocommit的状态有没有指定过。
是 true 还是false [/B]

能解释一下吗?
回复

使用道具 举报

千问 | 2017-9-26 13:06:30 | 显示全部楼层
最初由 goto53guitar 发布
[B]
能解释一下吗? [/B]

connection有个方法
setautocommit
去看看文档就知道了
回复

使用道具 举报

千问 | 2017-9-26 13:06:30 | 显示全部楼层
谢谢楼上的
回复

使用道具 举报

千问 | 2017-9-26 13:06:30 | 显示全部楼层
不客气
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行