dods.servers.sql
Class sqlGrid
java.lang.Object
dods.dap.BaseType
dods.dap.DConstructor
dods.dap.DGrid
dods.dap.Server.SDGrid
dods.servers.sql.sqlGrid
- All Implemented Interfaces:
- ClientIO, java.lang.Cloneable, RelOps, ServerArrayMethods, ServerMethods
- public class sqlGrid
- extends SDGrid
Holds a DODS Server sqlGrid
value.
- Version:
- $Revision: 1.2.2.1 $
- Author:
- ndp
- See Also:
BaseType
Constructor Summary |
sqlGrid()
Constructs a new sqlGrid . |
sqlGrid(java.lang.String n)
Constructs a new sqlGrid 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.SDGrid |
addVariable, equal, getStart, getStop, getStride, greater_eql, greater, isProject, isRead, isSynthesized, less_eql, less, not_equal, printDecl, printVal, projectedComponents, projectionYieldsGrid, regexp, setProject, setProject, setProjection, setRead, setSynthesized |
Methods inherited from class dods.dap.BaseType |
checkSemantics, 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 |
sqlGrid
public sqlGrid()
- Constructs a new
sqlGrid
.
sqlGrid
public sqlGrid(java.lang.String n)
- Constructs a new
sqlGrid
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 SDGrid
- 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 SDGrid
- Parameters:
sink
- a DataOutputStream
to write to.
- Throws:
java.io.IOException
- thrown on any OutputStream
exception.
NoSuchVariableException
SDODSException
- See Also:
BaseType
,
DDS
,
ServerDDS