⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 employee.java

📁 Java示例100
💻 JAVA
字号:
/** * filename: Employee.java * * This demonstrates how to derive a user-defined type * based on ORAData and ORADataFactory. * This class is used by ORADataExample.java * * Please use jdk1.2 or later version, classes12.zip **/import java.math.BigDecimal;import java.sql.SQLException;import java.sql.Connection;import oracle.jdbc.OracleConnection;import oracle.sql.*;public class Employee implements ORAData, ORADataFactory{  static final Employee _employeeFactory = new Employee(null, null);  public static ORADataFactory getFactory()  {    return _employeeFactory;  }  public Employee ()  {  }  /* constructor */  public Employee(String empName, BigDecimal empNo)  {    this.empName = empName;    this.empNo = empNo;  }  /* ORAData interface */  public Datum toDatum(Connection c) throws SQLException  {    StructDescriptor sd =       StructDescriptor.createDescriptor("HR.EMPLOYEE", c);    Object [] attributes = { empName, empNo };    return new STRUCT(sd, c, attributes);  }  /* ORADataFactory interface */  public ORAData create(Datum d, int sqlType) throws SQLException  {    if (d == null) return null;    Object [] attributes = ((STRUCT) d).getAttributes();    return new Employee((String) attributes[0],                        (BigDecimal) attributes[1]);  }  /* fields */  public String empName;  public BigDecimal empNo;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -