# $Header: /home/cvsroot/tcldb/ucodb/Tlib/getType,v 1.6 2000/01/13 19:59:35 de Exp $
# tcl procs saved on Sun Sep 03 16:18:53 PDT 1995

proc getType type {



#       Possible types:
#       char varchar text int float money date smallint tinyint smallmoney
#       smalldate (ugh) real binary varbinary image bit timestamp sysname
#
#       so gee, how to encode these.
#       basically they fall into Ints Floats and Strings, where Dates get
#       treated like Strings.  Then there is another category called Not,
#       which is the types we cannot handle.  So I F S N where
#       *date* is S
#       *char* is S
#       *int* is I
#       float/real/money/smallmoney is F
#	numeric is I
#       text binary varbinary bit image timestamp sysname are N

	if {[string first "date" $type] >= 0} {
		return "S"
	}
	if {[string first "abstime" $type] >= 0} {
		return "S"
	}
	if {[string first "int" $type] >= 0} {
		return "I"
	}
	if {[string first "numeric" $type] >= 0} {
		return "I"
	}
	if {[string first "char" $type] >= 0} {
		return "S"
	}
	if {[string first "float" $type] >= 0} {
		return "F"
	}
	if {[string first "real" $type] >= 0} {
		return "F"
	}
	if {[string first "money" $type] >= 0} {
		return "F"
	}
	set baddies [list binary varbinary text bit image timestamp sysname]
	if {[lsearch $baddies $type] >= 0} {
		return "N"
	}

#       well, we're out of legitimate possibilities, so
#	if we haven't matched it by now, it's Unknown
	return "U"

}

