You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
2.2 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FireBirdUtil.SqlUtils;
namespace WeighBusiness.Utils.SqlUtils
{
public class SqlUtilBase
{
public static bool IsDatabaseExist()
{
return SQLExecuteUtil.IsDatabaseExist(TableNames.);
}
public static bool IsTableExist(string tableName)
{
return SQLExecuteUtil.IsTableExist(TableNames., tableName);
}
}
//对上面查询出的数据,做映射:
//public class DataTypeMapper
//{
// public Type MapFromDBType(string datatype, int? dataLength, int? dataPrecision, int? dataScale, bool nullable)
// {
// var dataType = String.Format(",{0},", datatype.ToLower());
// if (",datetime,smalldatetime,".Contains(dataType)) {
// return nullable ? typeof(DateTime?) : typeof(DateTime);
// }
// if (",bigint,".Contains(dataType)) {
// return nullable ? (typeof(long?)) : typeof(long);
// }
// if (",int,smallint,".Contains(dataType)) {
// return nullable ? (typeof(int?)) : typeof(int);
// }
// if (",float,real,".Contains(dataType)) {
// return nullable ? (typeof(float?)) : typeof(float);
// }
// if (",binary,varbinary,image,timestamp,".Contains(dataType)) {
// return typeof(byte[]);
// }
// if (",bit,".Contains(dataType)) {
// return nullable ? (typeof(bool?)) : typeof(bool);
// }
// if (",decimal,smallmoney,money,numeric,".Contains(dataType)) {
// return nullable ? (typeof(decimal?)) : typeof(decimal);
// }
// if (",uniqueidentifier,".Contains(dataType)) {
// return nullable ? (typeof(Guid?)) : typeof(Guid);
// }
// if (",tinyint,".Contains(dataType)) {
// return nullable ? (typeof(byte?)) : typeof(byte);
// }
// if (",char,varchar,nchar,nvarchar,text,ntext,".Contains(dataType)) {
// return typeof(string);
// }
// if (",xml,".Contains(dataType)) {
// return typeof(System.Xml.XmlDocument);
// }
// throw new Exception(String.Format("DBType: [{0}] can not be mapped.", datatype));
// }
// public bool IsUnicode(string datatype)
// {
// var dataType = String.Format(",{0},", datatype.ToLower());
// return ",nchar,nvarchar,ntext,".Contains(dataType);
// }
//}
}