1 /*-------------------------------------------------------------------------
4 * Field is a class used to describe fields in a PostgreSQL ResultSet
6 * Copyright (c) 2003, PostgreSQL Global Development Group
9 * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/Field.java,v 1.1 2003/03/07 18:39:41 barry Exp $
11 *-------------------------------------------------------------------------
13 package org.postgresql.core;
18 import org.postgresql.core.BaseConnection;
19 import org.postgresql.util.PSQLException;
25 private int length; // Internal Length of this field
26 private int oid; // OID of the type
27 private int mod; // type modifier of this field
28 private String name; // Name of this field
30 private BaseConnection conn; // Connection Instantation
34 * Construct a field based on the information fed to it.
36 * @param conn the connection this field came from
37 * @param name the name of the field
38 * @param oid the OID of the field
39 * @param len the length of the field
41 public Field(BaseConnection conn, String name, int oid, int length, int mod)
51 * Constructor without mod parameter.
53 * @param conn the connection this field came from
54 * @param name the name of the field
55 * @param oid the OID of the field
56 * @param len the length of the field
58 public Field(BaseConnection conn, String name, int oid, int length)
60 this(conn, name, oid, length, 0);
64 * @return the oid of this Field's data type
72 * @return the mod of this Field's data type
80 * @return the name of this Field's data type
82 public String getName()
88 * @return the length of this Field's data type
90 public int getLength()
96 * We also need to get the PG type name as returned by the back end.
98 * @return the String representation of the PG type of this field
99 * @exception SQLException if a database access error occurs
101 public String getPGType() throws SQLException
103 return conn.getPGType(oid);
107 * We also need to get the java.sql.types type.
109 * @return the int representation of the java.sql.types type of this field
110 * @exception SQLException if a database access error occurs
112 public int getSQLType() throws SQLException
114 return conn.getSQLType(oid);