客户端使用的升级程序:
系统升级程序:
数据库结构:
存储过程:
(查询系统的版本信息)
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
--////////////////////////////////////////////////////////////////////////////////////////
--Description : 查询系统的版本信息.
--Created By : Jara 2012/04/27
--Modified By :
--////////////////////////////////////////////////////////////////////////////////////////
ALTER PROCEDURE [dbo].[P$Get_SystemVer]
@SystemID varchar(30),
@SystemSVer varchar(30) OUTPUT,
@ExeFileName varchar(50) OUTPUT
AS
SELECT @SystemID =LTrim(RTrim(@SystemID))
SELECT @SystemSVer=''
SELECT @ExeFileName=LTrim(RTrim([FileName]))
FROM SystemData
WHERE SystemID = @SystemID AND Upper(Right(RTrim([FileName]),4)) = '.EXE'
SELECT @SystemSVer=DBO.F$Get_VerStr(B.VerNo1, B.VerNo2, B.VerNo3, B.VerNo4)
FROM SystemInfo B
WHERE B.SystemID=@SystemID
SELECT X.*
FROM
(
SELECT A.SystemID, A.[FileName], IsNull(A.CommonID,'') AS CommonID,
dbo.F$Get_FilePath('FilePath') + A.SystemID + '//' AS Directory,
DBO.F$Get_VerStr(B.VerNo1, B.VerNo2, B.VerNo3, B.VerNo4) AS VerNo,
Convert(varchar(1),'N') AS UpdateStatus
FROM SystemData A INNER JOIN SystemInfo B ON A.SystemID=B.SystemID
WHERE A.SystemID=@SystemID AND A.CommonID IS NULL
UNION ALL
SELECT A.SystemID, A.[FileName], IsNull(A.CommonID,'') AS CommonID,
dbo.F$Get_FilePath('FilePath') + A.CommonID + '//' AS Directory,
DBO.F$Get_VerStr(B.VerNo1, B.VerNo2, B.VerNo3, B.VerNo4) AS VerNo,
Convert(varchar(1),'N') AS UpdateStatus
FROM SystemData A INNER JOIN CommonDLL B ON A.CommonID=B.CommonID AND A.[FileName] = B.[FileName]
WHERE A.SystemID=@SystemID AND A.CommonID IS NOT NULL
) X ORDER BY X.CommonID, X.[FileName]
(获取共享DLL升级新版本信息)
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
--////////////////////////////////////////////////////////////////////////////////////////
--Description : 获取共享DLL升级新版本信息.
--Created By : JARA 2009/06/02
--Modified By :
--////////////////////////////////////////////////////////////////////////////////////////
ALTER PROC [dbo].[P$NewDLLVer]
@CommonID varchar(30),
@FileName varchar(100)
AS
DECLARE @VerNo1 tinyint,
@VerNo2 tinyint,
@VerNo3 tinyint,
@VerNo4 tinyint,
@VerNo_1 tinyint,
@VerNo_2 tinyint,
@VerNo_3 tinyint,
@VerNo_4 tinyint
SELECT @VerNo1=VerNo1, @VerNo2=VerNo2, @VerNo3=VerNo3, @VerNo4=VerNo4
FROM CommonDLL
WHERE CommonID=@CommonID AND [FileName]=@FileName
SELECT @VerNo_1=VerNo1,@VerNo_2=VerNo2,@VerNo_3=VerNo3,@VerNo_4=VerNo4
FROM dbo.F$Get_NewVer(@VerNo1,@VerNo2,@VerNo3,@VerNo4)
UPDATE CommonDLL SET
VerNo1=@VerNo_1,VerNo2=@VerNo_2,VerNo3=@VerNo_3,VerNo4=@VerNo_4
WHERE CommonID=@CommonID AND [FileName]=@FileName
(获取系统升级新版本信息)
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
--////////////////////////////////////////////////////////////////////////////////////////
--Description : 获取系统升级新版本信息.
--Created By : JARA 2009/06/02
--Modified By :
--////////////////////////////////////////////////////////////////////////////////////////
ALTER PROCEDURE [dbo].[P$NewSystemVer]
@SystemID varchar(30)
AS
DECLARE @VerNo1 tinyint,
@VerNo2 tinyint,
@VerNo3 tinyint,
@VerNo4 tinyint,
@VerNo_1 tinyint,
@VerNo_2 tinyint,
@VerNo_3 tinyint,
@VerNo_4 tinyint
SELECT @VerNo1=VerNo1, @VerNo2=VerNo2, @VerNo3=VerNo3, @VerNo4=VerNo4
FROM SystemInfo
WHERE SystemID=@SystemID
SELECT @VerNo_1=VerNo1,@VerNo_2=VerNo2,@VerNo_3=VerNo3,@VerNo_4=VerNo4
FROM dbo.F$Get_NewVer(@VerNo1,@VerNo2,@VerNo3,@VerNo4)
UPDATE SystemInfo SET
VerNo1=@VerNo_1,VerNo2=@VerNo_2,VerNo3=@VerNo_3,VerNo4=@VerNo_4
WHERE SystemID=@SystemID
SQL函数:
(获取新版本号)
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
--////////////////////////////////////////////////////////////////////////////////////////
--Description : 获取新版本号
--Created By : JARA 2009/06/09
--Modified By :
--////////////////////////////////////////////////////////////////////////////////////////
ALTER FUNCTION [dbo].[F$Get_NewVer](@VerNo1 tinyint,@VerNo2 tinyint,@VerNo3 tinyint,@VerNo4 tinyint)
RETURNS @Ver_Table Table(VerNo1 tinyint,VerNo2 tinyint,VerNo3 tinyint,VerNo4 tinyint)
AS
BEGIN
DECLARE @VerNo_1 tinyint,
@VerNo_2 tinyint,
@VerNo_3 tinyint,
@VerNo_4 tinyint
SELECT @VerNo_4=@VerNo4+1
IF(@VerNo_4>99)
BEGIN
SET @VerNo4=0
SELECT @VerNo_3=@VerNo3+1
IF(@VerNo_3>99)
BEGIN
SET @VerNo3=0
SELECT @VerNo_2=@VerNo2+1
IF(@VerNo_2>99)
BEGIN
SET @VerNo2=0
SELECT @VerNo_1=@VerNo1+1
IF(@VerNo_1<=99)
BEGIN
SELECT @VerNo1=@VerNo_1
END
END
ELSE
BEGIN
SELECT @VerNo2=@VerNo_2
END
END
ELSE
BEGIN
SELECT @VerNo3=@VerNo_3
END
END
ELSE
BEGIN
SELECT @VerNo4=@VerNo_4
END
INSERT INTO @Ver_Table(VerNo1,VerNo2,VerNo3,VerNo4) VALUES(@VerNo1,@VerNo2,@VerNo3,@VerNo4)
RETURN
END
以上即可实现程序的更新和客户端的自动更新。