FileDocCategorySizeDatePackage
JDBCResultSetMetaData.javaAPI DocAndroid 1.5 API5955Wed May 06 22:41:06 BST 2009SQLite.JDBC2y

JDBCResultSetMetaData

public class JDBCResultSetMetaData extends Object implements ResultSetMetaData

Fields Summary
private JDBCResultSet
r
Constructors Summary
public JDBCResultSetMetaData(JDBCResultSet r)

    this.r = r;
    
Methods Summary
intfindColByName(java.lang.String columnName)

    String c = null;
    if (r != null && r.tr != null) {
        for (int i = 0; i < r.tr.ncolumns; i++) {
        c = r.tr.column[i];
        if (c != null) {
            if (c.compareToIgnoreCase(columnName) == 0) {
            return i + 1;
            }
            int k = c.indexOf('.");
            if (k > 0) {
            c = c.substring(k + 1);
            if (c.compareToIgnoreCase(columnName) == 0) {
                return i + 1;
            }
            }
        }
        c = null;
        }
    }
    throw new SQLException("column " + columnName + " not found");
    
public java.lang.StringgetCatalogName(int column)

    return null;
    
public java.lang.StringgetColumnClassName(int column)

    column--;
    if (r != null && r.tr != null) {
        if (column < 0 || column >= r.tr.ncolumns) {
        return null;
        }
        if (r.tr instanceof TableResultX) {
        switch (((TableResultX) r.tr).sql_type[column]) {
        case Types.SMALLINT:    return "java.lang.Short";
        case Types.INTEGER:    return "java.lang.Integer";
        case Types.DOUBLE:    return "java.lang.Double";
        case Types.FLOAT:    return "java.lang.Float";
        case Types.BIGINT:    return "java.lang.Long";
        case Types.DATE:    return "java.sql.Date";
        case Types.TIME:    return "java.sql.Time";
        case Types.TIMESTAMP:    return "java.sql.Timestamp";
        case Types.BINARY:
        case Types.VARBINARY:    return "[B";
        /* defaults to varchar below */
        }
        }
        return "java.lang.String";
    }
    return null;
    
public intgetColumnCount()

    if (r != null && r.tr != null) {
        return r.tr.ncolumns;
    }
    return 0;
    
public intgetColumnDisplaySize(int column)

    return 0;
    
public java.lang.StringgetColumnLabel(int column)

    column--;
    String c = null;
    if (r != null && r.tr != null) {
        if (column < 0 || column >= r.tr.ncolumns) {
        return c;
        }
        c = r.tr.column[column];
    }
    return c;
    
public java.lang.StringgetColumnName(int column)

    column--;
    String c = null;
    if (r != null && r.tr != null) {
        if (column < 0 || column >= r.tr.ncolumns) {
        return c;
        }
        c = r.tr.column[column];
        if (c != null) {
        int i = c.indexOf('.");
        if (i > 0) {
            return c.substring(i + 1);
        }
        }
    }
    return c;
    
public intgetColumnType(int column)

    column--;
    if (r != null && r.tr != null) {
        if (column >= 0 && column < r.tr.ncolumns) {
        if (r.tr instanceof TableResultX) {
            return ((TableResultX) r.tr).sql_type[column];
        }
        return Types.VARCHAR;
        }
    }
    throw new SQLException("bad column index");
    
public java.lang.StringgetColumnTypeName(int column)

    column--;
    if (r != null && r.tr != null) {
        if (column >= 0 && column < r.tr.ncolumns) {
        if (r.tr instanceof TableResultX) {
            switch (((TableResultX) r.tr).sql_type[column]) {
            case Types.SMALLINT:    return "smallint";
            case Types.INTEGER:        return "integer";
            case Types.DOUBLE:        return "double";
            case Types.FLOAT:        return "float";
            case Types.BIGINT:        return "bigint";
            case Types.DATE:        return "date";
            case Types.TIME:        return "time";
            case Types.TIMESTAMP:    return "timestamp";
            case Types.BINARY:        return "binary";
            case Types.VARBINARY:    return "varbinary";
            /* defaults to varchar below */
            }
        }
        return "varchar";
        }
    }
    throw new SQLException("bad column index");
    
public intgetPrecision(int column)

    return 0;
    
public intgetScale(int column)

    return 0;
    
public java.lang.StringgetSchemaName(int column)

    return null;
    
public java.lang.StringgetTableName(int column)

    column--;
    String c = null;
    if (r != null && r.tr != null) {
        if (column < 0 || column >= r.tr.ncolumns) {
        return c;
        }
        c = r.tr.column[column];
        if (c != null) {
        int i = c.indexOf('.");
        if (i > 0) {
            return c.substring(0, i);
        }
        c = null;
        }
    }
    return c;
    
public booleanisAutoIncrement(int column)

    return false;
    
public booleanisCaseSensitive(int column)

    return false;
    
public booleanisCurrency(int column)

    return false;
    
public booleanisDefinitelyWritable(int column)

    return true;
    
public intisNullable(int column)

    return columnNullableUnknown;
    
public booleanisReadOnly(int column)

    return false;
    
public booleanisSearchable(int column)

    return true;
    
public booleanisSigned(int column)

    return false;
    
public booleanisWritable(int column)

    return true;