Search in sources :

Example 1 with InMemoryResultSetMetaData

use of com.teradata.jaqy.resultset.InMemoryResultSetMetaData in project jaqy by Teradata.

the class ProjectColumnList method bind.

public void bind(JaqyResultSet rs, JaqyInterpreter interpreter) throws SQLException {
    int numCols = m_columnList.size();
    ExpNode[] exps = new ExpNode[numCols];
    FullColumnInfo[] columnInfos = new FullColumnInfo[numCols];
    ResultSetMetaData rsmd = rs.getMetaData().getMetaData();
    JaqyHelper helper = rs.getHelper();
    for (int i = 0; i < numCols; ++i) {
        ProjectColumn column = m_columnList.get(i);
        int index = rs.findColumn(column.name);
        columnInfos[i] = ResultSetMetaDataUtils.getColumnInfo(rsmd, index, helper);
        columnInfos[i].name = column.asName;
        columnInfos[i].label = column.asName;
        ColumnNode exp = new ColumnNode(column.name);
        exp.bind(rs, null, interpreter);
        exps[i] = exp;
    }
    m_project = new ExpNodeProject(exps);
    m_meta = new JaqyResultSetMetaData(new InMemoryResultSetMetaData(columnInfos), DummyHelper.getInstance());
}
Also used : InMemoryResultSetMetaData(com.teradata.jaqy.resultset.InMemoryResultSetMetaData) ResultSetMetaData(java.sql.ResultSetMetaData) JaqyResultSetMetaData(com.teradata.jaqy.connection.JaqyResultSetMetaData) FullColumnInfo(com.teradata.jaqy.schema.FullColumnInfo) JaqyHelper(com.teradata.jaqy.interfaces.JaqyHelper) JaqyResultSetMetaData(com.teradata.jaqy.connection.JaqyResultSetMetaData) ColumnNode(com.teradata.jaqy.utils.exp.ColumnNode) ExpNode(com.teradata.jaqy.utils.exp.ExpNode) InMemoryResultSetMetaData(com.teradata.jaqy.resultset.InMemoryResultSetMetaData)

Example 2 with InMemoryResultSetMetaData

use of com.teradata.jaqy.resultset.InMemoryResultSetMetaData in project jaqy by Teradata.

the class ResultSetMetaDataUtils method copyResultSetMetaData.

public static InMemoryResultSetMetaData copyResultSetMetaData(PropertyTable pt) {
    String[] titles = pt.getTitles();
    int columnCount = titles.length;
    FullColumnInfo[] columnInfos = new FullColumnInfo[columnCount];
    int[] lengths = pt.getLengths();
    for (int i = 0; i < columnCount; ++i) {
        FullColumnInfo columnInfo = new FullColumnInfo();
        columnInfos[i] = columnInfo;
        columnInfo.autoIncrement = false;
        columnInfo.caseSensitive = false;
        columnInfo.searchable = false;
        columnInfo.currency = false;
        columnInfo.nullable = ResultSetMetaData.columnNullable;
        columnInfo.signed = false;
        columnInfo.displaySize = lengths[i];
        columnInfo.label = titles[i];
        columnInfo.name = titles[i];
        columnInfo.schemaName = null;
        columnInfo.precision = 0;
        columnInfo.scale = 0;
        columnInfo.tableName = null;
        columnInfo.catalogName = null;
        columnInfo.type = Types.VARCHAR;
        columnInfo.typeName = "VARCHAR";
        columnInfo.readOnly = true;
        columnInfo.writable = false;
        columnInfo.definitelyWritable = false;
        columnInfo.className = "java.lang.String";
    }
    return new InMemoryResultSetMetaData(columnInfos);
}
Also used : FullColumnInfo(com.teradata.jaqy.schema.FullColumnInfo) InMemoryResultSetMetaData(com.teradata.jaqy.resultset.InMemoryResultSetMetaData)

Aggregations

InMemoryResultSetMetaData (com.teradata.jaqy.resultset.InMemoryResultSetMetaData)2 FullColumnInfo (com.teradata.jaqy.schema.FullColumnInfo)2 JaqyResultSetMetaData (com.teradata.jaqy.connection.JaqyResultSetMetaData)1 JaqyHelper (com.teradata.jaqy.interfaces.JaqyHelper)1 ColumnNode (com.teradata.jaqy.utils.exp.ColumnNode)1 ExpNode (com.teradata.jaqy.utils.exp.ExpNode)1 ResultSetMetaData (java.sql.ResultSetMetaData)1