﻿LeadingMIS.ValueType.SQL = function(){}

LeadingMIS.ValueType.SQL.isChar = function(expression,maxTemp)
{
	if(LeadingMIS.ValueType.isInt(maxTemp,0,8000) == false)
	{
		LeadingMIS.Error.setInfo(0,this.isChar,"输入参数[maxTemp]超出范围","LeadingMIS.ValueType.SQL.isChar","");
		return false;
	}
	else
	{
		if(expression.getByteLength() > maxTemp)
		{
		
		//	LeadingMIS.Error.setInfo(0,this.isChar,"超出最大长度","LeadingMIS.ValueType.SQL.isChar","");
		    LeadingMIS.Error.setInfo(0,this.isChar,"超出最大"+maxTemp+"个字符长度（注：中文一个字占2个字符）","LeadingMIS.ValueType.SQL.isChar","");//mnz2006.8.30
			
			return false;
		}
		else
		{
			return true;
		}
	}
}

LeadingMIS.ValueType.SQL.isVarChar = function(expression,maxTemp)
{
	return LeadingMIS.ValueType.SQL.isChar(expression,maxTemp);
}

LeadingMIS.ValueType.SQL.isNChar = function(expression,maxTemp)
{
	if(LeadingMIS.ValueType.isInt(maxTemp,0,4000) == false)
	{
		LeadingMIS.Error.setInfo(0,this.isNChar,"输入参数[maxTemp]超出范围","LeadingMIS.ValueType.SQL.isNChar","");
		return false;
	}
	else
	{
		if(expression.length > maxTemp)
		{
			LeadingMIS.Error.setInfo(0,this.isNChar,"超出最大长度","LeadingMIS.ValueType.SQL.isNChar","");
			return false;
		}
		else
		{
			return true;
		}
	}
}

LeadingMIS.ValueType.SQL.isNVarChar = function(expression,maxTemp)
{
	return LeadingMIS.ValueType.SQL.isNChar(expression,maxTemp);
}

LeadingMIS.ValueType.SQL.isBigInt = function(expression)
{
	return LeadingMIS.ValueType.isInt64(expression);
}

LeadingMIS.ValueType.SQL.isInt = function(expression)
{
	return LeadingMIS.ValueType.isInt32(expression);
}

LeadingMIS.ValueType.SQL.isSmallInt = function(expression)
{
	return LeadingMIS.ValueType.isInt16(expression);
}

LeadingMIS.ValueType.SQL.isTinyInt = function(expression)
{
	return LeadingMIS.ValueType.isUInt8(expression);
}

LeadingMIS.ValueType.SQL.isDecimal = function(expression,maxTemp,decimalTemp)
{
	return LeadingMIS.ValueType.isDecimal(expression,maxTemp,decimalTemp);
}

LeadingMIS.ValueType.SQL.isNumeric = function(expression,maxTemp,decimalTemp)
{
	return LeadingMIS.ValueType.isDecimal(expression,maxTemp,decimalTemp);
}

LeadingMIS.ValueType.SQL.isFloat = function(expression)
{
	return LeadingMIS.ValueType.isDouble(expression);
}

LeadingMIS.ValueType.SQL.isReal = function(expression)
{
	return LeadingMIS.ValueType.isReal(expression);
}

LeadingMIS.ValueType.SQL.isMoney = function(expression)
{
	return LeadingMIS.ValueType.isDecimal(expression,19,4);
}

LeadingMIS.ValueType.SQL.isSmallMoney = function(expression)
{
	return LeadingMIS.ValueType.isDecimal(expression,10,4);
}

LeadingMIS.ValueType.SQL.isBit = function(expression)
{
	if(typeof(expression) != "number")
	{
	//	LeadingMIS.Error.setInfo(0,this.isBit,"输入参数[expression]必须是数字","LeadingMIS.ValueType.SQL.isBit","");
		LeadingMIS.Error.setInfo(0,this.isBit,"应该是数字","LeadingMIS.ValueType.SQL.isBit","");
		return false;
	}
	else
	{
		return true;
	}
}

LeadingMIS.ValueType.SQL.isDateTime = function(expression)
{
	return LeadingMIS.ValueType.isDateTime(expression,"1753-01-01","9999-12-31");
}

LeadingMIS.ValueType.SQL.isSmallDateTime = function(expression)
{
	return LeadingMIS.ValueType.isDateTime(expression,"1900-01-01","2079-06-06");
}
