?? person.java
字號:
import java.sql.*;import oracle.sql.*;public class Person implements ORAData, ORADataFactory{ static final Person _factory = new Person (); public NUMBER ssn; public CHAR name; public CHAR address; public static ORADataFactory getFactory() { return _factory; } public Person () {} public Person (NUMBER ssn, CHAR name, CHAR address) { this.ssn = ssn; this.name = name; this.address = address; } public Datum toDatum(Connection c) throws SQLException { StructDescriptor sd = StructDescriptor.createDescriptor("SCOTT.PERSON_T", c); Object [] attributes = { ssn, name, address }; 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 Person ((NUMBER) attributes[0], (CHAR) attributes[1], (CHAR) attributes[2]); } public String toString () { try { return "SCOTT.PERSON_T: ssn="+ssn.intValue()+ " name="+name.stringValue()+ " address="+address.stringValue(); } catch (SQLException e) { // ignore the error } return "some error happened"; }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -