﻿<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type='text/css' href='https://stocksharp.ru/css/style.css'?>
<?xml-stylesheet type='text/css' href='https://stocksharp.ru/css/bbeditor.css'?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title type="html">Гидра. S# 4.0</title>
  <id>~/topic/1959/gidra_-s-4_0/</id>
  <rights type="text">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  <updated>2026-04-07T18:53:00Z</updated>
  <logo>https://stocksharp.ru/images/logo.png</logo>
  <link href="https://stocksharp.ru/handlers/atom.ashx?category=topic&amp;id=1959" rel="self" type="application/rss+xml" />
  <entry>
    <id>https://stocksharp.ru/posts/m/13011/</id>
    <title type="text">Для перехода на 4.0.4 нужно обновить БД. Подробности, в диффе на trading_3.2_4.0.sql</title>
    <published>2011-11-05T21:58:20Z</published>
    <updated>2011-11-05T21:58:20Z</updated>
    <author>
      <name>Mikhail Sukhov</name>
      <uri>https://stocksharp.ru/users/201/</uri>
      <email>info@stocksharp.ru</email>
    </author>
    <content type="html">Для перехода на 4.0.4 нужно обновить БД. Подробности, в диффе на trading_3.2_4.0.sql</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
  <entry>
    <id>https://stocksharp.ru/posts/m/12558/</id>
    <title type="text">Чтоб не контролировать какая база в данный момент активна, первой строкой можно вставлять - use Trad...</title>
    <published>2011-10-20T11:43:59Z</published>
    <updated>2011-10-20T11:43:59Z</updated>
    <author>
      <name>JackSparrow</name>
      <uri>https://stocksharp.ru/users/27783/</uri>
      <email>info@stocksharp.ru</email>
    </author>
    <content type="html">Чтоб не контролировать какая база в данный момент активна, первой строкой можно вставлять - use Trading.</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
  <entry>
    <id>https://stocksharp.ru/posts/m/12530/</id>
    <title type="text">Да, проблема была в этом. Спасибо</title>
    <published>2011-10-19T15:21:28Z</published>
    <updated>2011-10-19T15:21:28Z</updated>
    <author>
      <name>DT</name>
      <uri>https://stocksharp.ru/users/28052/</uri>
      <email>info@stocksharp.ru</email>
    </author>
    <content type="html">Да, проблема была в этом. Спасибо</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
  <entry>
    <id>https://stocksharp.ru/posts/m/12529/</id>
    <title type="text">Последний скрипт выполняется с ошибкой: Скрипт на базе Trading прогоняется? По умолчанию он пытается...</title>
    <published>2011-10-19T14:36:46Z</published>
    <updated>2011-10-19T14:36:46Z</updated>
    <author>
      <name>Mikhail Sukhov</name>
      <uri>https://stocksharp.ru/users/201/</uri>
      <email>info@stocksharp.ru</email>
    </author>
    <content type="html">&lt;div class="quote"&gt;&lt;span class="quotetitle"&gt;DT &lt;a href="https://stocksharp.ru/posts/m/12528/" class="quote_nav"&gt;&lt;/a&gt;&lt;/span&gt;&lt;div class="innerquote"&gt;Последний скрипт выполняется с ошибкой:&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Скрипт на базе Trading прогоняется? По умолчанию он пытается выполнится на master базе.</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
  <entry>
    <id>https://stocksharp.ru/posts/m/12528/</id>
    <title type="text">Последний скрипт выполняется с ошибкой: Msg 4902, Level 16, State 1, Line 1 Cannot find the object &amp;quot;...</title>
    <published>2011-10-19T14:26:44Z</published>
    <updated>2011-10-19T14:26:44Z</updated>
    <author>
      <name>DT</name>
      <uri>https://stocksharp.ru/users/28052/</uri>
      <email>info@stocksharp.ru</email>
    </author>
    <content type="html">Последний скрипт выполняется с ошибкой:&lt;br /&gt;&lt;br /&gt;&lt;div class="quote"&gt;&lt;span class="quotetitle"&gt;Цитата:&lt;/span&gt;&lt;div class="innerquote"&gt;Msg 4902, Level 16, State 1, Line 1&lt;br /&gt;Cannot find the object &amp;quot;dbo.Exchange&amp;quot; because it does not exist or you do not have permissions.&lt;br /&gt;Msg 208, Level 16, State 1, Line 2&lt;br /&gt;Invalid object name &amp;#39;dbo.Exchange&amp;#39;.&lt;br /&gt;Msg 4902, Level 16, State 1, Line 2&lt;br /&gt;Cannot find the object &amp;quot;dbo.Exchange&amp;quot; because it does not exist or you do not have permissions.&lt;br /&gt;Msg 208, Level 16, State 6, Procedure Exchange_UpdateByName, Line 22&lt;br /&gt;Invalid object name &amp;#39;dbo.Exchange_UpdateByName&amp;#39;.&lt;/div&gt;&lt;/div&gt;</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
  <entry>
    <id>https://stocksharp.ru/posts/m/12383/</id>
    <title type="text">Для перехода на 4.0.3 необходимо выполнить скрипт: ALTER TABLE . add ExpiryTime bigint NULL; ALTER T...</title>
    <published>2011-10-16T20:59:51Z</published>
    <updated>2011-10-16T20:59:51Z</updated>
    <author>
      <name>Mikhail Sukhov</name>
      <uri>https://stocksharp.ru/users/201/</uri>
      <email>info@stocksharp.ru</email>
    </author>
    <content type="html">Для перехода на 4.0.3 необходимо выполнить скрипт:&lt;br /&gt;&lt;br /&gt;&lt;div class="code"&gt;&lt;strong&gt;Код&lt;/strong&gt;&lt;div class="innercode"&gt;&lt;pre class="brush:sql"&gt;
ALTER TABLE [dbo].[Exchange] add ExpiryTime bigint NULL;
ALTER TABLE [dbo].[Exchange] add IsSupportAtomicReRegister bit NULL;

GO

update [dbo].[Exchange]
set
	ExpiryTime = 0,
	IsSupportAtomicReRegister = 0

GO

ALTER TABLE [dbo].[Exchange] ALTER COLUMN ExpiryTime bigint NOT NULL;
ALTER TABLE [dbo].[Exchange] ALTER COLUMN IsSupportAtomicReRegister bit NOT NULL;

GO
ALTER PROCEDURE [dbo].[Exchange_UpdateByName]
	@Name as nvarchar(64),
	@Times as nvarchar(max),
	@SpecialWorkingDays as nvarchar(max),
	@SpecialHolidays as nvarchar(max),
	@ExtensionInfo as nvarchar(max),
	@ExpiryTime bigint,
	@IsSupportAtomicReRegister bit
as
if (exists(select * from Exchange where Name = @Name))
	update Exchange
	set
		Times = @Times,
		SpecialWorkingDays = @SpecialWorkingDays,
		SpecialHolidays = @SpecialHolidays,
		ExtensionInfo = @ExtensionInfo,
		ExpiryTime = @ExpiryTime,
		IsSupportAtomicReRegister = @IsSupportAtomicReRegister
	where
		Name = @Name
else
	insert into Exchange
		(Name, Times, SpecialWorkingDays, SpecialHolidays, ExtensionInfo, ExpiryTime, IsSupportAtomicReRegister)
	values
		(@Name, @Times, @SpecialWorkingDays, @SpecialHolidays, @ExtensionInfo, @ExpiryTime, @IsSupportAtomicReRegister)&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
  <entry>
    <id>https://stocksharp.ru/posts/m/12218/</id>
    <title type="text">Я выполнил. Сейчас старую базу вообще удалил, создал новую скриптом trading.sql, всё тоже самое Прин...</title>
    <published>2011-10-11T22:00:54Z</published>
    <updated>2011-10-11T22:00:54Z</updated>
    <author>
      <name>Mikhail Sukhov</name>
      <uri>https://stocksharp.ru/users/201/</uri>
      <email>info@stocksharp.ru</email>
    </author>
    <content type="html">&lt;div class="quote"&gt;&lt;span class="quotetitle"&gt;bender &lt;a href="https://stocksharp.ru/posts/m/12217/" class="quote_nav"&gt;&lt;/a&gt;&lt;/span&gt;&lt;div class="innerquote"&gt;Я выполнил. Сейчас старую базу вообще удалил, создал новую скриптом trading.sql, всё тоже самое&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Приношу извинения. Возьмите последнюю версию BusinessEntities (залил пару минут назад). Плюс посмотрите на дифф &lt;a target="_blank" rel="nofollow" href="https://stocksharp.ru/away/?u=AQAAAAAAAAAbncQVTu8T5yVB2LlB47S-5KHyW8ZN6xcH4iJyKFKwUQgjwasowjZHTe_leX0HSMEZMleO4gnNqwGCWXzqWS-5OX7pxHZu4rNFdxISZg2i_XGTaTQMzdMSdNyGXStd0MnC1ePIjWuhNKQELOGqlukd" title="http://stocksharp.codeplex.com/SourceControl/changeset/changes/10430#Documentation%2ftrading_3.2_4.0.sql"&gt;http://stocksharp.codepl...on%2ftrading_3.2_4.0.sql&lt;/a&gt;</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
  <entry>
    <id>https://stocksharp.ru/posts/m/12217/</id>
    <title type="text">Я выполнил. Сейчас старую базу вообще удалил, создал новую скриптом trading.sql, всё тоже самое</title>
    <published>2011-10-11T21:10:38Z</published>
    <updated>2011-10-11T21:10:38Z</updated>
    <author>
      <name>bender</name>
      <uri>https://stocksharp.ru/users/28723/</uri>
      <email>info@stocksharp.ru</email>
    </author>
    <content type="html">Я выполнил. Сейчас старую базу вообще удалил, создал новую скриптом trading.sql, всё тоже самое</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
  <entry>
    <id>https://stocksharp.ru/posts/m/12215/</id>
    <title type="text">Для нее нужно выполнить скрипт \Documentation\trading_3.2_4.0.sql </title>
    <published>2011-10-11T21:00:59Z</published>
    <updated>2011-10-11T21:00:59Z</updated>
    <author>
      <name>Mikhail Sukhov</name>
      <uri>https://stocksharp.ru/users/201/</uri>
      <email>info@stocksharp.ru</email>
    </author>
    <content type="html">Для нее нужно выполнить скрипт \Documentation\trading_3.2_4.0.sql </content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
  <entry>
    <id>https://stocksharp.ru/posts/m/12214/</id>
    <title type="text">Скачал Гидру 4.0.2, при построении выдаёт ошибку: Ошибка 1 выход из команды &amp;quot;call ..\..\..\plugins.b...</title>
    <published>2011-10-11T20:32:26Z</published>
    <updated>2011-10-11T20:32:26Z</updated>
    <author>
      <name>bender</name>
      <uri>https://stocksharp.ru/users/28723/</uri>
      <email>info@stocksharp.ru</email>
    </author>
    <content type="html">Скачал Гидру 4.0.2, при построении выдаёт ошибку:&lt;br /&gt;&lt;div class="quote"&gt;&lt;span class="quotetitle"&gt;Цитата:&lt;/span&gt;&lt;div class="innerquote"&gt;Ошибка	1	выход из команды &amp;quot;call ..\..\..\plugins.bat Plaza Debug&lt;br /&gt;&lt;br /&gt;copy StockSharp.Plaza.dll ..\..\..\..\Hydra\bin\Debug\Plugins\StockSharp.Plaza.dll&lt;br /&gt;copy ..\..\..\..\..\References\Interop.P2ClientGateMTA32.dll ..\..\..\..\Hydra\bin\Debug\Plugins\Interop.P2ClientGateMTA32.dll&lt;br /&gt;copy ..\..\..\..\..\References\Interop.P2ClientGateMTA64.dll ..\..\..\..\Hydra\bin\Debug\Plugins\Interop.P2ClientGateMTA64.dll&lt;br /&gt;&lt;br /&gt;if Debug == Debug goto :debug&lt;br /&gt;&lt;br /&gt;goto :exit&lt;br /&gt;&lt;br /&gt;:debug&lt;br /&gt;copy StockSharp.Plaza.pdb ..\..\..\..\Hydra\bin\Debug\Plugins\StockSharp.Plaza.pdb&lt;br /&gt;&lt;br /&gt;:exit&amp;quot; с кодом 1.	Plaza&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;А при попытке отладки исключение:&lt;br /&gt;&lt;div class='spoilertitle'&gt;&lt;input type='button' value='Показать спойлер' class='btn btn-primary' onclick="toggleSpoiler(this, 'spolier_9c44ccd5fc6a4d369eddcec852cd504b');" title='Показать спойлер' /&gt;&lt;/div&gt;&lt;div class='spoilerbox' id='spolier_9c44ccd5fc6a4d369eddcec852cd504b' style='display:none'&gt;Гидра 00:23:03.5468750 System.Windows.Markup.XamlParseException: Не удается создать экземпляр &amp;quot;MainWindow&amp;quot;, определенный в сборке &amp;quot;Hydra, Version=4.0.2.0, Culture=neutral, PublicKeyToken=null&amp;quot;. Адресат вызова создал исключение.  Ошибка в файле разметки &amp;quot;Hydra;component/MainWindow.xaml&amp;quot;, строка 1, позиция 9. ---&amp;gt; System.Reflection.TargetInvocationException: Адресат вызова создал исключение. ---&amp;gt; System.InvalidCastException: Не удалось преобразовать значение параметра из TimeSpan в Int64. ---&amp;gt; System.InvalidCastException: Объект должен реализовывать интерфейс IConvertible.&lt;br /&gt;   в System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)&lt;br /&gt;   в System.Data.SqlClient.SqlParameter.CoerceValue(Object value, MetaType destinationType)&lt;br /&gt;   --- Конец трассировки внутреннего стека исключений ---&lt;br /&gt;   в System.Data.SqlClient.SqlParameter.CoerceValue(Object value, MetaType destinationType)&lt;br /&gt;   в System.Data.SqlClient.SqlParameter.GetCoercedValue()&lt;br /&gt;   в System.Data.SqlClient.SqlParameter.Validate(Int32 index, Boolean isCommandProc)&lt;br /&gt;   в System.Data.SqlClient.SqlCommand.SetUpRPCParameters(_SqlRPC rpc, Int32 startCount, Boolean inSchema, SqlParameterCollection parameters)&lt;br /&gt;   в System.Data.SqlClient.SqlCommand.BuildRPC(Boolean inSchema, SqlParameterCollection parameters, _SqlRPC&amp;amp; rpc)&lt;br /&gt;   в System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)&lt;br /&gt;   в System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)&lt;br /&gt;   в System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)&lt;br /&gt;   в System.Data.SqlClient.SqlCommand.ExecuteNonQuery()&lt;br /&gt;   в Ecng.Data.DatabaseCommand.&amp;lt;ExecuteNonQuery&amp;gt;b__5(DbCommand cmd)&lt;br /&gt;   в Ecng.Data.DatabaseCommand.&amp;lt;&amp;gt;c__DisplayClass3`1.&amp;lt;Execute&amp;gt;b__0(DbConnection connection)&lt;br /&gt;   в Ecng.Data.Database.GetConnection(Action`1 action)&lt;br /&gt;   в Ecng.Data.DatabaseCommand.Execute[TResult](IEnumerable`1 input, Func`2 handler)&lt;br /&gt;   в Ecng.Data.DatabaseCommand.ExecuteNonQuery(SerializationItemCollection input)&lt;br /&gt;   в Ecng.Data.Database.Execute(DatabaseCommand command, SerializationItemCollection source, Boolean needRetVal)&lt;br /&gt;   в Ecng.Data.Database.Update(DatabaseCommand command, SerializationItemCollection source, Boolean needRetVal)&lt;br /&gt;   в Ecng.Data.Database.&amp;lt;&amp;gt;c__DisplayClassf`1.&amp;lt;Update&amp;gt;b__e()&lt;br /&gt;   в Ecng.Data.Database.Update[TEntity](TEntity entity, FieldCollection keyFields, FieldCollection valueFields)&lt;br /&gt;   в Ecng.Data.Database.Update[TEntity](TEntity entity, FieldCollection valueFields)&lt;br /&gt;   в Ecng.Data.Database.Update[TEntity](TEntity entity)&lt;br /&gt;   в Ecng.Serialization.RelationManyList`1.OnUpdate(TEntity entity)&lt;br /&gt;   в Ecng.Data.HierarchicalPageLoadList`1.OnUpdate(TEntity entity)&lt;br /&gt;   в Ecng.Serialization.RelationManyList`1.Update(TEntity entity)&lt;br /&gt;   в StockSharp.Algo.Storages.BaseStorageEntityList`1.Save(T entity)&lt;br /&gt;   в StockSharp.Hydra.MainWindow..ctor() в C:\Documents and Settings\Yura\Мои документы\Загрузки\StockSharp_4.0.2_Sources\Hydra\Hydra\MainWindow.xaml.cs:строка 56&lt;br /&gt;   --- Конец трассировки внутреннего стека исключений ---&lt;br /&gt;   в System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean&amp;amp; canBeCached, RuntimeMethodHandle&amp;amp; ctor, Boolean&amp;amp; bNeedSecurityCheck)&lt;br /&gt;   в System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)&lt;br /&gt;   в System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)&lt;br /&gt;   в System.Activator.CreateInstance(Type type, Boolean nonPublic)&lt;br /&gt;   в System.Windows.Markup.BamlRecordReader.CreateInstanceFromType(Type type, Int16 typeId, Boolean throwOnFail)&lt;br /&gt;   --- Конец трассировки внутреннего стека исключений ---&lt;br /&gt;   в System.Windows.Markup.XamlParseException.ThrowException(String message, Exception innerException, Int32 lineNumber, Int32 linePosition, Uri baseUri, XamlObjectIds currentXamlObjectIds, XamlObjectIds contextXamlObjectIds, Type objectType)&lt;br /&gt;   в System.Windows.Markup.XamlParseException.ThrowException(ParserContext parserContext, Int32 lineNumber, Int32 linePosition, String message, Exception innerException)&lt;br /&gt;   в System.Windows.Markup.BamlRecordReader.ThrowExceptionWithLine(String message, Exception innerException)&lt;br /&gt;   в System.Windows.Markup.BamlRecordReader.CreateInstanceFromType(Type type, Int16 typeId, Boolean throwOnFail)&lt;br /&gt;   в System.Windows.Markup.BamlRecordReader.GetElementAndFlags(BamlElementStartRecord bamlElementStartRecord, Object&amp;amp; element, ReaderFlags&amp;amp; flags, Type&amp;amp; delayCreatedType, Int16&amp;amp; delayCreatedTypeId)&lt;br /&gt;   в System.Windows.Markup.BamlRecordReader.BaseReadElementStartRecord(BamlElementStartRecord bamlElementRecord)&lt;br /&gt;   в System.Windows.Markup.BamlRecordReader.ReadElementStartRecord(BamlElementStartRecord bamlElementRecord)&lt;br /&gt;   в System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord)&lt;br /&gt;   в System.Windows.Markup.BamlRecordReader.Read(Boolean singleRecord)&lt;br /&gt;   в System.Windows.Markup.TreeBuilderBamlTranslator.ParseFragment()&lt;br /&gt;   в System.Windows.Markup.TreeBuilder.Parse()&lt;br /&gt;   в System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)&lt;br /&gt;   в System.Windows.Application.LoadBamlStreamWithSyncInfo(Stream stream, ParserContext pc)&lt;br /&gt;   в System.Windows.Application.LoadComponent(Uri resourceLocator, Boolean bSkipJournaledProperties)&lt;br /&gt;   в System.Windows.Application.DoStartup()&lt;br /&gt;   в System.Windows.Application.&amp;lt;.ctor&amp;gt;b__0(Object unused)&lt;br /&gt;   в System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)&lt;br /&gt;   в System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)&lt;/div&gt;</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
  <entry>
    <id>https://stocksharp.ru/posts/m/11879/</id>
    <title type="text">Михаил, подскажи пожалуйста в каком именно проекте (название файла) прогнать код? Спасибо. sql</title>
    <published>2011-10-03T20:23:05Z</published>
    <updated>2011-10-03T20:23:05Z</updated>
    <author>
      <name>Alexander</name>
      <uri>https://stocksharp.ru/users/2826/</uri>
      <email>info@stocksharp.ru</email>
    </author>
    <content type="html">&lt;div class="quote"&gt;&lt;span class="quotetitle"&gt;mikhaylovvl &lt;a href="https://stocksharp.ru/posts/m/11878/" class="quote_nav"&gt;&lt;/a&gt;&lt;/span&gt;&lt;div class="innerquote"&gt;Михаил, подскажи пожалуйста в каком именно проекте (название файла) прогнать код? &lt;br /&gt;Спасибо.&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;sql</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
  <entry>
    <id>https://stocksharp.ru/posts/m/11878/</id>
    <title type="text">Михаил, подскажи пожалуйста в каком именно проекте (название файла) прогнать код? Спасибо.</title>
    <published>2011-10-03T20:00:38Z</published>
    <updated>2011-10-03T20:00:38Z</updated>
    <author>
      <name>mikhaylovvl</name>
      <uri>https://stocksharp.ru/users/4400/</uri>
      <email>info@stocksharp.ru</email>
    </author>
    <content type="html">Михаил, подскажи пожалуйста в каком именно проекте (название файла) прогнать код? &lt;br /&gt;Спасибо.</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
  <entry>
    <id>https://stocksharp.ru/posts/m/11739/</id>
    <title type="text">В последней версии Гидры были изменения в SQL. Нужно прогнать следующий скрипт, чтобы новая Гидра см...</title>
    <published>2011-09-29T15:57:33Z</published>
    <updated>2011-09-29T15:57:33Z</updated>
    <author>
      <name>Mikhail Sukhov</name>
      <uri>https://stocksharp.ru/users/201/</uri>
      <email>info@stocksharp.ru</email>
    </author>
    <content type="html">В последней версии Гидры были изменения в SQL. Нужно прогнать следующий скрипт, чтобы новая Гидра смогла работать со старой БД:&lt;br /&gt;&lt;br /&gt;&lt;div class="code"&gt;&lt;strong&gt;Код&lt;/strong&gt;&lt;div class="innercode"&gt;&lt;pre class="brush:sql"&gt;
alter proc [dbo].[Security_UpdateById]
	@Id as nvarchar(256),
	@Name as nvarchar(512),
	@Code as nvarchar(256),
	@Class as nvarchar(256),
	@ShortName as nvarchar(256),
	@MinStepSize decimal(18,7),
	@MinStepPrice decimal(18,7),
	@MinLotSize real,
	@Decimals real,
	@OpenPrice decimal(18,7),
	@ClosePrice decimal(18,7),
	@LowPrice decimal(18,7),
	@HighPrice decimal(18,7),
	@State int,
	@Type int,
	@MinPrice decimal(18,7),
	@MaxPrice decimal(18,7),
	@MarginBuy decimal(18,7),
	@MarginSell decimal(18,7),
	@ExpiryDate datetime,
	@SettlementDate datetime,
	@ExtensionInfo nvarchar(max),
	@LastTradeId bigint = null,
	@LastTradeTime datetime2(7) = null,
	@LastTradePrice decimal(18,7) = null,
	@LastTradeVolume decimal(18,7) = null,
	@LastTradeOrderDirection int = null,
	@BestBidPrice decimal(18,7) = null,
	@BestBidVolume decimal(18,7) = null,
	@BestBidOrderDirection int = null,
	@BestAskPrice decimal(18,7) = null,
	@BestAskVolume decimal(18,7) = null,
	@BestAskOrderDirection int = null,
	@Exchange nvarchar(64),
	@UnderlyingSecurityId nvarchar(256),
	@Strike decimal(18,7),
	@OptionType int,
	@Volatility decimal(18,7),
	@TheorPrice decimal(18,7)
as
begin transaction

declare @ExtensionInfoXml xml
set @ExtensionInfoXml = convert(xml, @ExtensionInfo, 1)

declare @FinamMarketId bigint
declare @FinamSecurityId bigint
declare @Source nvarchar(128)
declare @TradeSource nvarchar(128)
declare @DepthSource nvarchar(128)
declare @IsSelected bit
declare @TradeCount int
declare @DepthCount int
declare @LastUpdateTime datetime

set @FinamMarketId = @ExtensionInfoXml.value(N&amp;#39;(/IDictionaryBeginObjectAndObjectEnd/KeyValuePairBeginObjectAndObjectEnd[key/Value = &amp;quot;FinamMarketId&amp;quot;]/value/Value)[1]&amp;#39;, &amp;#39;bigint&amp;#39;)
set @FinamSecurityId = @ExtensionInfoXml.value(N&amp;#39;(/IDictionaryBeginObjectAndObjectEnd/KeyValuePairBeginObjectAndObjectEnd[key/Value = &amp;quot;FinamSecurityId&amp;quot;]/value/Value)[1]&amp;#39;, &amp;#39;bigint&amp;#39;)
set @Source = @ExtensionInfoXml.value(N&amp;#39;(/IDictionaryBeginObjectAndObjectEnd/KeyValuePairBeginObjectAndObjectEnd[key/Value = &amp;quot;Source&amp;quot;]/value/Value)[1]&amp;#39;, &amp;#39;nvarchar(128)&amp;#39;)
set @TradeSource = @ExtensionInfoXml.value(N&amp;#39;(/IDictionaryBeginObjectAndObjectEnd/KeyValuePairBeginObjectAndObjectEnd[key/Value = &amp;quot;TradeSource&amp;quot;]/value/Value)[1]&amp;#39;, &amp;#39;nvarchar(128)&amp;#39;)
set @DepthSource = @ExtensionInfoXml.value(N&amp;#39;(/IDictionaryBeginObjectAndObjectEnd/KeyValuePairBeginObjectAndObjectEnd[key/Value = &amp;quot;DepthSource&amp;quot;]/value/Value)[1]&amp;#39;, &amp;#39;nvarchar(128)&amp;#39;)
set @IsSelected = IsNull(@ExtensionInfoXml.value(N&amp;#39;(/IDictionaryBeginObjectAndObjectEnd/KeyValuePairBeginObjectAndObjectEnd[key/Value = &amp;quot;IsSelected&amp;quot;]/value/Value)[1]&amp;#39;, &amp;#39;bit&amp;#39;), 0)
set @TradeCount = IsNull(@ExtensionInfoXml.value(N&amp;#39;(/IDictionaryBeginObjectAndObjectEnd/KeyValuePairBeginObjectAndObjectEnd[key/Value = &amp;quot;TradeCount&amp;quot;]/value/Value)[1]&amp;#39;, &amp;#39;int&amp;#39;), 0)
set @DepthCount = IsNull(@ExtensionInfoXml.value(N&amp;#39;(/IDictionaryBeginObjectAndObjectEnd/KeyValuePairBeginObjectAndObjectEnd[key/Value = &amp;quot;DepthCount&amp;quot;]/value/Value)[1]&amp;#39;, &amp;#39;int&amp;#39;), 0)
--set @LastUpdateTime = @ExtensionInfoXml.value(N&amp;#39;(/IDictionaryBeginObjectAndObjectEnd/KeyValuePairBeginObjectAndObjectEnd[key/Value = &amp;quot;LastUpdateTime&amp;quot;]/value/Value)[1]&amp;#39;, &amp;#39;datetime&amp;#39;)

begin try
	if (exists(select * from [Security] where Id = @Id))
	begin
		update [Security]
		set
			Name = @Name,
			Code = @Code,
			Class = @Class,
			ShortName = @ShortName,
			MinStepSize = @MinStepSize,
			MinStepPrice = @MinStepPrice,
			MinLotSize = @MinLotSize,
			Decimals = @Decimals,
			OpenPrice = @OpenPrice,
			ClosePrice = @ClosePrice,
			LowPrice = @LowPrice,
			HighPrice = @HighPrice,
			[State] = @State,
			[Type] = @Type,
			MinPrice = @MinPrice,
			MaxPrice = @MaxPrice,
			MarginBuy = @MarginBuy,
			MarginSell = @MarginSell,
			ExpiryDate = @ExpiryDate,
			SettlementDate = @SettlementDate,
			ExtensionInfo = @ExtensionInfo,
			LastTradeId = @LastTradeId,
			LastTradeTime = @LastTradeTime,
			LastTradePrice = @LastTradePrice,
			LastTradeVolume = @LastTradeVolume,
			LastTradeOrderDirection = @LastTradeOrderDirection,
			BestBidPrice = @BestBidPrice,
			BestBidVolume = @BestBidVolume,
			BestBidOrderDirection = @BestBidOrderDirection,
			BestAskPrice = @BestAskPrice,
			BestAskVolume = @BestAskVolume,
			BestAskOrderDirection = @BestAskOrderDirection,
			Exchange = @Exchange,
			UnderlyingSecurityId = @UnderlyingSecurityId,
			Strike = @Strike,
			OptionType = @OptionType,
			Volatility = @Volatility,
			TheorPrice = @TheorPrice
		where
			Id = @Id

		update HydraSecurityInfo
		set
			FinamMarketId = @FinamMarketId,
			FinamSecurityId = @FinamSecurityId,
			[Source] = @Source,
			TradeSource = @TradeSource,
			DepthSource = @DepthSource,
			IsSelected = @IsSelected,
			TradeCount = @TradeCount,
			DepthCount = @DepthCount,
			LastUpdateTime = @LastUpdateTime
		where
			[Security] = @Id
	end
	else
	begin
		insert into [Security]
			(Id, Name, Code, Class, ShortName, MinStepSize, MinStepPrice, MinLotSize, Decimals,
			OpenPrice, ClosePrice, LowPrice, HighPrice, [State], [Type], MinPrice, MaxPrice, MarginBuy, MarginSell, ExpiryDate,
			SettlementDate, ExtensionInfo, LastTradeId, LastTradeTime, LastTradePrice, LastTradeVolume, LastTradeOrderDirection,
			BestBidPrice, BestBidVolume, BestBidOrderDirection, BestAskPrice, BestAskVolume, BestAskOrderDirection, Exchange,
			OptionType, Strike,UnderlyingSecurityId, Volatility, TheorPrice)
		values
			(@Id, @Name, @Code, @Class, @ShortName, @MinStepSize, @MinStepPrice, @MinLotSize, @Decimals,
			@OpenPrice, @ClosePrice, @LowPrice, @HighPrice, @State, @Type, @MinPrice, @MaxPrice, @MarginBuy, @MarginSell, @ExpiryDate,
			@SettlementDate, @ExtensionInfo, @LastTradeId, @LastTradeTime, @LastTradePrice, @LastTradeVolume, @LastTradeOrderDirection,
			@BestBidPrice, @BestBidVolume, @BestBidOrderDirection, @BestAskPrice, @BestAskVolume, @BestAskOrderDirection, @Exchange,
			@OptionType, @Strike, @UnderlyingSecurityId, @Volatility, @TheorPrice)

		insert into HydraSecurityInfo
			([Security], TradeSource, DepthSource, [Source], IsSelected, TradeCount, DepthCount, FinamMarketId, FinamSecurityId, LastUpdateTime)
		values
           (@Id, @TradeSource, @DepthSource, @Source, @IsSelected, @TradeCount, @DepthCount, @FinamMarketId, @FinamSecurityId, @LastUpdateTime)
	end
end try
begin catch
	if @@TRANCOUNT &amp;gt; 0
		rollback transaction
		
	print &amp;#39;Error Number: &amp;#39; + str(error_number()) 
	print &amp;#39;Line Number: &amp;#39; + str(error_line())
	print error_message()
	
	exec usp_RethrowError
end catch

if @@TRANCOUNT &amp;gt; 0
	commit transaction
	
GO

ALTER TABLE [dbo].[Security] ALTER COLUMN [Strike] DECIMAL (18,7) NOT NULL;
ALTER TABLE [dbo].[Security] ALTER COLUMN [TheorPrice] DECIMAL (18,7) NOT NULL;
ALTER TABLE [dbo].[Security] ALTER COLUMN [Volatility] DECIMAL (18,7) NOT NULL;

ALTER TABLE [dbo].[Security] ALTER COLUMN [BestAskOrderDirection] INT NULL;
ALTER TABLE [dbo].[Security] ALTER COLUMN [BestAskPrice] DECIMAL (18,7) NULL;
ALTER TABLE [dbo].[Security] ALTER COLUMN [BestAskVolume] DECIMAL (18,7) NULL;

ALTER TABLE [dbo].[Security] ALTER COLUMN [BestBidOrderDirection] INT NULL;
ALTER TABLE [dbo].[Security] ALTER COLUMN [BestBidPrice] DECIMAL (18,7) NULL;
ALTER TABLE [dbo].[Security] ALTER COLUMN [BestBidVolume] DECIMAL (18,7) NULL;

ALTER TABLE [dbo].[Security] ALTER COLUMN [LastTradeId] BIGINT NULL;
ALTER TABLE [dbo].[Security] ALTER COLUMN [LastTradePrice] DECIMAL (18,7) NULL;
ALTER TABLE [dbo].[Security] ALTER COLUMN [LastTradeTime] DATETIME2 (7) NULL;
ALTER TABLE [dbo].[Security] ALTER COLUMN [LastTradeVolume] DECIMAL (18,7) NULL;


ALTER TABLE [dbo].[MarketDataSourceSettings] add FilterBySecurities bit NULL;

go

update [dbo].[MarketDataSourceSettings]
set
	[StorageFolder] = N&amp;#39;&amp;#39;
where
	[StorageFolder] is null

update [dbo].[MarketDataSourceSettings]
set
	FilterBySecurities = 0
where
	FilterBySecurities is null

go

ALTER TABLE [dbo].[MarketDataSourceSettings] ALTER COLUMN [StorageFolder] [nvarchar](2048) NOT NULL;
ALTER TABLE [dbo].[MarketDataSourceSettings] ALTER COLUMN FilterBySecurities bit NOT NULL;

go

alter proc [dbo].[MarketDataSourceSettings_UpdateBySourceId]
	@SourceId as uniqueidentifier,
	@IsEnabled as bit,
	@WorkingFrom as time(7),
	@WorkingTo as time(7),
	@Interval as time(7),
	@DumpFolder nvarchar(2048),
	@StorageFolder nvarchar(2048),
	@ExtensionInfo nvarchar(max),
	@FilterBySecurities bit
as
if (exists(select * from MarketDataSourceSettings where SourceId = @SourceId))
	update MarketDataSourceSettings
	set
		IsEnabled = @IsEnabled,
		WorkingFrom = @WorkingFrom,
		WorkingTo = @WorkingTo,
		Interval = @Interval,
		DumpFolder = @DumpFolder,
		StorageFolder = @StorageFolder,
		ExtensionInfo = @ExtensionInfo,
		FilterBySecurities = @FilterBySecurities
	where
		SourceId = @SourceId
else
	insert into MarketDataSourceSettings
		(SourceId, IsEnabled, WorkingFrom, WorkingTo, Interval, DumpFolder, StorageFolder, ExtensionInfo, FilterBySecurities)
	values
		(@SourceId, @IsEnabled, @WorkingFrom, @WorkingTo, @Interval, @DumpFolder, @StorageFolder, @ExtensionInfo, @FilterBySecurities)&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
</feed>