📄 t_score.jad
字号:
// Decompiled by DJ v3.2.2.67 Copyright 2002 Atanas Neshkov Date: 2005-6-15 22:14:51
// Home Page : http://members.fortunecity.com/neshkov/dj.html - Check often for new version!
// Decompiler options: packimports(3)
// Source File Name: T_score.java
package jinghua;
import java.io.PrintStream;
import java.sql.*;
import java.text.SimpleDateFormat;
import java.util.Date;
// Referenced classes of package jinghua:
// JinghuaConn
public class T_score
{
public T_score(String stu_id, int test_id, float score, String test_class, int tea_id)
{
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
test_date = df.format(new Date());
this.test_id = test_id;
this.stu_id = stu_id;
this.test_class = test_class;
this.score = score;
this.tea_id = tea_id;
debugMsg = new StringBuffer("OK");
}
public T_score()
{
}
public synchronized String storeMark(int replaceOld)
{
String strRS = "";
String strSql = "";
JinghuaConn jhCon = null;
Statement stmt = null;
ResultSet rs = null;
try
{
jhCon = new JinghuaConn();
Connection con = jhCon.getConnection();
switch(replaceOld)
{
default:
break;
case 1: // '\001'
strSql = "select * from scores where stu_id='" + stu_id + "' and test_id=" + test_id + " and test_class=" + test_class;
stmt = con.createStatement();
rs = stmt.executeQuery(strSql);
if(rs.next())
{
rs.close();
stmt.close();
stmt = con.createStatement();
strSql = "update scores set score=" + score + ",test_date='" + test_date + "' where stu_id='" + stu_id + "' and test_id=" + test_id;
stmt.executeUpdate(strSql);
stmt.close();
} else
{
rs.close();
stmt.close();
stmt = con.createStatement();
strSql = "insert into scores(stu_id,test_id,score,test_date,test_class,tea_id) values('" + stu_id + "'," + test_id + "," + score + ",'" + test_date + "'," + test_class + "," + tea_id + ")";
stmt.executeUpdate(strSql);
stmt.close();
}
break;
case 2: // '\002'
strSql = "select * from scores where stu_id='" + stu_id + "' and test_id=" + test_id + " and test_class=" + test_class;
stmt = con.createStatement();
rs = stmt.executeQuery(strSql);
if(rs.next())
{
rs.close();
stmt.close();
} else
{
rs.close();
stmt.close();
stmt = con.createStatement();
strSql = "insert into scores(stu_id,test_id,score,test_date,test_class,tea_id) values('" + stu_id + "'," + test_id + "," + score + ",'" + test_date + "'," + test_class + "," + tea_id + ")";
stmt.executeUpdate(strSql);
stmt.close();
}
break;
case 3: // '\003'
strSql = "insert into scores(stu_id,test_id,score,test_date,test_class,tea_id) values('" + stu_id + "'," + test_id + "," + score + ",'" + test_date + "'," + test_class + "," + tea_id + ")";
stmt = con.createStatement();
stmt.executeUpdate(strSql);
stmt.close();
break;
}
}
catch(SQLException se)
{
System.out.print("score:storeMark() Error!\n strSql=" + strSql + se.toString());
debugMsg.append("<br>score:storeMark() Error!<br> strSql=" + strSql);
}
catch(Exception e)
{
System.out.print("score:storeMark() Error!\n " + e.toString());
debugMsg.append("<br>score:storeMark() Error!<br>");
}
finally
{
jhCon.dropConnection();
}
return debugMsg.toString();
}
StringBuffer debugMsg;
float score;
String stu_id;
int tea_id;
String test_class;
String test_date;
int test_id;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -