金蝶系統(tǒng)存儲過程-金蝶商貿(mào)標(biāo)準(zhǔn)版6.1
發(fā)布時間:2024/8/9 18:52:29 作者:Admin 閱讀:39
廣告:
金蝶系統(tǒng)存儲過程-金蝶商貿(mào)標(biāo)準(zhǔn)版6.1 ----create GO 金蝶商貿(mào)標(biāo)準(zhǔn)版6.1 GO /****** Object: StoredProcedure [dbo].[dt_addtosourcecontrol] Script Date: 08/09/2024 17:13:06 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create proc [dbo].[dt_addtosourcecontrol] @vchSourceSafeINI varchar(255) = '', @vchProjectName varchar(255) ='', @vchComment varchar(255) ='', @vchLoginName varchar(255) ='', @vchPassword varchar(255) ='' as set nocount on declare @iReturn int declare @iObjectId int select @iObjectId = 0 declare @iStreamObjectId int select @iStreamObjectId = 0 declare @VSSGUID varchar(100) select @VSSGUID = 'SQLVersionControl.VCS_SQL' declare @vchDatabaseName varchar(255) select @vchDatabaseName = db_name() declare @iReturnValue int select @iReturnValue = 0 declare @iPropertyObjectId int declare @vchParentId varchar(255) declare @iObjectCount int select @iObjectCount = 0 exec @iReturn = master.dbo.sp_OACreate @VSSGUID, @iObjectId OUT if @iReturn <> 0 GOTO E_OAError /* Create Project in SS */ exec @iReturn = master.dbo.sp_OAMethod @iObjectId, 'AddProjectToSourceSafe', NULL, @vchSourceSafeINI, @vchProjectName output, @@SERVERNAME, @vchDatabaseName, @vchLoginName, @vchPassword, @vchComment if @iReturn <> 0 GOTO E_OAError /* Set Database Properties */ begin tran SetProperties /* add high level object */ exec @iPropertyObjectId = dbo.dt_adduserobject_vcs 'VCSProjectID' select @vchParentId = CONVERT(varchar(255),@iPropertyObjectId) exec dbo.dt_setpropertybyid @iPropertyObjectId, 'VCSProjectID', @vchParentId , NULL exec dbo.dt_setpropertybyid @iPropertyObjectId, 'VCSProject' , @vchProjectName , NULL exec dbo.dt_setpropertybyid @iPropertyObjectId, 'VCSSourceSafeINI' , @vchSourceSafeINI , NULL exec dbo.dt_setpropertybyid @iPropertyObjectId, 'VCSSQLServer', @@SERVERNAME, NULL exec dbo.dt_setpropertybyid @iPropertyObjectId, 'VCSSQLDatabase', @vchDatabaseName, NULL if @@error <> 0 GOTO E_General_Error commit tran SetProperties select @iObjectCount = 0; CleanUp: select @vchProjectName select @iObjectCount return E_General_Error: /* this is an all or nothing. No specific error messages */ goto CleanUp E_OAError: exec dbo.dt_displayoaerror @iObjectId, @iReturn goto CleanUp go GO /****** Object: StoredProcedure [dbo].[dt_addtosourcecontrol_u] Script Date: 08/09/2024 17:16:05 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create proc [dbo].[dt_addtosourcecontrol_u] @vchSourceSafeINI nvarchar(255) = '', @vchProjectName nvarchar(255) ='', @vchComment nvarchar(255) ='', @vchLoginName nvarchar(255) ='', @vchPassword nvarchar(255) ='' as -- This procedure should no longer be called; dt_addtosourcecontrol should be called instead. -- Calls are forwarded to dt_addtosourcecontrol to maintain backward compatibility set nocount on exec dbo.dt_addtosourcecontrol @vchSourceSafeINI, @vchProjectName, @vchComment, @vchLoginName, @vchPassword go GO /****** Object: StoredProcedure [dbo].[dt_adduserobject] Script Date: 08/09/2024 17:17:03 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO /* ** Add an object to the dtproperties table */ create procedure [dbo].[dt_adduserobject] as set nocount on /* ** Create the user object if it does not exist already */ begin transaction insert dbo.dtproperties (property) VALUES ('DtgSchemaOBJECT') update dbo.dtproperties set objectid=@@identity where id=@@identity and property='DtgSchemaOBJECT' commit return @@identity go GO /****** Object: StoredProcedure [dbo].[dt_adduserobject_vcs] Script Date: 08/09/2024 17:18:49 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create procedure [dbo].[dt_adduserobject_vcs] @vchProperty varchar(64) as set nocount on declare @iReturn int /* ** Create the user object if it does not exist already */ begin transaction select @iReturn = objectid from dbo.dtproperties where property = @vchProperty if @iReturn IS NULL begin insert dbo.dtproperties (property) VALUES (@vchProperty) update dbo.dtproperties set objectid=@@identity where id=@@identity and property=@vchProperty select @iReturn = @@identity end commit return @iReturn go GO /****** Object: StoredProcedure [dbo].[dt_checkinobject] Script Date: 08/09/2024 17:19:29 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create proc [dbo].[dt_checkinobject] @chObjectType char(4), @vchObjectName varchar(255), @vchComment varchar(255)='', @vchLoginName varchar(255), @vchPassword varchar(255)='', @iVCSFlags int = 0, @iActionFlag int = 0, /* 0 => AddFile, 1 => CheckIn */ @txStream1 Text = '', /* drop stream */ /* There is a bug that if items are NULL they do not pass to OLE servers */ @txStream2 Text = '', /* create stream */ @txStream3 Text = '' /* grant stream */ as set nocount on declare @iReturn int declare @iObjectId int select @iObjectId = 0 declare @iStreamObjectId int declare @VSSGUID varchar(100) select @VSSGUID = 'SQLVersionControl.VCS_SQL' declare @iPropertyObjectId int select @iPropertyObjectId = 0 select @iPropertyObjectId = (select objectid from dbo.dtproperties where property = 'VCSProjectID') declare @vchProjectName varchar(255) declare @vchSourceSafeINI varchar(255) declare @vchServerName varchar(255) declare @vchDatabaseName varchar(255) declare @iReturnValue int declare @pos int declare @vchProcLinePiece varchar(255) exec dbo.dt_getpropertiesbyid_vcs @iPropertyObjectId, 'VCSProject', @vchProjectName OUT exec dbo.dt_getpropertiesbyid_vcs @iPropertyObjectId, 'VCSSourceSafeINI', @vchSourceSafeINI OUT exec dbo.dt_getpropertiesbyid_vcs @iPropertyObjectId, 'VCSSQLServer', @vchServerName OUT exec dbo.dt_getpropertiesbyid_vcs @iPropertyObjectId, 'VCSSQLDatabase', @vchDatabaseName OUT if @chObjectType = 'PROC' begin if @iActionFlag = 1 begin /* Procedure Can have up to three streams Drop Stream, Create Stream, GRANT stream */ begin tran compile_all /* try to compile the streams */ exec (@txStream1) if @@error <> 0 GOTO E_Compile_Fail exec (@txStream2) if @@error <> 0 GOTO E_Compile_Fail exec (@txStream3) if @@error <> 0 GOTO E_Compile_Fail end exec @iReturn = master.dbo.sp_OACreate @VSSGUID, @iObjectId OUT if @iReturn <> 0 GOTO E_OAError exec @iReturn = master.dbo.sp_OAGetProperty @iObjectId, 'GetStreamObject', @iStreamObjectId OUT if @iReturn <> 0 GOTO E_OAError if @iActionFlag = 1 begin declare @iStreamLength int select @pos=1 select @iStreamLength = datalength(@txStream2) if @iStreamLength > 0 begin while @pos < @iStreamLength begin select @vchProcLinePiece = substring(@txStream2, @pos, 255) exec @iReturn = master.dbo.sp_OAMethod @iStreamObjectId, 'AddStream', @iReturnValue OUT, @vchProcLinePiece if @iReturn <> 0 GOTO E_OAError select @pos = @pos + 255 end exec @iReturn = master.dbo.sp_OAMethod @iObjectId, 'CheckIn_StoredProcedure', NULL, @sProjectName = @vchProjectName, @sSourceSafeINI = @vchSourceSafeINI, @sServerName = @vchServerName, @sDatabaseName = @vchDatabaseName, @sObjectName = @vchObjectName, @sComment = @vchComment, @sLoginName = @vchLoginName, @sPassword = @vchPassword, @iVCSFlags = @iVCSFlags, @iActionFlag = @iActionFlag, @sStream = '' end end else begin select colid, text into #ProcLines from syscomments where id = object_id(@vchObjectName) order by colid declare @iCurProcLine int declare @iProcLines int select @iCurProcLine = 1 select @iProcLines = (select count(*) from #ProcLines) while @iCurProcLine <= @iProcLines begin select @pos = 1 declare @iCurLineSize int select @iCurLineSize = len((select text from #ProcLines where colid = @iCurProcLine)) while @pos <= @iCurLineSize begin select @vchProcLinePiece = convert(varchar(255), substring((select text from #ProcLines where colid = @iCurProcLine), @pos, 255 )) exec @iReturn = master.dbo.sp_OAMethod @iStreamObjectId, 'AddStream', @iReturnValue OUT, @vchProcLinePiece if @iReturn <> 0 GOTO E_OAError select @pos = @pos + 255 end select @iCurProcLine = @iCurProcLine + 1 end drop table #ProcLines exec @iReturn = master.dbo.sp_OAMethod @iObjectId, 'CheckIn_StoredProcedure', NULL, @sProjectName = @vchProjectName, @sSourceSafeINI = @vchSourceSafeINI, @sServerName = @vchServerName, @sDatabaseName = @vchDatabaseName, @sObjectName = @vchObjectName, @sComment = @vchComment, @sLoginName = @vchLoginName, @sPassword = @vchPassword, @iVCSFlags = @iVCSFlags, @iActionFlag = @iActionFlag, @sStream = '' end if @iReturn <> 0 GOTO E_OAError if @iActionFlag = 1 begin commit tran compile_all if @@error <> 0 GOTO E_Compile_Fail end end CleanUp: return E_Compile_Fail: declare @lerror int select @lerror = @@error rollback tran compile_all RAISERROR (@lerror,16,-1) goto CleanUp E_OAError: if @iActionFlag = 1 rollback tran compile_all exec dbo.dt_displayoaerror @iObjectId, @iReturn goto CleanUp go GO /****** Object: StoredProcedure [dbo].[dt_checkinobject_u] Script Date: 08/09/2024 17:20:39 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create proc [dbo].[dt_checkinobject_u] @chObjectType char(4), @vchObjectName nvarchar(255), @vchComment nvarchar(255)='', @vchLoginName nvarchar(255), @vchPassword nvarchar(255)='', @iVCSFlags int = 0, @iActionFlag int = 0, /* 0 => AddFile, 1 => CheckIn */ @txStream1 text = '', /* drop stream */ /* There is a bug that if items are NULL they do not pass to OLE servers */ @txStream2 text = '', /* create stream */ @txStream3 text = '' /* grant stream */ as -- This procedure should no longer be called; dt_checkinobject should be called instead. -- Calls are forwarded to dt_checkinobject to maintain backward compatibility. set nocount on exec dbo.dt_checkinobject @chObjectType, @vchObjectName, @vchComment, @vchLoginName, @vchPassword, @iVCSFlags, @iActionFlag, @txStream1, @txStream2, @txStream3 go GO /****** Object: StoredProcedure [dbo].[dt_checkoutobject] Script Date: 08/09/2024 17:21:24 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create proc [dbo].[dt_checkoutobject] @chObjectType char(4), @vchObjectName varchar(255), @vchComment varchar(255), @vchLoginName varchar(255), @vchPassword varchar(255), @iVCSFlags int = 0, @iActionFlag int = 0/* 0 => Checkout, 1 => GetLatest, 2 => UndoCheckOut */ as set nocount on declare @iReturn int declare @iObjectId int select @iObjectId =0 declare @VSSGUID varchar(100) select @VSSGUID = 'SQLVersionControl.VCS_SQL' declare @iReturnValue int select @iReturnValue = 0 declare @vchTempText varchar(255) /* this is for our strings */ declare @iStreamObjectId int select @iStreamObjectId = 0 declare @iPropertyObjectId int select @iPropertyObjectId = (select objectid from dbo.dtproperties where property = 'VCSProjectID') declare @vchProjectName varchar(255) declare @vchSourceSafeINI varchar(255) declare @vchServerName varchar(255) declare @vchDatabaseName varchar(255) exec dbo.dt_getpropertiesbyid_vcs @iPropertyObjectId, 'VCSProject', @vchProjectName OUT exec dbo.dt_getpropertiesbyid_vcs @iPropertyObjectId, 'VCSSourceSafeINI', @vchSourceSafeINI OUT exec dbo.dt_getpropertiesbyid_vcs @iPropertyObjectId, 'VCSSQLServer', @vchServerName OUT exec dbo.dt_getpropertiesbyid_vcs @iPropertyObjectId, 'VCSSQLDatabase', @vchDatabaseName OUT if @chObjectType = 'PROC' begin /* Procedure Can have up to three streams Drop Stream, Create Stream, GRANT stream */ exec @iReturn = master.dbo.sp_OACreate @VSSGUID, @iObjectId OUT if @iReturn <> 0 GOTO E_OAError exec @iReturn = master.dbo.sp_OAMethod @iObjectId, 'CheckOut_StoredProcedure', NULL, @sProjectName = @vchProjectName, @sSourceSafeINI = @vchSourceSafeINI, @sObjectName = @vchObjectName, @sServerName = @vchServerName, @sDatabaseName = @vchDatabaseName, @sComment = @vchComment, @sLoginName = @vchLoginName, @sPassword = @vchPassword, @iVCSFlags = @iVCSFlags, @iActionFlag = @iActionFlag if @iReturn <> 0 GOTO E_OAError exec @iReturn = master.dbo.sp_OAGetProperty @iObjectId, 'GetStreamObject', @iStreamObjectId OUT if @iReturn <> 0 GOTO E_OAError create table #commenttext (id int identity, sourcecode varchar(255)) select @vchTempText = 'STUB' while @vchTempText is not null begin exec @iReturn = master.dbo.sp_OAMethod @iStreamObjectId, 'GetStream', @iReturnValue OUT, @vchTempText OUT if @iReturn <> 0 GOTO E_OAError if (@vchTempText = '') set @vchTempText = null if (@vchTempText is not null) insert into #commenttext (sourcecode) select @vchTempText end select 'VCS'=sourcecode from #commenttext order by id select 'SQL'=text from syscomments where id = object_id(@vchObjectName) order by colid end CleanUp: return E_OAError: exec dbo.dt_displayoaerror @iObjectId, @iReturn GOTO CleanUp go GO /****** Object: StoredProcedure [dbo].[dt_checkoutobject_u] Script Date: 08/09/2024 17:21:47 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create proc [dbo].[dt_checkoutobject_u] @chObjectType char(4), @vchObjectName nvarchar(255), @vchComment nvarchar(255), @vchLoginName nvarchar(255), @vchPassword nvarchar(255), @iVCSFlags int = 0, @iActionFlag int = 0/* 0 => Checkout, 1 => GetLatest, 2 => UndoCheckOut */ as -- This procedure should no longer be called; dt_checkoutobject should be called instead. -- Calls are forwarded to dt_checkoutobject to maintain backward compatibility. set nocount on exec dbo.dt_checkoutobject @chObjectType, @vchObjectName, @vchComment, @vchLoginName, @vchPassword, @iVCSFlags, @iActionFlag go GO /****** Object: StoredProcedure [dbo].[dt_displayoaerror] Script Date: 08/09/2024 17:23:17 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create PROCEDURE [dbo].[dt_displayoaerror] @iObject int, @iresult int as set nocount on declare @vchOutput varchar(255) declare @hr int declare @vchSource varchar(255) declare @vchDescription varchar(255) exec @hr = master.dbo.sp_OAGetErrorInfo @iObject, @vchSource OUT, @vchDescription OUT select @vchOutput = @vchSource + ': ' + @vchDescription raiserror (@vchOutput,16,-1) return go GO /****** Object: StoredProcedure [dbo].[dt_displayoaerror_u] Script Date: 08/09/2024 17:24:42 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create PROCEDURE [dbo].[dt_displayoaerror_u] @iObject int, @iresult int as -- This procedure should no longer be called; dt_displayoaerror should be called instead. -- Calls are forwarded to dt_displayoaerror to maintain backward compatibility. set nocount on exec dbo.dt_displayoaerror @iObject, @iresult go GO /****** Object: StoredProcedure [dbo].[dt_droppropertiesbyid] Script Date: 08/09/2024 17:25:11 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO /* ** Drop one or all the associated properties of an object or an attribute ** ** dt_dropproperties objid, null or '' -- drop all properties of the object itself ** dt_dropproperties objid, property -- drop the property */ create procedure [dbo].[dt_droppropertiesbyid] @id int, @property varchar(64) as set nocount on if (@property is null) or (@property = '') delete from dbo.dtproperties where objectid=@id else delete from dbo.dtproperties where objectid=@id and property=@property go GO /****** Object: StoredProcedure [dbo].[dt_dropuserobjectbyid] Script Date: 08/09/2024 17:25:35 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO /* ** Drop an object from the dbo.dtproperties table */ create procedure [dbo].[dt_dropuserobjectbyid] @id int as set nocount on delete from dbo.dtproperties where objectid=@id go GO /****** Object: StoredProcedure [dbo].[dt_generateansiname] Script Date: 08/09/2024 17:26:00 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO /* ** Generate an ansi name that is unique in the dtproperties.value column */ create procedure [dbo].[dt_generateansiname](@name varchar(255) output) as declare @prologue varchar(20) declare @indexstring varchar(20) declare @index integer set @prologue = 'MSDT-A-' set @index = 1 while 1 = 1 begin set @indexstring = cast(@index as varchar(20)) set @name = @prologue + @indexstring if not exists (select value from dtproperties where value = @name) break set @index = @index + 1 if (@index = 10000) goto TooMany end Leave: return TooMany: set @name = 'DIAGRAM' goto Leave go GO /****** Object: StoredProcedure [dbo].[dt_getobjwithprop] Script Date: 08/09/2024 17:26:23 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO /* ** Retrieve the owner object(s) of a given property */ create procedure [dbo].[dt_getobjwithprop] @property varchar(30), @value varchar(255) as set nocount on if (@property is null) or (@property = '') begin raiserror('Must specify a property name.',-1,-1) return (1) end if (@value is null) select objectid id from dbo.dtproperties where property=@property else select objectid id from dbo.dtproperties where property=@property and value=@value go GO /****** Object: StoredProcedure [dbo].[dt_getobjwithprop_u] Script Date: 08/09/2024 17:26:43 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO /* ** Retrieve the owner object(s) of a given property */ create procedure [dbo].[dt_getobjwithprop_u] @property varchar(30), @uvalue nvarchar(255) as set nocount on if (@property is null) or (@property = '') begin raiserror('Must specify a property name.',-1,-1) return (1) end if (@uvalue is null) select objectid id from dbo.dtproperties where property=@property else select objectid id from dbo.dtproperties where property=@property and uvalue=@uvalue go GO /****** Object: StoredProcedure [dbo].[dt_getpropertiesbyid] Script Date: 08/09/2024 17:27:17 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO /* ** Retrieve properties by id's ** ** dt_getproperties objid, null or '' -- retrieve all properties of the object itself ** dt_getproperties objid, property -- retrieve the property specified */ create procedure [dbo].[dt_getpropertiesbyid] @id int, @property varchar(64) as set nocount on if (@property is null) or (@property = '') select property, version, value, lvalue from dbo.dtproperties where @id=objectid else select property, version, value, lvalue from dbo.dtproperties where @id=objectid and @property=property go GO /****** Object: StoredProcedure [dbo].[dt_getpropertiesbyid_u] Script Date: 08/09/2024 17:27:38 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO /* ** Retrieve properties by id's ** ** dt_getproperties objid, null or '' -- retrieve all properties of the object itself ** dt_getproperties objid, property -- retrieve the property specified */ create procedure [dbo].[dt_getpropertiesbyid_u] @id int, @property varchar(64) as set nocount on if (@property is null) or (@property = '') select property, version, uvalue, lvalue from dbo.dtproperties where @id=objectid else select property, version, uvalue, lvalue from dbo.dtproperties where @id=objectid and @property=property go GO /****** Object: StoredProcedure [dbo].[dt_getpropertiesbyid_vcs] Script Date: 08/09/2024 17:28:04 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create procedure [dbo].[dt_getpropertiesbyid_vcs] @id int, @property varchar(64), @value varchar(255) = NULL OUT as set nocount on select @value = ( select value from dbo.dtproperties where @id=objectid and @property=property ) go GO /****** Object: StoredProcedure [dbo].[dt_getpropertiesbyid_vcs_u] Script Date: 08/09/2024 17:28:26 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create procedure [dbo].[dt_getpropertiesbyid_vcs_u] @id int, @property varchar(64), @value nvarchar(255) = NULL OUT as -- This procedure should no longer be called; dt_getpropertiesbyid_vcsshould be called instead. -- Calls are forwarded to dt_getpropertiesbyid_vcs to maintain backward compatibility. set nocount on exec dbo.dt_getpropertiesbyid_vcs @id, @property, @value output go GO /****** Object: StoredProcedure [dbo].[dt_isundersourcecontrol] Script Date: 08/09/2024 17:28:50 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create proc [dbo].[dt_isundersourcecontrol] @vchLoginName varchar(255) = '', @vchPassword varchar(255) = '', @iWhoToo int = 0 /* 0 => Just check project; 1 => get list of objs */ as set nocount on declare @iReturn int declare @iObjectId int select @iObjectId = 0 declare @VSSGUID varchar(100) select @VSSGUID = 'SQLVersionControl.VCS_SQL' declare @iReturnValue int select @iReturnValue = 0 declare @iStreamObjectId int select @iStreamObjectId = 0 declare @vchTempText varchar(255) declare @iPropertyObjectId int select @iPropertyObjectId = (select objectid from dbo.dtproperties where property = 'VCSProjectID') declare @vchProjectName varchar(255) declare @vchSourceSafeINI varchar(255) declare @vchServerName varchar(255) declare @vchDatabaseName varchar(255) exec dbo.dt_getpropertiesbyid_vcs @iPropertyObjectId, 'VCSProject', @vchProjectName OUT exec dbo.dt_getpropertiesbyid_vcs @iPropertyObjectId, 'VCSSourceSafeINI', @vchSourceSafeINI OUT exec dbo.dt_getpropertiesbyid_vcs @iPropertyObjectId, 'VCSSQLServer', @vchServerName OUT exec dbo.dt_getpropertiesbyid_vcs @iPropertyObjectId, 'VCSSQLDatabase', @vchDatabaseName OUT if (@vchProjectName = '') set @vchProjectName = null if (@vchSourceSafeINI = '') set @vchSourceSafeINI = null if (@vchServerName = '') set @vchServerName = null if (@vchDatabaseName = '') set @vchDatabaseName = null if (@vchProjectName is null) or (@vchSourceSafeINI is null) or (@vchServerName is null) or (@vchDatabaseName is null) begin RAISERROR('Not Under Source Control',16,-1) return end if @iWhoToo = 1 begin /* Get List of Procs in the project */ exec @iReturn = master.dbo.sp_OACreate @VSSGUID, @iObjectId OUT if @iReturn <> 0 GOTO E_OAError exec @iReturn = master.dbo.sp_OAMethod @iObjectId, 'GetListOfObjects', NULL, @vchProjectName, @vchSourceSafeINI, @vchServerName, @vchDatabaseName, @vchLoginName, @vchPassword if @iReturn <> 0 GOTO E_OAError exec @iReturn = master.dbo.sp_OAGetProperty @iObjectId, 'GetStreamObject', @iStreamObjectId OUT if @iReturn <> 0 GOTO E_OAError create table #ObjectList (id int identity, vchObjectlist varchar(255)) select @vchTempText = 'STUB' while @vchTempText is not null begin exec @iReturn = master.dbo.sp_OAMethod @iStreamObjectId, 'GetStream', @iReturnValue OUT, @vchTempText OUT if @iReturn <> 0 GOTO E_OAError if (@vchTempText = '') set @vchTempText = null if (@vchTempText is not null) insert into #ObjectList (vchObjectlist ) select @vchTempText end select vchObjectlist from #ObjectList order by id end CleanUp: return E_OAError: exec dbo.dt_displayoaerror @iObjectId, @iReturn goto CleanUp go GO /****** Object: StoredProcedure [dbo].[dt_isundersourcecontrol_u] Script Date: 08/09/2024 17:29:19 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create proc [dbo].[dt_isundersourcecontrol_u] @vchLoginName nvarchar(255) = '', @vchPassword nvarchar(255) = '', @iWhoToo int = 0 /* 0 => Just check project; 1 => get list of objs */ as -- This procedure should no longer be called; dt_isundersourcecontrol should be called instead. -- Calls are forwarded to dt_isundersourcecontrol to maintain backward compatibility. set nocount on exec dbo.dt_isundersourcecontrol @vchLoginName, @vchPassword, @iWhoToo go GO /****** Object: StoredProcedure [dbo].[dt_removefromsourcecontrol] Script Date: 08/09/2024 17:29:42 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create procedure [dbo].[dt_removefromsourcecontrol] as set nocount on declare @iPropertyObjectId int select @iPropertyObjectId = (select objectid from dbo.dtproperties where property = 'VCSProjectID') exec dbo.dt_droppropertiesbyid @iPropertyObjectId, null /* -1 is returned by dt_droppopertiesbyid */ if @@error <> 0 and @@error <> -1 return 1 return 0 go GO /****** Object: StoredProcedure [dbo].[dt_setpropertybyid] Script Date: 08/09/2024 17:30:14 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO /* ** If the property already exists, reset the value; otherwise add property ** id -- the id in sysobjects of the object ** property -- the name of the property ** value -- the text value of the property ** lvalue -- the binary value of the property (image) */ create procedure [dbo].[dt_setpropertybyid] @id int, @property varchar(64), @value varchar(255), @lvalue image as set nocount on declare @uvalue nvarchar(255) set @uvalue = convert(nvarchar(255), @value) if exists (select * from dbo.dtproperties where objectid=@id and property=@property) begin -- -- bump the version count for this row as we update it -- update dbo.dtproperties set value=@value, uvalue=@uvalue, lvalue=@lvalue, version=version+1 where objectid=@id and property=@property end else begin -- -- version count is auto-set to 0 on initial insert -- insert dbo.dtproperties (property, objectid, value, uvalue, lvalue) values (@property, @id, @value, @uvalue, @lvalue) end go GO /****** Object: StoredProcedure [dbo].[dt_setpropertybyid_u] Script Date: 08/09/2024 17:30:35 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO /* ** If the property already exists, reset the value; otherwise add property ** id -- the id in sysobjects of the object ** property -- the name of the property ** uvalue -- the text value of the property ** lvalue -- the binary value of the property (image) */ create procedure [dbo].[dt_setpropertybyid_u] @id int, @property varchar(64), @uvalue nvarchar(255), @lvalue image as set nocount on -- -- If we are writing the name property, find the ansi equivalent. -- If there is no lossless translation, generate an ansi name. -- declare @avalue varchar(255) set @avalue = null if (@uvalue is not null) begin if (convert(nvarchar(255), convert(varchar(255), @uvalue)) = @uvalue) begin set @avalue = convert(varchar(255), @uvalue) end else begin if 'DtgSchemaNAME' = @property begin exec dbo.dt_generateansiname @avalue output end end end if exists (select * from dbo.dtproperties where objectid=@id and property=@property) begin -- -- bump the version count for this row as we update it -- update dbo.dtproperties set value=@avalue, uvalue=@uvalue, lvalue=@lvalue, version=version+1 where objectid=@id and property=@property end else begin -- -- version count is auto-set to 0 on initial insert -- insert dbo.dtproperties (property, objectid, value, uvalue, lvalue) values (@property, @id, @avalue, @uvalue, @lvalue) end go GO /****** Object: StoredProcedure [dbo].[dt_validateloginparams] Script Date: 08/09/2024 17:30:57 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create proc [dbo].[dt_validateloginparams] @vchLoginName varchar(255), @vchPassword varchar(255) as set nocount on declare @iReturn int declare @iObjectId int select @iObjectId =0 declare @VSSGUID varchar(100) select @VSSGUID = 'SQLVersionControl.VCS_SQL' declare @iPropertyObjectId int select @iPropertyObjectId = (select objectid from dbo.dtproperties where property = 'VCSProjectID') declare @vchSourceSafeINI varchar(255) exec dbo.dt_getpropertiesbyid_vcs @iPropertyObjectId, 'VCSSourceSafeINI', @vchSourceSafeINI OUT exec @iReturn = master.dbo.sp_OACreate @VSSGUID, @iObjectId OUT if @iReturn <> 0 GOTO E_OAError exec @iReturn = master.dbo.sp_OAMethod @iObjectId, 'ValidateLoginParams', NULL, @sSourceSafeINI = @vchSourceSafeINI, @sLoginName = @vchLoginName, @sPassword = @vchPassword if @iReturn <> 0 GOTO E_OAError CleanUp: return E_OAError: exec dbo.dt_displayoaerror @iObjectId, @iReturn GOTO CleanUp go GO /****** Object: StoredProcedure [dbo].[dt_validateloginparams_u] Script Date: 08/09/2024 17:31:25 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create proc [dbo].[dt_validateloginparams_u] @vchLoginName nvarchar(255), @vchPassword nvarchar(255) as -- This procedure should no longer be called; dt_validateloginparams should be called instead. -- Calls are forwarded to dt_validateloginparams to maintain backward compatibility. set nocount on exec dbo.dt_validateloginparams @vchLoginName, @vchPassword go GO /****** Object: StoredProcedure [dbo].[dt_vcsenabled] Script Date: 08/09/2024 17:32:06 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create proc [dbo].[dt_vcsenabled] as set nocount on declare @iObjectId int select @iObjectId = 0 declare @VSSGUID varchar(100) select @VSSGUID = 'SQLVersionControl.VCS_SQL' declare @iReturn int exec @iReturn = master.dbo.sp_OACreate @VSSGUID, @iObjectId OUT if @iReturn <> 0 raiserror('', 16, -1) /* Can't Load Helper DLLC */ go GO /****** Object: StoredProcedure [dbo].[dt_verstamp006] Script Date: 08/09/2024 17:32:26 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO /* ** This procedure returns the version number of the stored ** procedures used by legacy versions of the Microsoft ** Visual Database Tools. Version is 7.0.00. */ create procedure [dbo].[dt_verstamp006] as select 7000 go GO /****** Object: StoredProcedure [dbo].[dt_verstamp007] Script Date: 08/09/2024 17:32:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO /* ** This procedure returns the version number of the stored ** procedures used by the the Microsoft Visual Database Tools. ** Version is 7.0.05. */ create procedure [dbo].[dt_verstamp007] as select 7005 go GO /****** Object: StoredProcedure [dbo].[dt_whocheckedout] Script Date: 08/09/2024 17:33:12 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create proc [dbo].[dt_whocheckedout] @chObjectType char(4), @vchObjectName varchar(255), @vchLoginName varchar(255), @vchPassword varchar(255) as set nocount on declare @iReturn int declare @iObjectId int select @iObjectId =0 declare @VSSGUID varchar(100) select @VSSGUID = 'SQLVersionControl.VCS_SQL' declare @iPropertyObjectId int select @iPropertyObjectId = (select objectid from dbo.dtproperties where property = 'VCSProjectID') declare @vchProjectName varchar(255) declare @vchSourceSafeINI varchar(255) declare @vchServerName varchar(255) declare @vchDatabaseName varchar(255) exec dbo.dt_getpropertiesbyid_vcs @iPropertyObjectId, 'VCSProject', @vchProjectName OUT exec dbo.dt_getpropertiesbyid_vcs @iPropertyObjectId, 'VCSSourceSafeINI', @vchSourceSafeINI OUT exec dbo.dt_getpropertiesbyid_vcs @iPropertyObjectId, 'VCSSQLServer', @vchServerName OUT exec dbo.dt_getpropertiesbyid_vcs @iPropertyObjectId, 'VCSSQLDatabase', @vchDatabaseName OUT if @chObjectType = 'PROC' begin exec @iReturn = master.dbo.sp_OACreate @VSSGUID, @iObjectId OUT if @iReturn <> 0 GOTO E_OAError declare @vchReturnValue varchar(255) select @vchReturnValue = '' exec @iReturn = master.dbo.sp_OAMethod @iObjectId, 'WhoCheckedOut', @vchReturnValue OUT, @sProjectName = @vchProjectName, @sSourceSafeINI = @vchSourceSafeINI, @sObjectName = @vchObjectName, @sServerName = @vchServerName, @sDatabaseName = @vchDatabaseName, @sLoginName = @vchLoginName, @sPassword = @vchPassword if @iReturn <> 0 GOTO E_OAError select @vchReturnValue end CleanUp: return E_OAError: exec dbo.dt_displayoaerror @iObjectId, @iReturn GOTO CleanUp go GO /****** Object: StoredProcedure [dbo].[dt_whocheckedout_u] Script Date: 08/09/2024 17:33:40 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create proc [dbo].[dt_whocheckedout_u] @chObjectType char(4), @vchObjectName nvarchar(255), @vchLoginName nvarchar(255), @vchPassword nvarchar(255) as -- This procedure should no longer be called; dt_whocheckedout should be called instead. -- Calls are forwarded to dt_whocheckedout to maintain backward compatibility. set nocount on exec dbo.dt_whocheckedout @chObjectType, @vchObjectName, @vchLoginName, @vchPassword go
廣告:
相關(guān)文章