dods.servers.sql
Class sqlUI16
java.lang.Object
dods.dap.BaseType
dods.dap.DInt16
dods.dap.DUInt16
dods.dap.Server.SDUInt16
dods.servers.sql.sqlUI16
- All Implemented Interfaces:
- ClientIO, java.lang.Cloneable, ExprParserConstants, RelOps, ServerMethods
- public class sqlUI16
- extends SDUInt16
Holds a DODS Server sqlUI16
value.
- Version:
- $Revision: 1.3.2.1 $
- Author:
- ndp
- See Also:
BaseType
Fields inherited from interface dods.dap.parser.ExprParserConstants |
AMPERSAND, ASTERISK, COLON, COMMA, DEFAULT, EOF, EQUAL, EXPONENT, FLOAT, GREATER, GREATER_EQL, ID, INT, LBRACE, LBRACKET, LESS, LESS_EQL, LPAREN, MANTISSA, NOT_EQUAL, QUOTED_STR, RBRACE, RBRACKET, REGEXP, RPAREN, SEPARATOR, STR, tokenImage, UNQUOTED_STR, UNTERM_QUOTE |
Constructor Summary |
sqlUI16()
Constructs a new sqlUI16 . |
sqlUI16(java.lang.String n)
Constructs a new sqlUI16 with name n . |
Method Summary |
boolean |
read(java.lang.String datasetName,
java.lang.Object specialO)
Read a value from the named dataset for this variable. |
void |
serialize(java.lang.String dataset,
java.io.DataOutputStream sink,
CEEvaluator ce,
java.lang.Object specialO)
Server-side serialization for DODS variables (sub-classes of
BaseType ). |
Methods inherited from class dods.dap.Server.SDUInt16 |
equal, greater_eql, greater, isProject, isRead, isSynthesized, less_eql, less, not_equal, printDecl, printVal, regexp, setProject, setProject, setRead, setSynthesized |
Methods inherited from class dods.dap.BaseType |
checkSemantics, checkSemantics, clone, elementCount, elementCount, getLongName, getName, getParent, printDecl, printDecl, printDecl, printDecl, printDecl, printDecl, printDecl, printVal, printVal, printVal, setName, setParent |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
sqlUI16
public sqlUI16()
- Constructs a new
sqlUI16
.
sqlUI16
public sqlUI16(java.lang.String n)
- Constructs a new
sqlUI16
with name n
.
- Parameters:
n
- the name of the variable.
read
public boolean read(java.lang.String datasetName,
java.lang.Object specialO)
throws NoSuchVariableException,
java.io.IOException,
java.io.EOFException
- Read a value from the named dataset for this variable.
This implementation is intended to be reading data from
a JDBC connection to a relational database. It is important to note
that their are several layers of type translation happening in this:
Database -> JDBC -> Java -> DODS
The Database types are the native types for the particular database
that is being read from. The translation from Database->JDBC is handled
before we get to the data (most likely by the JDBC Drivers). Our mapping
of JDBC type to DODS types (the intermediate Java types happen in
the process) looks like this:
Mapping from JDBC Types to DODS Types:
TINYINT DByte
SMALLINT DInt16
INTEGER DInt32
BIGINT DInt32 **NO SENSIBLE MAPPING (Need DInt64)
REAL DFloat32
FLOAT DFloat64
DOUBLE DFloat64
DECIMAL DFloat64 **NO SENSIBLE MAPPING (Need Some Kind Monsterous Floating point value)
NUMERIC DFloat64 **NO SENSIBLE MAPPING (ibid)
BIT DBoolean
CHAR DString
VARCHAR DString
LONGVARCHAR Implemented to be read into a DString, although it is a "BLOB" type
and might be better represented as a DArray(of bytes).
BINARY DArray(of bytes)
VARBINARY DArray(of bytes)
LONGVARBINARY DArray(of bytes)
DATE DString
TIME DString
TIMESTAMP DString
And are handled in this (the read()) method for each of the correspoonding
DODS data types.
These read() methods must be sure to read from the current column
in the sqlResponse object, and then bump the column counter when
finished in order for the sqlResponse object to be ready for the
next invocation of a read() method.
- Specified by:
read
in interface ServerMethods
- Specified by:
read
in class SDUInt16
- Parameters:
datasetName
- String identifying the file or other data store
from which to read a vaue for this variable.specialO
- This Object
is used by this method. It is
assumed to be of type sqlResponse, a container for the ResultSet and
the index value of next column to evaluate.
- Returns:
true
if more data remains to be read, otherwise
false
. This is an abtsract method that must be implemented
as part of the installation/localization of a DODS server.
- Throws:
java.io.IOException
java.io.EOFException
NoSuchVariableException
serialize
public void serialize(java.lang.String dataset,
java.io.DataOutputStream sink,
CEEvaluator ce,
java.lang.Object specialO)
throws NoSuchVariableException,
SDODSException,
java.io.IOException
- Server-side serialization for DODS variables (sub-classes of
BaseType
).
We override the serialize() method of the parent SDClass in
order to stop the evaluation of the CEEvaluator's Clauses, as
this has been handled implicitly by the SQL Database that this
Server is designed to interrogate.
- Specified by:
serialize
in interface ServerMethods
- Overrides:
serialize
in class SDUInt16
- Parameters:
sink
- a DataOutputStream
to write to.
- Throws:
java.io.IOException
- thrown on any OutputStream
exception.
NoSuchVariableException
SDODSException
- See Also:
BaseType
,
DDS
,
ServerDDS