FileDocCategorySizeDatePackage
MsqlColumn.javaAPI DocExample1297Tue Jan 01 00:00:00 GMT 1980COM.imaginary.sql.msql

MsqlColumn.java

/* Copyright (c) 1997 George Reese */
package COM.imaginary.sql.msql;

import java.sql.Types;

/**
 * This class holds meta information about mSQL columns in a result set.<BR>
 * Last modified 97/04/20
 * @version @(#) MsqlColumn.java 1.3@(#)
 * @author George Reese (borg@imaginary.com)
 */
public class MsqlColumn {
    private String  column_name = null;
    private int     length      = 0;
    private boolean primary_key = false;
    private boolean nullable    = false;
    private String  table_name  = null;
    private int     type        = 0;
    
    MsqlColumn(String col, String table, int typ, int len, boolean n,
	       boolean pk) {
	super();
	column_name = col;
	table_name = table;
	length = len;
	nullable = n;
	primary_key = pk;
	switch( typ ) {
	case 1:
	    type = Types.INTEGER;
	    break;
	    
	case 2:
	    type = Types.CHAR;
	    break;
	    
	case 3:
	    type = Types.REAL;
	    break;
	    
	case 5:
	    type = Types.NULL;
	    break;
	}
    }

    boolean isNullable() {
	return nullable;
    }

    boolean isPrimaryKey() {
	return primary_key;
    }
    
    String getColumnName() {
	return column_name;
    }

    int getLength() {
	return length;
    }

    String getTableName() {
	return table_name;
    }

    int getType() {
       return type;
    }
}