dods.servers.sql
Class sqlURL
java.lang.Object
dods.dap.BaseType
dods.dap.DString
dods.dap.DURL
dods.dap.Server.SDURL
dods.servers.sql.sqlURL
- All Implemented Interfaces:
- ClientIO, java.lang.Cloneable, ExprParserConstants, RelOps, ServerMethods
- public class sqlURL
- extends SDURL
Holds a DODS Server sqlURL
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 |
sqlURL()
Constructs a new sqlURL . |
sqlURL(java.lang.String n)
Constructs a new sqlURL 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.SDURL |
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, newPrimitiveVector, 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 |
sqlURL
public sqlURL()
- Constructs a new
sqlURL
.
sqlURL
public sqlURL(java.lang.String n)
- Constructs a new
sqlURL
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 DFLoat32
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 SDURL
- 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 SDURL
- Parameters:
sink
- a DataOutputStream
to write to.
- Throws:
java.io.IOException
- thrown on any OutputStream
exception.
NoSuchVariableException
SDODSException
- See Also:
BaseType
,
DDS
,
ServerDDS