📄 kechengbean.java
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: KechengBean.java
package mypackage;
import java.io.PrintStream;
import java.sql.*;
// Referenced classes of package mypackage:
// DataBaseConnection, Kecheng
public class KechengBean
{
private Connection con;
public KechengBean()
{
con = null;
con = DataBaseConnection.getConnection();
}
public boolean existKecheng(Kecheng kecheng)
{
ResultSet resultset;
String s = kecheng.getCourseId();
String s1 = kecheng.getCourseName();
PreparedStatement preparedstatement = con.prepareStatement("select courseId,courseName from kecheng where courseId='" + s + "' or courseName='" + s1 + "'");
resultset = preparedstatement.executeQuery();
Exception exception;
return resultset.next();
exception;
return false;
}
public String addKecheng(Kecheng kecheng)
{
PreparedStatement preparedstatement;
preparedstatement = null;
String s = "";
String s2;
if (!existKecheng(kecheng))
break MISSING_BLOCK_LABEL_23;
s2 = "exist";
return s2;
String s1;
try
{
preparedstatement = con.prepareStatement("insert into kecheng values(?,?,?,?,?)");
preparedstatement.setString(1, kecheng.getCourseId());
preparedstatement.setString(2, kecheng.getCourseName());
preparedstatement.setInt(3, kecheng.getXuefen());
preparedstatement.setString(4, kecheng.getCourseType());
preparedstatement.setString(5, "1");
preparedstatement.execute();
s1 = "sucess";
}
catch (SQLException sqlexception)
{
System.err.println(sqlexception.getMessage());
s1 = "failer";
}
break MISSING_BLOCK_LABEL_163;
local;
try
{
preparedstatement.close();
con.close();
}
catch (Exception exception1)
{
exception1.printStackTrace();
}
JVM INSTR ret 6;
return s1;
}
public String updateKecheng(Kecheng kecheng)
{
PreparedStatement preparedstatement = null;
String s = "";
try
{
preparedstatement = con.prepareStatement("update kecheng set courseName=?,xuefen=?,courseType=? where courseId=?");
preparedstatement.setString(1, kecheng.getCourseName());
preparedstatement.setInt(2, kecheng.getXuefen());
preparedstatement.setString(3, kecheng.getCourseType());
preparedstatement.setString(4, kecheng.getCourseId());
preparedstatement.execute();
s = "sucess";
}
catch (SQLException sqlexception)
{
System.err.println(sqlexception.getMessage());
s = "failer";
}
finally
{
try
{
preparedstatement.close();
con.close();
}
catch (Exception exception1)
{
exception1.printStackTrace();
}
}
return s;
}
public String deleteKecheng(String s)
{
PreparedStatement preparedstatement = null;
String s1 = "";
try
{
preparedstatement = con.prepareStatement("update kecheng set flag=? where courseId=?");
preparedstatement.setString(1, "2");
preparedstatement.setString(2, s);
preparedstatement.execute();
s1 = "sucess";
}
catch (SQLException sqlexception)
{
System.err.println(sqlexception.getMessage());
s1 = "failer";
}
finally
{
try
{
preparedstatement.close();
con.close();
}
catch (Exception exception1)
{
exception1.printStackTrace();
}
}
return s1;
}
public ResultSet executeQuery(String s)
{
Object obj = null;
ResultSet resultset = null;
try
{
Statement statement = con.createStatement(1005, 1008);
resultset = statement.executeQuery(s);
}
catch (SQLException sqlexception)
{
System.err.println(sqlexception.getMessage());
}
return resultset;
}
public void close()
{
try
{
con.close();
}
catch (SQLException sqlexception)
{
sqlexception.printStackTrace();
}
}
public String getAllCourse()
{
StringBuffer stringbuffer;
label0:
{
PreparedStatement preparedstatement = null;
ResultSet resultset = null;
stringbuffer = new StringBuffer();
try
{
String s2;
try
{
preparedstatement = con.prepareStatement("select courseId,courseName from kecheng");
String s;
String s1;
for (resultset = preparedstatement.executeQuery(); resultset.next(); stringbuffer.append("<option value='" + s + "'>" + s1 + "</option>\n"))
{
s = resultset.getString("courseId");
s1 = resultset.getString("courseName");
}
break label0;
}
catch (SQLException sqlexception)
{
s2 = "";
}
return s2;
}
finally
{
try
{
if (resultset != null)
resultset.close();
if (preparedstatement != null)
preparedstatement.close();
if (con != null)
con.close();
}
catch (Exception exception1)
{
exception1.printStackTrace();
}
}
}
return stringbuffer.toString();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -