📄 parttimestudent.java
字号:
import java.sql.*;import oracle.sql.*;public class ParttimeStudent extends Student{ static final ParttimeStudent _factory = new ParttimeStudent (); public NUMBER numHours; public static ORADataFactory getFactory() { return _factory; } public ParttimeStudent () {} public ParttimeStudent (NUMBER ssn, CHAR name, CHAR address, NUMBER deptid, CHAR major, NUMBER numHours) { super (ssn, name, address, deptid, major); this.numHours = numHours; } public Datum toDatum(Connection c) throws SQLException { StructDescriptor sd = StructDescriptor.createDescriptor("SCOTT.PARTTIMESTUDENT_T", c); Object [] attributes = { ssn, name, address, deptid, major, numHours}; return new STRUCT(sd, c, attributes); } public ORAData create(Datum d, int sqlType) throws SQLException { if (d == null) return null; Object [] attributes = ((STRUCT) d).getOracleAttributes(); return new ParttimeStudent ((NUMBER) attributes[0], (CHAR) attributes[1], (CHAR) attributes[2], (NUMBER) attributes[3], (CHAR) attributes[4], (NUMBER) attributes[5]); } public String toString () { try { return "SCOTT.PARTTIMESTUDENT_T: ssn="+ssn.intValue()+ " name="+name.stringValue()+ " address="+address.stringValue()+ " deptid="+deptid.intValue()+ " major="+major.stringValue()+ " numHours="+numHours.intValue(); } catch (SQLException e) { // ignore the error } return "some error happened"; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -