Информационный поток
Задания вакансии материалы разработки сообщения форума
Форум

Обсуждение к контенту: Специализированная конфигурация Autoupdater

    • #1
    • 31.10.2010 10:56
    0
    Ведение журнала регистрации 1С 8.1 в отдельной базе MSSQL.  Подробнее>>
    • #2
    • 19.01.2011 16:21
    0
    Специализированная конфигурация Autoupdater
    • #3
    • 26.06.2011 04:44
    0
    Здорово! Очень полезная обработка.
    • #4
    • 25.07.2011 16:06
    0
    Добрый день, попробовал не платформе 8.2 1С и SQL 2008 запустить Ваш скрипт выскочила следующая ошибка. Что посоветуете? Ошибка выполнения скрипта: if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[_InsertLogData]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[_InsertLogData] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[_UpdateMetadata]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[_UpdateMetadata] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[_APP]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[_APP] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[_EVENTS]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[_EVENTS] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[_MAIN]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[_MAIN] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[_METADATAS]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[_METADATAS] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[_TRANSACTIONS]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[_TRANSACTIONS] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[_USERS]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[_USERS] GO CREATE TABLE [dbo].[_APP] ( [_ID] [smallint] IDENTITY (1, 1) NOT NULL , [_App] [nvarchar] (20) COLLATE Cyrillic_General_CI_AS NOT NULL , [_AppPresentation] [nvarchar] (20) COLLATE Cyrillic_General_CI_AS NOT NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[_EVENTS] ( [_ID] [smallint] IDENTITY (1, 1) NOT NULL , [_Event] [nvarchar] (50) COLLATE Cyrillic_General_CI_AS NOT NULL , [_EventPresentation] [nvarchar] (50) COLLATE Cyrillic_General_CI_AS NOT NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[_MAIN] ( [_Level] [nvarchar] (20) COLLATE Cyrillic_General_CI_AS NOT NULL , [_Date] [datetime] NOT NULL , [_UserUID] [smallint] NOT NULL , [_Host] [nvarchar] (20) COLLATE Cyrillic_General_CI_AS NOT NULL , [_App] [smallint] NOT NULL , [_Connection] [int] NOT NULL , [_Event] [smallint] NOT NULL , [_Comment] [nvarchar] (500) COLLATE Cyrillic_General_CI_AS NOT NULL , [_TransactionID] [nvarchar] (100) COLLATE Cyrillic_General_CI_AS NOT NULL , [_TransactionStatus] [nvarchar] (100) COLLATE Cyrillic_General_CI_AS NOT NULL , [_ServerName] [nvarchar] (20) COLLATE Cyrillic_General_CI_AS NOT NULL , [_Port] [smallint] NOT NULL , [_SyncPort] [smallint] NOT NULL , [_Metadata] [smallint] NOT NULL , [_MDData] [smallint] NOT NULL , [_Data] [int] NOT NULL , [_DataPresentation] [nvarchar] (150) COLLATE Cyrillic_General_CI_AS NOT NULL , [_ClusterName] [nvarchar] (50) COLLATE Cyrillic_General_CI_AS NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[_METADATAS] ( [_ID] [smallint] IDENTITY (1, 1) NOT NULL , [_MetaData] [nvarchar] (150) COLLATE Cyrillic_General_CI_AS NOT NULL , [_MetaDataPresentation] [nvarchar] (150) COLLATE Cyrillic_General_CI_AS NOT NULL , [_TabNum] [smallint] NULL , [_ValueToStringInternal] [nvarchar] (42) COLLATE Cyrillic_General_CI_AS NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[_TRANSACTIONS] ( [_ID] [int] IDENTITY (1, 1) NOT NULL , [_Descr] [char] (20) COLLATE Cyrillic_General_CI_AS NOT NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[_USERS] ( [_ID] [smallint] IDENTITY (1, 1) NOT NULL , [_UserUID] [nvarchar] (50) COLLATE Cyrillic_General_CI_AS NOT NULL ) ON [PRIMARY] GO ALTER TABLE [dbo].[_MAIN] WITH NOCHECK ADD CONSTRAINT [DF__MAIN__Level] DEFAULT ('') FOR [_Level], CONSTRAINT [DF__MAIN__Date] DEFAULT ('01.01.2000') FOR [_Date], CONSTRAINT [DF__MAIN__UserUID] DEFAULT (0) FOR [_UserUID], CONSTRAINT [DF__MAIN__Host] DEFAULT ('') FOR [_Host], CONSTRAINT [DF__MAIN__App] DEFAULT (0) FOR [_App], CONSTRAINT [DF__MAIN__Connection] DEFAULT (0) FOR [_Connection], CONSTRAINT [DF__MAIN__Event] DEFAULT (0) FOR [_Event], CONSTRAINT [DF__MAIN__Comment] DEFAULT ('') FOR [_Comment], CONSTRAINT [DF__MAIN__TransactionID] DEFAULT ('') FOR [_TransactionID], CONSTRAINT [DF__MAIN__TransactionStatus] DEFAULT ('') FOR [_TransactionStatus], CONSTRAINT [DF__MAIN__ServerName] DEFAULT ('') FOR [_ServerName], CONSTRAINT [DF__MAIN__Port] DEFAULT (0) FOR [_Port], CONSTRAINT [DF__MAIN__SyncPort] DEFAULT (0) FOR [_SyncPort], CONSTRAINT [DF__MAIN__Metadata] DEFAULT (0) FOR [_Metadata], CONSTRAINT [DF__MAIN__MDData] DEFAULT (0) FOR [_MDData], CONSTRAINT [DF__MAIN__Data] DEFAULT (0) FOR [_Data], CONSTRAINT [DF__MAIN__DataPresentation] DEFAULT ('') FOR [_DataPresentation], CONSTRAINT [DF__MAIN__ClusterName] DEFAULT ('') FOR [_ClusterName] GO CREATE INDEX [_MAIN_Index_1] ON [dbo].[_MAIN]([_Date] DESC ) WITH FILLFACTOR = 100 ON [PRIMARY] GO CREATE INDEX [_MAIN_Index_2] ON [dbo].[_MAIN]([_UserUID]) WITH FILLFACTOR = 100 ON [PRIMARY] GO CREATE INDEX [_MAIN_Index_3] ON [dbo].[_MAIN]([_Data], [_MDData]) WITH FILLFACTOR = 100 ON [PRIMARY] GO CREATE INDEX [_METADATAS_Index_1] ON [dbo].[_METADATAS]([_MetaData]) WITH FILLFACTOR = 100 ON [PRIMARY] GO CREATE INDEX [_METADATAS_Index_2] ON [dbo].[_METADATAS]([_TabNum]) WITH FILLFACTOR = 100 ON [PRIMARY] GO CREATE UNIQUE INDEX [_DescrTRN] ON [dbo].[_TRANSACTIONS]([_Descr]) WITH FILLFACTOR = 100 ON [PRIMARY] GO CREATE UNIQUE INDEX [_USERS_Index_1] ON [dbo].[_USERS]([_UserUID]) WITH FILLFACTOR = 100 ON [PRIMARY] GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS OFF GO CREATE PROCEDURE _InsertLogData @_Date varchar(20) , @_TransactionStatus Char(1), @_Transaction varchar(50), @_UserUID varchar(36), @_Host varchar(100), @_App varchar(100), @_AppPresentation varchar(200), @_Connection int, @_Event varchar(200), @_EventPresentation varchar(200), @_Level char(1), --Тип события @_Comment nvarchar(500), @_Metadata varchar(200), @_Data nvarchar(42), @_DataPresentation nvarchar(500), @_ServerName varchar(100), @_Port int, @_Syncport int, @_ClusterName varchar(100) AS declare @TransactID int IF (@_TransactionStatus <> 'N') AND (RTRIM(@_Transaction) <> '') BEGIN select @TransactID = _ID from _TRANSACTIONS where _Descr = @_Transaction IF @TransactID = NULL BEGIN insert into _TRANSACTIONS (_Descr) Values (@_Transaction) SET @TransactID = SCOPE_IDENTITY() END END ELSE set @TransactID = 0 declare @UserID int select @UserID=_ID from _USERS where _UserUID = @_UserUID IF @UserID IS NULL BEGIN insert into _USERS (_UserUID) values (@_UserUID) SET @UserID = SCOPE_IDENTITY() END declare @AppID int select @AppID=_ID from _APP where _App = @_App IF @AppID IS NULL BEGIN insert into _APP (_App,_AppPresentation) values (@_App,@_AppPresentation) SET @AppID = SCOPE_IDENTITY() END declare @EventID int select @EventID =_ID from _EVENTS where _Event = @_Event IF @EventID IS NULL BEGIN insert into _EVENTS (_Event,_EventPresentation) values (@_Event,@_EventPresentation) SET @EventID = SCOPE_IDENTITY() END declare @MetadataID int IF RTRIM(@_MetaData) <> '' BEGIN select @MetadataID = _ID from _Metadatas where _MetaData = @_MetaData IF @MetaDataID IS NULL BEGIN insert into _Metadatas (_MetaData,_MetaDataPresentation) values (@_MetaData,'not found: '+@_MetaData) SET @MetadataID = SCOPE_IDENTITY() END END ELSE set @MetadataID = 0 declare @MDID int declare @DataID int declare @TabNum int declare @TabName varchar(100) declare @SQLStr nvarchar(300) IF LEN(@_Data) > 35 BEGIN set @TabNum = CAST(left(@_Data,CHARINDEX(':',@_Data)-1) AS INT) select @MDID = _ID,@TabName = '_'+LEFT(_MetaData,CHARINDEX('.',_MetaData)-1)+CAST(_ID AS varchar(100)) from _Metadatas where _TabNum = @TabNum IF @MDID IS NULL BEGIN insert into _Metadatas (_MetaData,_MetaDataPresentation,_TabNum) values ('tmp.НеизвестныеМетаданные','tmp_' + replace(convert(char,getdate(),106),' ','_'),@TabNum) SET @MDID = SCOPE_IDENTITY() set @TabName = '_tmp'+cast(@MDID as varchar(10)) set @SQLStr = ' CREATE TABLE '+@TabName+' ( _ID int IDENTITY (1, 1) NOT NULL , _IDMD smallint NOT NULL, _Data nvarchar(300) )' exec sp_executesql @SQLStr --select @SQLStr set @SQLStr = ' CREATE UNIQUE INDEX ' +@TabName +'_Index ON ' +@TabName +'(_Data) WITH FILLFACTOR = 100 ON [PRIMARY]' exec sp_executesql @SQLStr --select @SQLStr END set @SQLStr = 'select @DataID = _ID from '+ @TabName +' where _Data = @_Data' exec sp_executesql @SQLStr,N' @DataID int OUTPUT, @_Data varchar(42)',@DataID OUTPUT,@_Data IF @DataID IS NULL BEGIN set @SQLStr = 'insert into '+ @TabName +' (_IDMD,_Data) values (@IDMD,@_Data)' exec sp_executesql @SQLStr,N' @IDMD int , @_Data varchar(42)',@TabNum ,@_Data SET @DataID =IDENT_CURRENT(@TabName) END END ELSE BEGIN set @MDID = 0 set @DataID = 0 END INSERT INTO [dbo].[_MAIN] ( [_Level] , [_Date] , [_UserUID] , [_Host] , [_App] , [_Connection] , [_Event] , [_Comment] , [_TransactionID] , [_TransactionStatus] , [_ServerName] , [_Port] , [_SyncPort] , [_Metadata] , [_MDData] , [_Data] , [_DataPresentation] , [_ClusterName]) VALUES ( @_Level , convert(datetime,@_Date,104) , @UserID , @_Host , @AppID , @_Connection , @EventID , @_Comment , @TransactID , @_TransactionStatus , @_ServerName , @_Port , @_SyncPort , @MetadataID , @MDID , @DataID , @_DataPresentation, @_ClusterName ) GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO CREATE PROCEDURE _UpdateMetadata @MetaData varchar(200), @MetaDataPresentation varchar(300) = '', @TabNum int = NULL, @ValueToStringInternal varchar(42) = NULL AS BEGIN IF (select count(1) from _Metadatas where _MetaData = @MetaData) = 0 BEGIN declare @MetaDataID int declare @SQLStr nvarchar(300) declare @TabName varchar(300) insert into _Metadatas (_MetaData,_MetaDataPresentation,_TabNum,_ValueToStringInternal) values (@MetaData,@MetaDataPresentation,@TabNum,@ValueToStringInternal) SET @MetaDataID = SCOPE_IDENTITY() IF @TabNum IS NOT NULL BEGIN set @TabName = '_' +LEFT(@MetaData,CHARINDEX('.',@MetaData)-1)+CAST(@MetaDataID AS varchar(100)) set @SQLStr = ' CREATE TABLE ' +@TabName +' ( _ID int IDENTITY (1, 1) NOT NULL , _IDMD smallint NOT NULL, _Data nvarchar(300) COLLATE Cyrillic_General_CI_AS NOT NULL ) ON [PRIMARY]' exec sp_executesql @SQLStr set @SQLStr = ' CREATE UNIQUE INDEX ' +@TabName +'_Index ON ' +@TabName +'(_Data) WITH FILLFACTOR = 100 ON [PRIMARY]' exec sp_executesql @SQLStr END END END GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO {Форма.Форма.Форма(40)}: Ошибка при вызове метода контекста (Execute): Произошла исключительная ситуация (Microsoft OLE DB Provider for SQL Server): Incorrect syntax near 'GO'.
    • #5
    • 14.08.2011 23:34
    0
    негусто описано :(
    • #6
    • 22.08.2011 23:16
    0
    Все основное описание в одноименной статье. http://1clancer.ru/article/article=2
Яндекс-директ
Для участия в обсуждении Вам необходимо авторизоваться либо   зарегистрироваться