Skip to content

Commit

Permalink
Commit patch
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreyKomarov committed Apr 10, 2017
1 parent faf8018 commit bbcd340
Show file tree
Hide file tree
Showing 7 changed files with 254 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/Sitecore.Support.154851.156878.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25123.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{3DF8E2DC-53D2-4394-A535-4BF83F8FC983}") = "Sitecore.Support.154851.156878", "Sitecore.Support.154851.156878\Sitecore.Support.154851.156878.csproj", "{56DA587A-411B-4A86-81D3-5A472A379E0E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{56DA587A-411B-4A86-81D3-5A472A379E0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{56DA587A-411B-4A86-81D3-5A472A379E0E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{56DA587A-411B-4A86-81D3-5A472A379E0E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{56DA587A-411B-4A86-81D3-5A472A379E0E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
<sitecore>
<dataProviders>
<main set:type="Sitecore.Support.Data.Oracle.OracleDataProvider, Sitecore.Support.154851.156878" />
</dataProviders>
</sitecore>
</configuration>
117 changes: 117 additions & 0 deletions src/Sitecore.Support.154851.156878/OracleDataProviderFix.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
using System;
using Sitecore.Data;
using Sitecore.Data.DataProviders;
using Sitecore.Data.DataProviders.Sql;
using Sitecore.Data.Items;
using Sitecore.Data.Oracle;
using Sitecore.Diagnostics;
using Sitecore.Text;

namespace Sitecore.Support.Data.Oracle
{
public class OracleDataProvider : Sitecore.Data.Oracle.OracleDataProvider
{
public OracleDataProvider(string connectionString) : base(connectionString)
{
}
public override bool AddToPublishQueue(ID itemID, string action, DateTime date, string language, CallContext context)
{
OracleDataApi oracleDataApi = base.Api as OracleDataApi;
Assert.IsNotNull(oracleDataApi, "Invalid Data API");
//string sql = "INSERT INTO {0}PublishQueue{1} ( {0}ItemID{1}, {0}Language{1}, {0}Version{1}, {0}Date{1}, {0}Action{1} ) VALUES( {2}itemID{3}, {2}language{3}, {2}version{3}, {2}date{3}, {2}action{3} )";
string sql = "DECLARE cnt NUMBER;\nBEGIN SELECT COUNT(*) INTO cnt FROM {0}PublishQueue{1} WHERE ({0}ItemID{1} = {2}itemID{3} AND {0}Language{1} = {2}language{3} AND {0}Date{1} = {2}date{3} AND {0}Action{1} = {2}action{3});\n IF( cnt = 0 ) THEN INSERT INTO {0}PublishQueue{1} ( {0}ItemID{1}, {0}Language{1}, {0}Version{1}, {0}Date{1}, {0}Action{1} ) VALUES( {2}itemID{3}, {2}language{3}, {2}version{3}, {2}date{3}, {2}action{3} );\n END IF;\nEND;\n";
oracleDataApi.Execute(sql, new object[]
{
"itemID",
itemID,
"language",
language,
"version",
0,
"date",
date,
"action",
action
});
return true;
}
protected override void WriteVersionedField(ID itemId, FieldChange change, DateTime now, bool fieldsAreEmpty)
{
string sql;
if (!fieldsAreEmpty)
{
sql = "\r\nDECLARE\r\n vString {0}VersionedFields{1}.{0}Value{1}%Type;\r\n BEGIN\r\n vString :={2}value{3};\r\nMERGE INTO {0}VersionedFields{1} F\r\nUSING\r\n(SELECT {2}itemId{3} IId,\r\n {2}fieldId{3} FId,\r\n {2}language{3} L,\r\n {2}version{3} V\r\n FROM DUAL) S\r\nON ( F.{0}ItemId{1} = S.IId\r\n AND F.{0}FieldId{1} = S.FId\r\n AND (F.{0}Language{1} = S.L OR (F.{0}Language{1} IS NULL AND S.L IS NULL))\r\n AND F.{0}Version{1} = S.V)\r\nWHEN MATCHED THEN UPDATE\r\n SET F.{0}Value{1} = vString, F.{0}Updated{1} = {2}now{3}\r\nWHEN NOT MATCHED THEN INSERT\r\n (F.{0}ItemId{1}, F.{0}Language{1}, F.{0}Version{1}, F.{0}FieldId{1}, F.{0}Value{1}, F.{0}Created{1}, F.{0}Updated{1})\r\n VALUES\r\n ({2}itemId{3}, {2}language{3}, {2}version{3}, {2}fieldId{3}, vString, {2}now{3}, {2}now{3});\r\nEND;";
}
else
{
sql = "INSERT INTO {0}VersionedFields{1} ( \r\n {0}ItemId{1}, {0}Language{1}, {0}Version{1}, {0}FieldId{1}, {0}Value{1}, {0}Created{1}, {0}Updated{1}\r\n )\r\n VALUES (\r\n {2}itemId{3}, {2}language{3}, {2}version{3}, {2}fieldId{3}, {2}value{3}, {2}now{3}, {2}now{3}\r\n )";
}
BigString bigString = (change.Value != string.Empty) ? new BigString(change.Value) : new BigString("__#!$No value$!#__");
base.Api.Execute(sql, new object[]
{
"itemId",
itemId,
"language",
change.Language,
"version",
change.Version,
"fieldId",
change.FieldID,
"value",
bigString,
"now",
now
});
}
protected override void WriteUnversionedField(ID itemId, FieldChange change, DateTime now, bool fieldsAreEmpty)
{
string sql;
if (!fieldsAreEmpty)
{
sql = "\r\nDECLARE\r\n vString {0}UnversionedFields{1}.{0}Value{1}%Type;\r\n BEGIN\r\n vString :={2}value{3};\r\nMERGE INTO {0}UnversionedFields{1} F\r\nUSING (\r\n SELECT {2}itemId{3} IId, \r\n {2}fieldId{3} FId,\r\n {2}language{3} L\r\n FROM DUAL) S\r\nON (F.{0}ItemId{1} = S.IId AND F.{0}FieldId{1} = S.FId\r\n AND (F.{0}Language{1} = S.L OR (F.{0}Language{1} IS NULL AND S.L IS NULL)))\r\nWHEN MATCHED THEN UPDATE\r\n SET F.{0}Value{1} = vString,\r\n F.{0}Updated{1} = {2}now{3}\r\nWHEN NOT MATCHED THEN INSERT\r\n (F.{0}ItemId{1}, F.{0}Language{1}, F.{0}FieldId{1}, F.{0}Value{1}, F.{0}Created{1}, F.{0}Updated{1})\r\n VALUES \r\n ({2}itemId{3}, {2}language{3}, {2}fieldId{3}, vString, {2}now{3}, {2}now{3});\r\nEND;";
}
else
{
sql = " INSERT INTO {0}UnversionedFields{1} ( {0}ItemId{1}, {0}Language{1}, {0}FieldId{1}, {0}Value{1}, {0}Created{1}, {0}Updated{1} ) VALUES ( {2}itemId{3}, {2}language{3}, {2}fieldId{3}, {2}value{3}, {2}now{3}, {2}now{3} )";
}
BigString bigString = (change.Value != string.Empty) ? new BigString(change.Value) : new BigString("__#!$No value$!#__");
base.Api.Execute(sql, new object[]
{
"itemId",
itemId,
"language",
change.Language,
"fieldId",
change.FieldID,
"value",
bigString,
"now",
now
});
}
protected override void WriteSharedField(ID itemId, FieldChange change, DateTime now, bool fieldsAreEmpty)
{
string sql;
if (!fieldsAreEmpty)
{
sql = "\r\nDECLARE\r\n vString {0}SharedFields{1}.{0}Value{1}%Type;\r\n BEGIN\r\n vString :={2}value{3};\r\nMERGE INTO {0}SharedFields{1} F\r\nUSING (\r\n SELECT \r\n {2}itemId{3} IId,\r\n {2}fieldId{3} FId\r\n FROM DUAL) S\r\nON (F.{0}ItemId{1} = S.IId AND F.{0}FieldId{1} = S.FId)\r\nWHEN MATCHED THEN UPDATE\r\n SET {0}Value{1} = vString, {0}Updated{1} = {2}now{3}\r\nWHEN NOT MATCHED THEN INSERT\r\n (F.{0}ItemId{1}, F.{0}FieldId{1}, F.{0}Value{1}, F.{0}Created{1}, F.{0}Updated{1})\r\n VALUES\r\n ({2}itemId{3}, {2}fieldId{3}, vString, {2}now{3}, {2}now{3});\r\nEND;";
}
else
{
sql = " INSERT INTO {0}SharedFields{1} (\r\n {0}ItemId{1}, {0}FieldId{1}, {0}Value{1}, {0}Created{1}, {0}Updated{1}\r\n )\r\n VALUES (\r\n {2}itemId{3}, {2}fieldId{3}, {2}value{3}, {2}now{3}, {2}now{3}\r\n )";
}
BigString bigString = (change.Value != string.Empty) ? new BigString(change.Value) : new BigString("__#!$No value$!#__");
base.Api.Execute(sql, new object[]
{
"itemId",
itemId,
"fieldId",
change.FieldID,
"value",
bigString,
"now",
now
});
}
}
}
6 changes: 6 additions & 0 deletions src/Sitecore.Support.154851.156878/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
using System.Reflection;
using System.Runtime.InteropServices;

[assembly: AssemblyTitle("Sitecore.Support.154851.156878")]
[assembly: AssemblyProduct("Sitecore.Support.154851.156878")]
[assembly: ComVisible(false)]
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{56DA587A-411B-4A86-81D3-5A472A379E0E}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Sitecore.Support</RootNamespace>
<AssemblyName>Sitecore.Support.154851.156878</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<UseIISExpress>true</UseIISExpress>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Sitecore.Kernel">
<HintPath>..\packages\SC.Sitecore.Kernel.8.2.2\lib\Sitecore.Kernel.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Sitecore.Oracle, Version=10.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SC.Sitecore.Oracle.8.2.2\lib\Sitecore.Oracle.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
</ItemGroup>
<ItemGroup>
<Compile Include="OracleDataProviderFix.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="App_Config\Include\zzz\Sitecore.Support.154851.156878.config" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="web.config" />
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>0</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:51730/</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>
5 changes: 5 additions & 0 deletions src/Sitecore.Support.154851.156878/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="SC.Sitecore.Kernel" version="8.2.2" targetFramework="net452" />
<package id="SC.Sitecore.Oracle" version="8.2.2" targetFramework="net452" />
</packages>
4 changes: 4 additions & 0 deletions src/Sitecore.Support.154851.156878/web.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!-- Do not change this file - it must be empty, see https://github.com/SitecoreSupport/PatchCreator/issues/13 -->
</configuration>

0 comments on commit bbcd340

Please sign in to comment.