Пример #1
0
 public bool CreateTableStructure()
 {
     //try
     //{
     //    List<String> lstTableName = (List<String>)_databaseService.GetDataListBySQL<string>(new StringBuilder(DBSchemaDefinition.GetTableNameBySpecificValueSQL("DeviceInfo8036")));
     //    if (lstTableName.Count == 0)//数据库中不存在表DeviceInfo8036
     //    {
     //        //"Create table DeviceInfo8036(ID integer not null primary key autoincrement,Code varchar(8),Disable Boolean,LinkageGroup1 varchar(4),LinkageGroup2 varchar(4),AlertValue real,ForcastValue real,DelayValue integer, BuildingNo integer,ZoneNo integer,FloorNo integer,RoomNo integer,Location varchar(20),LoopID integer references Loop(ID) on delete restrict deferrable initially deferred not null,TypeCode integer references DeviceType(Code) on delete restrict deferrable initially deferred not null,unique(Code,LoopID));"
     //        StringBuilder sbDeviceInfoSQL = new StringBuilder();
     //        sbDeviceInfoSQL.Append("Create table DeviceInfo8036");
     //        sbDeviceInfoSQL.Append("(ID integer not null primary key autoincrement,");
     //        sbDeviceInfoSQL.Append("Code varchar(8),");
     //        sbDeviceInfoSQL.Append("Disable Boolean,");
     //        sbDeviceInfoSQL.Append("LinkageGroup1 varchar(4),");
     //        sbDeviceInfoSQL.Append("LinkageGroup2 varchar(4),");
     //        sbDeviceInfoSQL.Append("AlertValue real,");
     //        sbDeviceInfoSQL.Append("ForcastValue real,");
     //        sbDeviceInfoSQL.Append("DelayValue integer,");
     //        sbDeviceInfoSQL.Append("BuildingNo integer,");
     //        sbDeviceInfoSQL.Append("ZoneNo integer,");
     //        sbDeviceInfoSQL.Append("FloorNo integer,");
     //        sbDeviceInfoSQL.Append("RoomNo integer,");
     //        sbDeviceInfoSQL.Append("Location varchar(20),");
     //        sbDeviceInfoSQL.Append("LoopID integer references Loop(ID) on delete restrict deferrable initially deferred not null,");
     //        sbDeviceInfoSQL.Append("TypeCode integer references DeviceType(Code) on delete restrict deferrable initially deferred not null,");
     //        sbDeviceInfoSQL.Append("unique(Code,LoopID));");
     //        _databaseService.ExecuteBySql(sbDeviceInfoSQL);
     //    }
     //}
     //catch
     //{
     //    return false;
     //}
     //return true;
     try
     {
         List <String> lstTableName = _dbFileVersionService.GetTablesOfDB("DeviceInfo8036");
         if (lstTableName.Count == 0)//数据库中不存在表DeviceInfo8036
         {
             _dbFileVersionService.CreateTableForDeviceInfoOfControllerType8036();
         }
     }
     catch
     {
         return(false);
     }
     return(true);
 }