Package quadbase.ChartAPI
Class DbData
java.lang.Object
quadbase.ChartAPI.DbData
- All Implemented Interfaces:
IResultSet,IRow
This class provides an implementation for the @link quadbase.util.IResultSet interface using an
array of data. IResultSet is used to provide input data to a chart. DbData holds the data
information necessary to plot a chart. They are (i) data type for each column (ii) name for each
column (iii) a list of data records
A simple example of a DbData object would be follows :
-
String[] dataTypes = {"String", "int"};
String[] colNames = {"Column A", "Column B"};
String[][] records = {{"abc", "5"}, {"def", "9"}, {"ghi", "4"}};
DbData data = new DbData(dataTypes, colnames, records);
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs DbData by parsing the data value argument in HTML page. The format for the String is the same as the data file format, except that each line is ended by a vertical bar "|".Constructs a new DbData classConstructs a new DbData classDbData(quadbase.chart.ColData[] colData) Constructs DbData using instance of ColData. -
Method Summary
Modifier and TypeMethodDescriptionfinal voidclose()Closes the cursorquadbase.chart.ColData[]This is for internal use onlyObject[][]getData()Gets the record data, field j of record i is stored in position [i][j] of the result as an Object of that type.String[]Deprecated.Please use the getMetaData method to obtain this informationint[]Deprecated.Please use the getMetaData method to obtain this informationfinal IRSMetaDataGets the meta data objectfinal ObjectgetObject(int col) Returns the data value stored in the specified column of this row.final booleannext()Advances cursor to next row
-
Constructor Details
-
DbData
public DbData(String[] dataType, String[] fieldName, String[][] records) throws IllegalArgumentException Constructs a new DbData class- Parameters:
dataType- an array of dataType specify by String. The following are valid data type recognize by the class.
integer : "int", "integer", "smallint", tinyint" or "short"
long : "long", "bigint"
numeric : "numeric"
decimal : "decimal"
float : "float", "real"
double : "double"
time : "time"
date : "date"
timestamp : "timestamp"
varchar : "string", "varchar"
longvarchar : "longvarchar"
boolean : "boolean", "logical", "bit"
Data type names are case insensitive.fieldName- an array of name for each field in the recordrecords- array of record, record[i] consists of array of size n where n = size of dataType = size of fieldName. Each field j in i, i.e. record[i][j] represent the data pass as string. The class will convert the string to appropriate data type. For null field value use set record to null If there is a size mismatch or invalid record entry that can't convert to destination data type, an IllegalArgumentException is thrown.- Throws:
IllegalArgumentException
-
DbData
Constructs a new DbData class- Parameters:
fieldName- an array of field name for data columnrecords- an array of records. Each field in the record is an instance of destination type. If there is a size mismatch or the data in the records is not an instance of type known by the class, an IllegalArgumentException is thrown.- Throws:
IllegalArgumentException
-
DbData
public DbData(quadbase.chart.ColData[] colData) Constructs DbData using instance of ColData. (For internal use only).- Parameters:
colData- array of ColData
-
DbData
Constructs DbData by parsing the data value argument in HTML page. The format for the String is the same as the data file format, except that each line is ended by a vertical bar "|".- Parameters:
s- string value from the HTML page- Throws:
IllegalArgumentException
-
-
Method Details
-
getColData
public quadbase.chart.ColData[] getColData()This is for internal use only -
getFieldName
Deprecated.Please use the getMetaData method to obtain this informationGets the field names for the data store in this class.- Returns:
- an array of field name
-
getFieldType
Deprecated.Please use the getMetaData method to obtain this informationGets the field data type for the data store in this class.- Returns:
- an array of integer represent the field data type. The integer is defined in jdbc/Types.class
-
getData
Gets the record data, field j of record i is stored in position [i][j] of the result as an Object of that type.- Returns:
- 2D array of record data.
-
next
Description copied from interface:IResultSetAdvances cursor to next row- Specified by:
nextin interfaceIResultSet- Throws:
Exception
-
close
Description copied from interface:IResultSetCloses the cursor- Specified by:
closein interfaceIResultSet- Throws:
Exception
-
getMetaData
Description copied from interface:IResultSetGets the meta data object- Specified by:
getMetaDatain interfaceIResultSet- Throws:
Exception
-
getObject
Description copied from interface:IRowReturns the data value stored in the specified column of this row.
-