请问这段代码是什么意思?在DB,java里面。求详细。
publicvoiddoPstm(Stringsql,Object[]params){if(sql!=null&&!sql.equals("")){if(params==...
public void doPstm(String sql, Object[] params)
{
if (sql != null && !sql.equals(""))
{
if (params == null)
params = new Object[0];
getCon();
if (con != null)
{
try
{
System.out.println(sql);
pstm = con.prepareStatement(sql,
ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
for (int i = 0; i < params.length; i++)
{
pstm.setObject(i + 1, params[i]);
}
pstm.execute();
} catch (SQLException e)
{
System.out.println("doPstm()方法出错!");
e.printStackTrace();
}
}
}
} 展开
{
if (sql != null && !sql.equals(""))
{
if (params == null)
params = new Object[0];
getCon();
if (con != null)
{
try
{
System.out.println(sql);
pstm = con.prepareStatement(sql,
ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
for (int i = 0; i < params.length; i++)
{
pstm.setObject(i + 1, params[i]);
}
pstm.execute();
} catch (SQLException e)
{
System.out.println("doPstm()方法出错!");
e.printStackTrace();
}
}
}
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询