diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2018-12-16 11:57:53 -0600 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2018-12-16 12:03:17 -0600 |
| commit | 1b7a9d3734119e658c91ebd9742ab5a3ce94cce4 (patch) | |
| tree | 0c4b710cd5665f2b24a4cefcab19626398e3d139 /src | |
| parent | 8464662dfcf3a6e4fafc33440b33236773d96a65 (diff) | |
| download | wix-1b7a9d3734119e658c91ebd9742ab5a3ce94cce4.tar.gz wix-1b7a9d3734119e658c91ebd9742ab5a3ce94cce4.tar.bz2 wix-1b7a9d3734119e658c91ebd9742ab5a3ce94cce4.zip | |
Integrate into latest v4.
Still needs TupleDefinitions.
Diffstat (limited to 'src')
28 files changed, 873 insertions, 263 deletions
diff --git a/src/Cpp.Build.props b/src/Cpp.Build.props new file mode 100644 index 00000000..296b36ca --- /dev/null +++ b/src/Cpp.Build.props | |||
| @@ -0,0 +1,100 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
| 3 | |||
| 4 | <Project> | ||
| 5 | <PropertyGroup> | ||
| 6 | <Platform Condition=" '$(Platform)' == '' OR '$(Platform)' == 'AnyCPU' ">Win32</Platform> | ||
| 7 | <IntDir>$(BaseIntermediateOutputPath)$(Configuration)\$(Platform)\</IntDir> | ||
| 8 | <OutDir>$(OutputPath)$(Platform)\</OutDir> | ||
| 9 | </PropertyGroup> | ||
| 10 | |||
| 11 | <ItemDefinitionGroup> | ||
| 12 | <ClCompile> | ||
| 13 | <DisableSpecificWarnings>$(DisableSpecificCompilerWarnings)</DisableSpecificWarnings> | ||
| 14 | <WarningLevel>Level4</WarningLevel> | ||
| 15 | <AdditionalIncludeDirectories>$(ProjectDir)inc;$(MSBuildProjectDirectory);$(IntDir);$(SqlCESdkIncludePath);$(ProjectAdditionalIncludeDirectories);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
| 16 | <PreprocessorDefinitions>WIN32;_WINDOWS;_WIN32_MSI=500;_WIN32_WINNT=0x0501;$(ArmPreprocessorDefinitions);$(UnicodePreprocessorDefinitions);_CRT_STDIO_LEGACY_WIDE_SPECIFIERS;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
| 17 | <PrecompiledHeader>Use</PrecompiledHeader> | ||
| 18 | <PrecompiledHeaderFile>precomp.h</PrecompiledHeaderFile> | ||
| 19 | <CallingConvention>StdCall</CallingConvention> | ||
| 20 | <TreatWarningAsError>true</TreatWarningAsError> | ||
| 21 | <ExceptionHandling>false</ExceptionHandling> | ||
| 22 | <AdditionalOptions>-YlprecompDefine</AdditionalOptions> | ||
| 23 | <AdditionalOptions Condition=" $(PlatformToolset.StartsWith('v14')) ">/Zc:threadSafeInit- %(AdditionalOptions)</AdditionalOptions> | ||
| 24 | <MultiProcessorCompilation Condition=" $(NUMBER_OF_PROCESSORS) > 4 ">true</MultiProcessorCompilation> | ||
| 25 | </ClCompile> | ||
| 26 | <ResourceCompile> | ||
| 27 | <PreprocessorDefinitions>$(ArmPreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
| 28 | <AdditionalIncludeDirectories>$(ProjectAdditionalResourceIncludeDirectories);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
| 29 | </ResourceCompile> | ||
| 30 | <Lib> | ||
| 31 | <AdditionalLibraryDirectories>$(OutDir);$(AdditionalMultiTargetLibraryPath);$(ProjectAdditionalLibraryDirectories);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | ||
| 32 | </Lib> | ||
| 33 | <Link> | ||
| 34 | <SubSystem>$(ProjectSubSystem)</SubSystem> | ||
| 35 | <ModuleDefinitionFile>$(ProjectModuleDefinitionFile)</ModuleDefinitionFile> | ||
| 36 | <NoEntryPoint>$(ResourceOnlyDll)</NoEntryPoint> | ||
| 37 | <GenerateDebugInformation>true</GenerateDebugInformation> | ||
| 38 | <AdditionalDependencies>$(ProjectAdditionalLinkLibraries);advapi32.lib;comdlg32.lib;user32.lib;oleaut32.lib;gdi32.lib;shell32.lib;ole32.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||
| 39 | <AdditionalLibraryDirectories>$(OutDir);$(AdditionalMultiTargetLibraryPath);$(ArmLibraryDirectories);$(ProjectAdditionalLinkLibraryDirectories);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | ||
| 40 | <AdditionalOptions Condition=" $(PlatformToolset.StartsWith('v14')) ">/IGNORE:4099 %(AdditionalOptions)</AdditionalOptions> | ||
| 41 | </Link> | ||
| 42 | </ItemDefinitionGroup> | ||
| 43 | |||
| 44 | <ItemDefinitionGroup Condition=" '$(Platform)'=='Win32' and '$(PlatformToolset)'!='v100'"> | ||
| 45 | <ClCompile> | ||
| 46 | <EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet> | ||
| 47 | </ClCompile> | ||
| 48 | </ItemDefinitionGroup> | ||
| 49 | <ItemDefinitionGroup Condition=" '$(Platform)'=='arm' "> | ||
| 50 | <ClCompile> | ||
| 51 | <CallingConvention>CDecl</CallingConvention> | ||
| 52 | </ClCompile> | ||
| 53 | </ItemDefinitionGroup> | ||
| 54 | <ItemDefinitionGroup Condition=" '$(ConfigurationType)'=='StaticLibrary' "> | ||
| 55 | <ClCompile> | ||
| 56 | <DebugInformationFormat>OldStyle</DebugInformationFormat> | ||
| 57 | <OmitDefaultLibName>true</OmitDefaultLibName> | ||
| 58 | <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> | ||
| 59 | </ClCompile> | ||
| 60 | </ItemDefinitionGroup> | ||
| 61 | <ItemDefinitionGroup Condition=" '$(Configuration)'=='Debug' "> | ||
| 62 | <ClCompile> | ||
| 63 | <Optimization>Disabled</Optimization> | ||
| 64 | <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> | ||
| 65 | <PreprocessorDefinitions>_DEBUG;DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
| 66 | <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> | ||
| 67 | </ClCompile> | ||
| 68 | </ItemDefinitionGroup> | ||
| 69 | <ItemDefinitionGroup Condition=" '$(Configuration)'=='Debug' and '$(CLRSupport)'=='true' "> | ||
| 70 | <ClCompile> | ||
| 71 | <BasicRuntimeChecks></BasicRuntimeChecks> | ||
| 72 | <RuntimeLibrary>MultiThreadedDebugDll</RuntimeLibrary> | ||
| 73 | </ClCompile> | ||
| 74 | </ItemDefinitionGroup> | ||
| 75 | <ItemDefinitionGroup Condition=" '$(Configuration)'=='Release' "> | ||
| 76 | <ClCompile> | ||
| 77 | <Optimization>MinSpace</Optimization> | ||
| 78 | <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
| 79 | <FunctionLevelLinking>true</FunctionLevelLinking> | ||
| 80 | <IntrinsicFunctions>true</IntrinsicFunctions> | ||
| 81 | <RuntimeLibrary>MultiThreaded</RuntimeLibrary> | ||
| 82 | </ClCompile> | ||
| 83 | <Link> | ||
| 84 | <EnableCOMDATFolding>true</EnableCOMDATFolding> | ||
| 85 | <OptimizeReferences>true</OptimizeReferences> | ||
| 86 | </Link> | ||
| 87 | </ItemDefinitionGroup> | ||
| 88 | <ItemDefinitionGroup Condition=" '$(Configuration)'=='Release' and '$(CLRSupport)'=='true' "> | ||
| 89 | <ClCompile> | ||
| 90 | <BasicRuntimeChecks></BasicRuntimeChecks> | ||
| 91 | <RuntimeLibrary>MultiThreadedDll</RuntimeLibrary> | ||
| 92 | </ClCompile> | ||
| 93 | </ItemDefinitionGroup> | ||
| 94 | <ItemDefinitionGroup Condition=" '$(CLRSupport)'=='true' "> | ||
| 95 | <Link> | ||
| 96 | <KeyFile>$(LinkKeyFile)</KeyFile> | ||
| 97 | <DelaySign>$(LinkDelaySign)</DelaySign> | ||
| 98 | </Link> | ||
| 99 | </ItemDefinitionGroup> | ||
| 100 | </Project> | ||
diff --git a/src/Directory.Build.props b/src/Directory.Build.props new file mode 100644 index 00000000..9eacf3f5 --- /dev/null +++ b/src/Directory.Build.props | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
| 3 | <!-- | ||
| 4 | Do NOT modify this file. Update the canonical version in Home\src\Directory.Build.props | ||
| 5 | then update all of the repos. | ||
| 6 | --> | ||
| 7 | <Project> | ||
| 8 | <PropertyGroup> | ||
| 9 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
| 10 | <EnableSourceLink Condition=" '$(NCrunch)' == '1' ">false</EnableSourceLink> | ||
| 11 | |||
| 12 | <ProjectName Condition=" '$(ProjectName)' == '' ">$(MSBuildProjectName)</ProjectName> | ||
| 13 | <BaseOutputPath>$(MSBuildThisFileDirectory)..\build\</BaseOutputPath> | ||
| 14 | <BaseIntermediateOutputPath>$(BaseOutputPath)obj\$(ProjectName)\</BaseIntermediateOutputPath> | ||
| 15 | <OutputPath>$(BaseOutputPath)$(Configuration)\</OutputPath> | ||
| 16 | |||
| 17 | <Authors>WiX Toolset Team</Authors> | ||
| 18 | <Company>WiX Toolset</Company> | ||
| 19 | <Copyright>Copyright (c) .NET Foundation and contributors. All rights reserved.</Copyright> | ||
| 20 | <Product>WiX Toolset</Product> | ||
| 21 | </PropertyGroup> | ||
| 22 | |||
| 23 | <PropertyGroup> | ||
| 24 | <WixToolsetRootFolder>$(MSBuildThisFileDirectory)..\..\</WixToolsetRootFolder> | ||
| 25 | </PropertyGroup> | ||
| 26 | |||
| 27 | <Import Project="Cpp.Build.props" Condition=" '$(MSBuildProjectExtension)'=='.vcxproj' " /> | ||
| 28 | <Import Project="Custom.Build.props" Condition=" Exists('Custom.Build.props') " /> | ||
| 29 | </Project> | ||
diff --git a/src/FindLocalWix.props b/src/FindLocalWix.props new file mode 100644 index 00000000..a784e352 --- /dev/null +++ b/src/FindLocalWix.props | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
| 3 | |||
| 4 | <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| 5 | <PropertyGroup> | ||
| 6 | <WixTargetsPath Condition=" '$(Configuration)' == 'Debug' And Exists('$(MSBuildThisFileDirectory)..\..\Tools\README.md') ">$(MSBuildThisFileDirectory)..\..\Tools\build\Debug\net461\wix.targets</WixTargetsPath> | ||
| 7 | </PropertyGroup> | ||
| 8 | </Project> | ||
diff --git a/src/ca/dllmain.cpp b/src/ca/dllmain.cpp new file mode 100644 index 00000000..35ae6d1c --- /dev/null +++ b/src/ca/dllmain.cpp | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | #include "precomp.h" | ||
| 4 | |||
| 5 | /******************************************************************** | ||
| 6 | DllMain - standard entry point for all WiX custom actions | ||
| 7 | |||
| 8 | ********************************************************************/ | ||
| 9 | extern "C" BOOL WINAPI DllMain( | ||
| 10 | IN HINSTANCE hInst, | ||
| 11 | IN ULONG ulReason, | ||
| 12 | IN LPVOID) | ||
| 13 | { | ||
| 14 | switch(ulReason) | ||
| 15 | { | ||
| 16 | case DLL_PROCESS_ATTACH: | ||
| 17 | WcaGlobalInitialize(hInst); | ||
| 18 | break; | ||
| 19 | |||
| 20 | case DLL_PROCESS_DETACH: | ||
| 21 | WcaGlobalFinalize(); | ||
| 22 | break; | ||
| 23 | } | ||
| 24 | |||
| 25 | return TRUE; | ||
| 26 | } | ||
diff --git a/src/ca/packages.config b/src/ca/packages.config new file mode 100644 index 00000000..b74ff5d0 --- /dev/null +++ b/src/ca/packages.config | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <packages> | ||
| 3 | <package id="Microsoft.VisualStudio.Setup.Configuration.Native" version="1.14.114" targetFramework="native" developmentDependency="true" /> | ||
| 4 | <package id="WixToolset.DUtil" version="4.0.6" targetFramework="native" /> | ||
| 5 | <package id="WixToolset.WcaUtil" version="4.0.2" targetFramework="native" /> | ||
| 6 | </packages> \ No newline at end of file | ||
diff --git a/src/ca/precomp.h b/src/ca/precomp.h new file mode 100644 index 00000000..3edad7ed --- /dev/null +++ b/src/ca/precomp.h | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | #pragma once | ||
| 2 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 3 | |||
| 4 | |||
| 5 | #include <windows.h> | ||
| 6 | #include <msiquery.h> | ||
| 7 | |||
| 8 | #define MAXUINT USHRT_MAX | ||
| 9 | #include <Setup.Configuration.h> | ||
| 10 | |||
| 11 | #include "wcautil.h" | ||
| 12 | #include "fileutil.h" | ||
| 13 | #include "strutil.h" | ||
diff --git a/src/ca/sqlca.cpp b/src/ca/sqlca.cpp new file mode 100644 index 00000000..37664a1c --- /dev/null +++ b/src/ca/sqlca.cpp | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | #include "precomp.h" | ||
diff --git a/src/ca/sqlca.def b/src/ca/sqlca.def new file mode 100644 index 00000000..e16626b3 --- /dev/null +++ b/src/ca/sqlca.def | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | ; Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | |||
| 4 | LIBRARY "sqlca" | ||
| 5 | |||
| 6 | EXPORTS | ||
| 7 | |||
diff --git a/src/ca/sqlca.vcxproj b/src/ca/sqlca.vcxproj new file mode 100644 index 00000000..3d638f6e --- /dev/null +++ b/src/ca/sqlca.vcxproj | |||
| @@ -0,0 +1,70 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
| 3 | |||
| 4 | <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| 5 | <Import Project="..\..\packages\WixToolset.DUtil.4.0.6\build\WixToolset.DUtil.props" Condition="Exists('..\..\packages\WixToolset.DUtil.4.0.6\build\WixToolset.DUtil.props')" /> | ||
| 6 | <Import Project="..\..\packages\WixToolset.WcaUtil.4.0.2\build\WixToolset.WcaUtil.props" Condition="Exists('..\..\packages\WixToolset.WcaUtil.4.0.2\build\WixToolset.WcaUtil.props')" /> | ||
| 7 | |||
| 8 | <ItemGroup Label="ProjectConfigurations"> | ||
| 9 | <ProjectConfiguration Include="Debug|Win32"> | ||
| 10 | <Configuration>Debug</Configuration> | ||
| 11 | <Platform>Win32</Platform> | ||
| 12 | </ProjectConfiguration> | ||
| 13 | <ProjectConfiguration Include="Release|Win32"> | ||
| 14 | <Configuration>Release</Configuration> | ||
| 15 | <Platform>Win32</Platform> | ||
| 16 | </ProjectConfiguration> | ||
| 17 | </ItemGroup> | ||
| 18 | |||
| 19 | <PropertyGroup Label="Globals"> | ||
| 20 | <ProjectGuid>{4DCA6E4B-A1F1-4450-BC2D-94AC20F31935}</ProjectGuid> | ||
| 21 | <ConfigurationType>DynamicLibrary</ConfigurationType> | ||
| 22 | <TargetName>sqlca</TargetName> | ||
| 23 | <PlatformToolset>v141</PlatformToolset> | ||
| 24 | <CharacterSet>Unicode</CharacterSet> | ||
| 25 | <ProjectModuleDefinitionFile>sqlca.def</ProjectModuleDefinitionFile> | ||
| 26 | <Description>WiX Toolset Sql CustomAction</Description> | ||
| 27 | <WindowsTargetPlatformVersion Condition="'$(WindowsTargetPlatformVersion)' == ''">$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</WindowsTargetPlatformVersion> | ||
| 28 | </PropertyGroup> | ||
| 29 | |||
| 30 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||
| 31 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||
| 32 | |||
| 33 | <ImportGroup Label="ExtensionSettings"> | ||
| 34 | </ImportGroup> | ||
| 35 | |||
| 36 | <ImportGroup Label="Shared"> | ||
| 37 | <Import Project="..\..\packages\Microsoft.VisualStudio.Setup.Configuration.Native.1.14.114\build\native\Microsoft.VisualStudio.Setup.Configuration.Native.targets" Condition="Exists('..\..\packages\Microsoft.VisualStudio.Setup.Configuration.Native.1.14.114\build\native\Microsoft.VisualStudio.Setup.Configuration.Native.targets')" /> | ||
| 38 | </ImportGroup> | ||
| 39 | |||
| 40 | <PropertyGroup> | ||
| 41 | <ProjectAdditionalLinkLibraries>msi.lib</ProjectAdditionalLinkLibraries> | ||
| 42 | </PropertyGroup> | ||
| 43 | |||
| 44 | <ItemGroup> | ||
| 45 | <ClCompile Include="dllmain.cpp"> | ||
| 46 | <PrecompiledHeader>Create</PrecompiledHeader> | ||
| 47 | </ClCompile> | ||
| 48 | <ClCompile Include="sqlca.cpp" /> | ||
| 49 | </ItemGroup> | ||
| 50 | |||
| 51 | <ItemGroup> | ||
| 52 | <ClInclude Include="precomp.h" /> | ||
| 53 | </ItemGroup> | ||
| 54 | |||
| 55 | <ItemGroup> | ||
| 56 | <None Include="packages.config" /> | ||
| 57 | <None Include="sqlca.def" /> | ||
| 58 | </ItemGroup> | ||
| 59 | |||
| 60 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||
| 61 | |||
| 62 | <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> | ||
| 63 | <PropertyGroup> | ||
| 64 | <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> | ||
| 65 | </PropertyGroup> | ||
| 66 | <Error Condition="!Exists('..\..\packages\Microsoft.VisualStudio.Setup.Configuration.Native.1.14.114\build\native\Microsoft.VisualStudio.Setup.Configuration.Native.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.VisualStudio.Setup.Configuration.Native.1.14.114\build\native\Microsoft.VisualStudio.Setup.Configuration.Native.targets'))" /> | ||
| 67 | <Error Condition="!Exists('..\..\packages\WixToolset.DUtil.4.0.6\build\WixToolset.DUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.DUtil.4.0.6\build\WixToolset.DUtil.props'))" /> | ||
| 68 | <Error Condition="!Exists('..\..\packages\WixToolset.WcaUtil.4.0.2\build\WixToolset.WcaUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.WcaUtil.4.0.2\build\WixToolset.WcaUtil.props'))" /> | ||
| 69 | </Target> | ||
| 70 | </Project> | ||
diff --git a/src/test/WixToolsetTest.Sql/SqlExtensionFixture.cs b/src/test/WixToolsetTest.Sql/SqlExtensionFixture.cs new file mode 100644 index 00000000..831bcd83 --- /dev/null +++ b/src/test/WixToolsetTest.Sql/SqlExtensionFixture.cs | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | namespace WixToolsetTest.Sql | ||
| 4 | { | ||
| 5 | using System.Linq; | ||
| 6 | using WixBuildTools.TestSupport; | ||
| 7 | using WixToolset.Core.TestPackage; | ||
| 8 | using WixToolset.Sql; | ||
| 9 | using Xunit; | ||
| 10 | |||
| 11 | public class SqlExtensionFixture | ||
| 12 | { | ||
| 13 | [Fact] | ||
| 14 | public void CanBuildUsingSqlString() | ||
| 15 | { | ||
| 16 | var folder = TestData.Get(@"TestData\UsingSql"); | ||
| 17 | var build = new Builder(folder, typeof(SqlExtensionFactory), new[] { folder }); | ||
| 18 | |||
| 19 | var results = build.BuildAndQuery(Build, "SqlString"); | ||
| 20 | Assert.Equal(new[] | ||
| 21 | { | ||
| 22 | "SqlString:", | ||
| 23 | }, results.OrderBy(s => s).ToArray()); | ||
| 24 | } | ||
| 25 | |||
| 26 | private static void Build(string[] args) | ||
| 27 | { | ||
| 28 | var result = WixRunner.Execute(args) | ||
| 29 | .AssertSuccess(); | ||
| 30 | } | ||
| 31 | } | ||
| 32 | } | ||
diff --git a/src/test/WixToolsetTest.Sql/TestData/UsingSql/Package.en-us.wxl b/src/test/WixToolsetTest.Sql/TestData/UsingSql/Package.en-us.wxl new file mode 100644 index 00000000..38c12ac1 --- /dev/null +++ b/src/test/WixToolsetTest.Sql/TestData/UsingSql/Package.en-us.wxl | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | |||
| 3 | <!-- | ||
| 4 | This file contains the declaration of all the localizable strings. | ||
| 5 | --> | ||
| 6 | <WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="en-US"> | ||
| 7 | |||
| 8 | <String Id="DowngradeError">A newer version of [ProductName] is already installed.</String> | ||
| 9 | <String Id="FeatureTitle">MsiPackage</String> | ||
| 10 | |||
| 11 | </WixLocalization> | ||
diff --git a/src/test/WixToolsetTest.Sql/TestData/UsingSql/Package.wxs b/src/test/WixToolsetTest.Sql/TestData/UsingSql/Package.wxs new file mode 100644 index 00000000..68ff98fd --- /dev/null +++ b/src/test/WixToolsetTest.Sql/TestData/UsingSql/Package.wxs | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
| 3 | <Product Id="*" Name="MsiPackage" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a"> | ||
| 4 | <Package InstallerVersion="200" Compressed="no" InstallScope="perMachine" /> | ||
| 5 | |||
| 6 | <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" /> | ||
| 7 | <MediaTemplate /> | ||
| 8 | |||
| 9 | <Feature Id="ProductFeature" Title="!(loc.FeatureTitle)"> | ||
| 10 | <ComponentGroupRef Id="ProductComponents" /> | ||
| 11 | </Feature> | ||
| 12 | |||
| 13 | </Product> | ||
| 14 | |||
| 15 | <Fragment> | ||
| 16 | <Directory Id="TARGETDIR" Name="SourceDir"> | ||
| 17 | <Directory Id="ProgramFilesFolder"> | ||
| 18 | <Directory Id="INSTALLFOLDER" Name="MsiPackage" /> | ||
| 19 | </Directory> | ||
| 20 | </Directory> | ||
| 21 | </Fragment> | ||
| 22 | </Wix> | ||
diff --git a/src/test/WixToolsetTest.Sql/TestData/UsingSql/PackageComponents.wxs b/src/test/WixToolsetTest.Sql/TestData/UsingSql/PackageComponents.wxs new file mode 100644 index 00000000..d2572659 --- /dev/null +++ b/src/test/WixToolsetTest.Sql/TestData/UsingSql/PackageComponents.wxs | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" | ||
| 3 | xmlns:sql="http://wixtoolset.org/schemas/v4/wxs/sql"> | ||
| 4 | <Fragment> | ||
| 5 | <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"> | ||
| 6 | <Component KeyPath="yes"> | ||
| 7 | <CreateFolder /> | ||
| 8 | <sql:SqlDatabase Id="TestDB" Database="MyDB" Server="MySQLHostName" Instance="MyInstanceName" CreateOnInstall="yes" DropOnUninstall="yes" ConfirmOverwrite="yes"> | ||
| 9 | <sql:SqlString Id="TestString" SQL="CREATE TABLE TestTable1(name varchar(20), value varchar(20))" ExecuteOnInstall="yes" /> | ||
| 10 | </sql:SqlDatabase> | ||
| 11 | </Component> | ||
| 12 | </ComponentGroup> | ||
| 13 | </Fragment> | ||
| 14 | </Wix> | ||
diff --git a/src/test/WixToolsetTest.Sql/TestData/UsingSql/example.txt b/src/test/WixToolsetTest.Sql/TestData/UsingSql/example.txt new file mode 100644 index 00000000..1b4ffe8a --- /dev/null +++ b/src/test/WixToolsetTest.Sql/TestData/UsingSql/example.txt | |||
| @@ -0,0 +1 @@ | |||
| This is example.txt. \ No newline at end of file | |||
diff --git a/src/test/WixToolsetTest.Sql/WixToolsetTest.Sql.csproj b/src/test/WixToolsetTest.Sql/WixToolsetTest.Sql.csproj new file mode 100644 index 00000000..6efa50a3 --- /dev/null +++ b/src/test/WixToolsetTest.Sql/WixToolsetTest.Sql.csproj | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
| 3 | |||
| 4 | <Project Sdk="Microsoft.NET.Sdk"> | ||
| 5 | <PropertyGroup> | ||
| 6 | <TargetFramework>netcoreapp2.1</TargetFramework> | ||
| 7 | <IsPackable>false</IsPackable> | ||
| 8 | </PropertyGroup> | ||
| 9 | |||
| 10 | <PropertyGroup> | ||
| 11 | <NoWarn>NU1701</NoWarn> | ||
| 12 | </PropertyGroup> | ||
| 13 | |||
| 14 | <ItemGroup> | ||
| 15 | <Content Include="TestData\UsingSql\example.txt" CopyToOutputDirectory="PreserveNewest" /> | ||
| 16 | <Content Include="TestData\UsingSql\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> | ||
| 17 | <Content Include="TestData\UsingSql\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> | ||
| 18 | <Content Include="TestData\UsingSql\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" /> | ||
| 19 | </ItemGroup> | ||
| 20 | |||
| 21 | <ItemGroup> | ||
| 22 | <ProjectReference Include="..\..\wixext\WixToolset.Sql.wixext.csproj" /> | ||
| 23 | </ItemGroup> | ||
| 24 | |||
| 25 | <ItemGroup> | ||
| 26 | <PackageReference Include="WixToolset.Core.TestPackage" Version="4.0.*" Condition=" '$(Configuration)' == 'Release' Or !Exists('$(WixToolsetRootFolder)\Core\README.md') " PrivateAssets="all" /> | ||
| 27 | <ProjectReference Include="$(WixToolsetRootFolder)\Core\src\WixToolset.Core.TestPackage\WixToolset.Core.TestPackage.csproj" Condition=" '$(Configuration)' == 'Debug' And Exists('$(WixToolsetRootFolder)\Core\README.md') " /> | ||
| 28 | <ProjectReference Include="$(WixToolsetRootFolder)\Core\src\WixToolset.Core\WixToolset.Core.csproj" Condition=" '$(Configuration)' == 'Debug' And Exists('$(WixToolsetRootFolder)\Core\README.md') " /> | ||
| 29 | <ProjectReference Include="$(WixToolsetRootFolder)\Core\src\WixToolset.Core.Burn\WixToolset.Core.Burn.csproj" Condition=" '$(Configuration)' == 'Debug' And Exists('$(WixToolsetRootFolder)\Core\README.md') " /> | ||
| 30 | <ProjectReference Include="$(WixToolsetRootFolder)\Core\src\WixToolset.Core.WindowsInstaller\WixToolset.Core.WindowsInstaller.csproj" Condition=" '$(Configuration)' == 'Debug' And Exists('$(WixToolsetRootFolder)\Core\README.md') " /> | ||
| 31 | </ItemGroup> | ||
| 32 | |||
| 33 | <ItemGroup> | ||
| 34 | <PackageReference Include="WixBuildTools.TestSupport" Version="4.0.*" /> | ||
| 35 | </ItemGroup> | ||
| 36 | |||
| 37 | <ItemGroup> | ||
| 38 | <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" /> | ||
| 39 | <PackageReference Include="xunit" Version="2.4.0" /> | ||
| 40 | <PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" /> | ||
| 41 | </ItemGroup> | ||
| 42 | </Project> | ||
diff --git a/src/wixext/SqlCompiler.cs b/src/wixext/SqlCompiler.cs index eecfbba0..c789f3bd 100644 --- a/src/wixext/SqlCompiler.cs +++ b/src/wixext/SqlCompiler.cs | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. |
| 2 | 2 | ||
| 3 | namespace WixToolset.Extensions | 3 | namespace WixToolset.Sql |
| 4 | { | 4 | { |
| 5 | using System; | 5 | using System; |
| 6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
| @@ -11,7 +11,7 @@ namespace WixToolset.Extensions | |||
| 11 | /// <summary> | 11 | /// <summary> |
| 12 | /// The compiler for the WiX Toolset SQL Server Extension. | 12 | /// The compiler for the WiX Toolset SQL Server Extension. |
| 13 | /// </summary> | 13 | /// </summary> |
| 14 | public sealed class SqlCompiler : CompilerExtension | 14 | public sealed class SqlCompiler : BaseCompilerExtension |
| 15 | { | 15 | { |
| 16 | // sql database attributes definitions (from sca.h) | 16 | // sql database attributes definitions (from sca.h) |
| 17 | internal const int DbCreateOnInstall = 0x00000001; | 17 | internal const int DbCreateOnInstall = 0x00000001; |
| @@ -30,22 +30,17 @@ namespace WixToolset.Extensions | |||
| 30 | internal const int SqlRollback = 0x00000008; | 30 | internal const int SqlRollback = 0x00000008; |
| 31 | internal const int SqlExecuteOnReinstall = 0x00000010; | 31 | internal const int SqlExecuteOnReinstall = 0x00000010; |
| 32 | 32 | ||
| 33 | /// <summary> | 33 | public override XNamespace Namespace => "http://wixtoolset.org/schemas/v4/wxs/sql"; |
| 34 | /// Instantiate a new SqlCompiler. | ||
| 35 | /// </summary> | ||
| 36 | public SqlCompiler() | ||
| 37 | { | ||
| 38 | this.Namespace = "http://wixtoolset.org/schemas/v4/wxs/sql"; | ||
| 39 | } | ||
| 40 | 34 | ||
| 41 | /// <summary> | 35 | /// <summary> |
| 42 | /// Processes an element for the Compiler. | 36 | /// Processes an element for the Compiler. |
| 43 | /// </summary> | 37 | /// </summary> |
| 44 | /// <param name="sourceLineNumbers">Source line number for the parent element.</param> | 38 | /// <param name="intermediate"></param> |
| 39 | /// <param name="section"></param> | ||
| 45 | /// <param name="parentElement">Parent element of element to process.</param> | 40 | /// <param name="parentElement">Parent element of element to process.</param> |
| 46 | /// <param name="element">Element to process.</param> | 41 | /// <param name="element">Element to process.</param> |
| 47 | /// <param name="contextValues">Extra information about the context in which this element is being parsed.</param> | 42 | /// <param name="context">Extra information about the context in which this element is being parsed.</param> |
| 48 | public override void ParseElement(XElement parentElement, XElement element, IDictionary<string, string> context) | 43 | public override void ParseElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary<string, string> context) |
| 49 | { | 44 | { |
| 50 | switch (parentElement.Name.LocalName) | 45 | switch (parentElement.Name.LocalName) |
| 51 | { | 46 | { |
| @@ -56,16 +51,16 @@ namespace WixToolset.Extensions | |||
| 56 | switch (element.Name.LocalName) | 51 | switch (element.Name.LocalName) |
| 57 | { | 52 | { |
| 58 | case "SqlDatabase": | 53 | case "SqlDatabase": |
| 59 | this.ParseSqlDatabaseElement(element, componentId); | 54 | this.ParseSqlDatabaseElement(intermediate, section, element, componentId); |
| 60 | break; | 55 | break; |
| 61 | case "SqlScript": | 56 | case "SqlScript": |
| 62 | this.ParseSqlScriptElement(element, componentId, null); | 57 | this.ParseSqlScriptElement(intermediate, section, element, componentId, null); |
| 63 | break; | 58 | break; |
| 64 | case "SqlString": | 59 | case "SqlString": |
| 65 | this.ParseSqlStringElement(element, componentId, null); | 60 | this.ParseSqlStringElement(intermediate, section, element, componentId, null); |
| 66 | break; | 61 | break; |
| 67 | default: | 62 | default: |
| 68 | this.Core.UnexpectedElement(parentElement, element); | 63 | this.ParseHelper.UnexpectedElement(parentElement, element); |
| 69 | break; | 64 | break; |
| 70 | } | 65 | } |
| 71 | break; | 66 | break; |
| @@ -75,15 +70,15 @@ namespace WixToolset.Extensions | |||
| 75 | switch (element.Name.LocalName) | 70 | switch (element.Name.LocalName) |
| 76 | { | 71 | { |
| 77 | case "SqlDatabase": | 72 | case "SqlDatabase": |
| 78 | this.ParseSqlDatabaseElement(element, null); | 73 | this.ParseSqlDatabaseElement(intermediate, section, element, null); |
| 79 | break; | 74 | break; |
| 80 | default: | 75 | default: |
| 81 | this.Core.UnexpectedElement(parentElement, element); | 76 | this.ParseHelper.UnexpectedElement(parentElement, element); |
| 82 | break; | 77 | break; |
| 83 | } | 78 | } |
| 84 | break; | 79 | break; |
| 85 | default: | 80 | default: |
| 86 | this.Core.UnexpectedElement(parentElement, element); | 81 | this.ParseHelper.UnexpectedElement(parentElement, element); |
| 87 | break; | 82 | break; |
| 88 | } | 83 | } |
| 89 | } | 84 | } |
| @@ -91,36 +86,38 @@ namespace WixToolset.Extensions | |||
| 91 | /// <summary> | 86 | /// <summary> |
| 92 | /// Parses a sql database element | 87 | /// Parses a sql database element |
| 93 | /// </summary> | 88 | /// </summary> |
| 94 | /// <param name="node">Element to parse.</param> | 89 | /// <param name="intermediate"></param> |
| 90 | /// <param name="section"></param> | ||
| 91 | /// <param name="element">Element to parse.</param> | ||
| 95 | /// <param name="componentId">Identifier for parent component.</param> | 92 | /// <param name="componentId">Identifier for parent component.</param> |
| 96 | private void ParseSqlDatabaseElement(XElement node, string componentId) | 93 | private void ParseSqlDatabaseElement(Intermediate intermediate, IntermediateSection section, XElement element, string componentId) |
| 97 | { | 94 | { |
| 98 | SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); | 95 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); |
| 99 | string id = null; | 96 | Identifier id = null; |
| 100 | int attributes = 0; | 97 | int attributes = 0; |
| 101 | string database = null; | 98 | string database = null; |
| 102 | string fileSpec = null; | 99 | Identifier fileSpec = null; |
| 103 | string instance = null; | 100 | string instance = null; |
| 104 | string logFileSpec = null; | 101 | Identifier logFileSpec = null; |
| 105 | string server = null; | 102 | string server = null; |
| 106 | string user = null; | 103 | string user = null; |
| 107 | 104 | ||
| 108 | foreach (XAttribute attrib in node.Attributes()) | 105 | foreach (XAttribute attrib in element.Attributes()) |
| 109 | { | 106 | { |
| 110 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) | 107 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) |
| 111 | { | 108 | { |
| 112 | switch (attrib.Name.LocalName) | 109 | switch (attrib.Name.LocalName) |
| 113 | { | 110 | { |
| 114 | case "Id": | 111 | case "Id": |
| 115 | id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); | 112 | id = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); |
| 116 | break; | 113 | break; |
| 117 | case "ConfirmOverwrite": | 114 | case "ConfirmOverwrite": |
| 118 | if (null == componentId) | 115 | if (null == componentId) |
| 119 | { | 116 | { |
| 120 | this.Core.OnMessage(SqlErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); | 117 | this.Messaging.Write(SqlErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName)); |
| 121 | } | 118 | } |
| 122 | 119 | ||
| 123 | if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) | 120 | if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) |
| 124 | { | 121 | { |
| 125 | attributes |= DbConfirmOverwrite; | 122 | attributes |= DbConfirmOverwrite; |
| 126 | } | 123 | } |
| @@ -128,10 +125,10 @@ namespace WixToolset.Extensions | |||
| 128 | case "ContinueOnError": | 125 | case "ContinueOnError": |
| 129 | if (null == componentId) | 126 | if (null == componentId) |
| 130 | { | 127 | { |
| 131 | this.Core.OnMessage(SqlErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); | 128 | this.Messaging.Write(SqlErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName)); |
| 132 | } | 129 | } |
| 133 | 130 | ||
| 134 | if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) | 131 | if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) |
| 135 | { | 132 | { |
| 136 | attributes |= DbContinueOnError; | 133 | attributes |= DbContinueOnError; |
| 137 | } | 134 | } |
| @@ -139,10 +136,10 @@ namespace WixToolset.Extensions | |||
| 139 | case "CreateOnInstall": | 136 | case "CreateOnInstall": |
| 140 | if (null == componentId) | 137 | if (null == componentId) |
| 141 | { | 138 | { |
| 142 | this.Core.OnMessage(SqlErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); | 139 | this.Messaging.Write(SqlErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName)); |
| 143 | } | 140 | } |
| 144 | 141 | ||
| 145 | if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) | 142 | if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) |
| 146 | { | 143 | { |
| 147 | attributes |= DbCreateOnInstall; | 144 | attributes |= DbCreateOnInstall; |
| 148 | } | 145 | } |
| @@ -150,10 +147,10 @@ namespace WixToolset.Extensions | |||
| 150 | case "CreateOnReinstall": | 147 | case "CreateOnReinstall": |
| 151 | if (null == componentId) | 148 | if (null == componentId) |
| 152 | { | 149 | { |
| 153 | this.Core.OnMessage(SqlErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); | 150 | this.Messaging.Write(SqlErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName)); |
| 154 | } | 151 | } |
| 155 | 152 | ||
| 156 | if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) | 153 | if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) |
| 157 | { | 154 | { |
| 158 | attributes |= DbCreateOnReinstall; | 155 | attributes |= DbCreateOnReinstall; |
| 159 | } | 156 | } |
| @@ -161,24 +158,24 @@ namespace WixToolset.Extensions | |||
| 161 | case "CreateOnUninstall": | 158 | case "CreateOnUninstall": |
| 162 | if (null == componentId) | 159 | if (null == componentId) |
| 163 | { | 160 | { |
| 164 | this.Core.OnMessage(SqlErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); | 161 | this.Messaging.Write(SqlErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName)); |
| 165 | } | 162 | } |
| 166 | 163 | ||
| 167 | if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) | 164 | if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) |
| 168 | { | 165 | { |
| 169 | attributes |= DbCreateOnUninstall; | 166 | attributes |= DbCreateOnUninstall; |
| 170 | } | 167 | } |
| 171 | break; | 168 | break; |
| 172 | case "Database": | 169 | case "Database": |
| 173 | database = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 170 | database = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| 174 | break; | 171 | break; |
| 175 | case "DropOnInstall": | 172 | case "DropOnInstall": |
| 176 | if (null == componentId) | 173 | if (null == componentId) |
| 177 | { | 174 | { |
| 178 | this.Core.OnMessage(SqlErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); | 175 | this.Messaging.Write(SqlErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName)); |
| 179 | } | 176 | } |
| 180 | 177 | ||
| 181 | if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) | 178 | if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) |
| 182 | { | 179 | { |
| 183 | attributes |= DbDropOnInstall; | 180 | attributes |= DbDropOnInstall; |
| 184 | } | 181 | } |
| @@ -186,10 +183,10 @@ namespace WixToolset.Extensions | |||
| 186 | case "DropOnReinstall": | 183 | case "DropOnReinstall": |
| 187 | if (null == componentId) | 184 | if (null == componentId) |
| 188 | { | 185 | { |
| 189 | this.Core.OnMessage(SqlErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); | 186 | this.Messaging.Write(SqlErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName)); |
| 190 | } | 187 | } |
| 191 | 188 | ||
| 192 | if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) | 189 | if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) |
| 193 | { | 190 | { |
| 194 | attributes |= DbDropOnReinstall; | 191 | attributes |= DbDropOnReinstall; |
| 195 | } | 192 | } |
| @@ -198,142 +195,141 @@ namespace WixToolset.Extensions | |||
| 198 | case "DropOnUninstall": | 195 | case "DropOnUninstall": |
| 199 | if (null == componentId) | 196 | if (null == componentId) |
| 200 | { | 197 | { |
| 201 | this.Core.OnMessage(SqlErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); | 198 | this.Messaging.Write(SqlErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName)); |
| 202 | } | 199 | } |
| 203 | 200 | ||
| 204 | if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) | 201 | if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) |
| 205 | { | 202 | { |
| 206 | attributes |= DbDropOnUninstall; | 203 | attributes |= DbDropOnUninstall; |
| 207 | } | 204 | } |
| 208 | break; | 205 | break; |
| 209 | case "Instance": | 206 | case "Instance": |
| 210 | instance = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 207 | instance = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| 211 | break; | 208 | break; |
| 212 | case "Server": | 209 | case "Server": |
| 213 | server = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 210 | server = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| 214 | break; | 211 | break; |
| 215 | case "User": | 212 | case "User": |
| 216 | user = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 213 | user = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| 217 | if (!this.Core.ContainsProperty(user)) | 214 | if (!this.ParseHelper.ContainsProperty(user)) |
| 218 | { | 215 | { |
| 219 | user = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); | 216 | user = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); |
| 220 | this.Core.CreateSimpleReference(sourceLineNumbers, "User", user); | 217 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "User", user); |
| 221 | } | 218 | } |
| 222 | break; | 219 | break; |
| 223 | default: | 220 | default: |
| 224 | this.Core.UnexpectedAttribute(node, attrib); | 221 | this.ParseHelper.UnexpectedAttribute(element, attrib); |
| 225 | break; | 222 | break; |
| 226 | } | 223 | } |
| 227 | } | 224 | } |
| 228 | else | 225 | else |
| 229 | { | 226 | { |
| 230 | this.Core.ParseExtensionAttribute(node, attrib); | 227 | this.ParseHelper.ParseExtensionAttribute(this.Context.Extensions, intermediate, section, element, attrib); |
| 231 | } | 228 | } |
| 232 | } | 229 | } |
| 233 | 230 | ||
| 234 | if (null == id) | 231 | if (null == id) |
| 235 | { | 232 | { |
| 236 | this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); | 233 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Id")); |
| 237 | } | 234 | } |
| 238 | 235 | ||
| 239 | if (null == database) | 236 | if (null == database) |
| 240 | { | 237 | { |
| 241 | this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Database")); | 238 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Database")); |
| 242 | } | 239 | } |
| 243 | else if (128 < database.Length) | 240 | else if (128 < database.Length) |
| 244 | { | 241 | { |
| 245 | this.Core.OnMessage(WixErrors.IdentifierTooLongError(sourceLineNumbers, node.Name.LocalName, "Database", database, 128)); | 242 | this.Messaging.Write(ErrorMessages.IdentifierTooLongError(sourceLineNumbers, element.Name.LocalName, "Database", database, 128)); |
| 246 | } | 243 | } |
| 247 | 244 | ||
| 248 | if (null == server) | 245 | if (null == server) |
| 249 | { | 246 | { |
| 250 | this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Server")); | 247 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Server")); |
| 251 | } | 248 | } |
| 252 | 249 | ||
| 253 | if (0 == attributes && null != componentId) | 250 | if (0 == attributes && null != componentId) |
| 254 | { | 251 | { |
| 255 | this.Core.OnMessage(SqlErrors.OneOfAttributesRequiredUnderComponent(sourceLineNumbers, node.Name.LocalName, "CreateOnInstall", "CreateOnUninstall", "DropOnInstall", "DropOnUninstall")); | 252 | this.Messaging.Write(SqlErrors.OneOfAttributesRequiredUnderComponent(sourceLineNumbers, element.Name.LocalName, "CreateOnInstall", "CreateOnUninstall", "DropOnInstall", "DropOnUninstall")); |
| 256 | } | 253 | } |
| 257 | 254 | ||
| 258 | foreach (XElement child in node.Elements()) | 255 | foreach (XElement child in element.Elements()) |
| 259 | { | 256 | { |
| 260 | if (this.Namespace == child.Name.Namespace) | 257 | if (this.Namespace == child.Name.Namespace) |
| 261 | { | 258 | { |
| 262 | SourceLineNumber childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); | 259 | SourceLineNumber childSourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(child); |
| 263 | switch (child.Name.LocalName) | 260 | switch (child.Name.LocalName) |
| 264 | { | 261 | { |
| 265 | case "SqlScript": | 262 | case "SqlScript": |
| 266 | if (null == componentId) | 263 | if (null == componentId) |
| 267 | { | 264 | { |
| 268 | this.Core.OnMessage(SqlErrors.IllegalElementWithoutComponent(childSourceLineNumbers, child.Name.LocalName)); | 265 | this.Messaging.Write(SqlErrors.IllegalElementWithoutComponent(childSourceLineNumbers, child.Name.LocalName)); |
| 269 | } | 266 | } |
| 270 | 267 | ||
| 271 | this.ParseSqlScriptElement(child, componentId, id); | 268 | this.ParseSqlScriptElement(intermediate, section, child, componentId, id.Id); |
| 272 | break; | 269 | break; |
| 273 | case "SqlString": | 270 | case "SqlString": |
| 274 | if (null == componentId) | 271 | if (null == componentId) |
| 275 | { | 272 | { |
| 276 | this.Core.OnMessage(SqlErrors.IllegalElementWithoutComponent(childSourceLineNumbers, child.Name.LocalName)); | 273 | this.Messaging.Write(SqlErrors.IllegalElementWithoutComponent(childSourceLineNumbers, child.Name.LocalName)); |
| 277 | } | 274 | } |
| 278 | 275 | ||
| 279 | this.ParseSqlStringElement(child, componentId, id); | 276 | this.ParseSqlStringElement(intermediate, section, child, componentId, id.Id); |
| 280 | break; | 277 | break; |
| 281 | case "SqlFileSpec": | 278 | case "SqlFileSpec": |
| 282 | if (null == componentId) | 279 | if (null == componentId) |
| 283 | { | 280 | { |
| 284 | this.Core.OnMessage(SqlErrors.IllegalElementWithoutComponent(childSourceLineNumbers, child.Name.LocalName)); | 281 | this.Messaging.Write(SqlErrors.IllegalElementWithoutComponent(childSourceLineNumbers, child.Name.LocalName)); |
| 285 | } | 282 | } |
| 286 | else if (null != fileSpec) | 283 | else if (null != fileSpec) |
| 287 | { | 284 | { |
| 288 | this.Core.OnMessage(WixErrors.TooManyElements(sourceLineNumbers, node.Name.LocalName, child.Name.LocalName, 1)); | 285 | this.Messaging.Write(ErrorMessages.TooManyElements(sourceLineNumbers, element.Name.LocalName, child.Name.LocalName, 1)); |
| 289 | } | 286 | } |
| 290 | 287 | ||
| 291 | fileSpec = this.ParseSqlFileSpecElement(child); | 288 | fileSpec = this.ParseSqlFileSpecElement(intermediate, section, child); |
| 292 | break; | 289 | break; |
| 293 | case "SqlLogFileSpec": | 290 | case "SqlLogFileSpec": |
| 294 | if (null == componentId) | 291 | if (null == componentId) |
| 295 | { | 292 | { |
| 296 | this.Core.OnMessage(SqlErrors.IllegalElementWithoutComponent(childSourceLineNumbers, child.Name.LocalName)); | 293 | this.Messaging.Write(SqlErrors.IllegalElementWithoutComponent(childSourceLineNumbers, child.Name.LocalName)); |
| 297 | } | 294 | } |
| 298 | else if (null != logFileSpec) | 295 | else if (null != logFileSpec) |
| 299 | { | 296 | { |
| 300 | this.Core.OnMessage(WixErrors.TooManyElements(sourceLineNumbers, node.Name.LocalName, child.Name.LocalName, 1)); | 297 | this.Messaging.Write(ErrorMessages.TooManyElements(sourceLineNumbers, element.Name.LocalName, child.Name.LocalName, 1)); |
| 301 | } | 298 | } |
| 302 | 299 | ||
| 303 | logFileSpec = this.ParseSqlFileSpecElement(child); | 300 | logFileSpec = this.ParseSqlFileSpecElement(intermediate, section, child); |
| 304 | break; | 301 | break; |
| 305 | default: | 302 | default: |
| 306 | this.Core.UnexpectedElement(node, child); | 303 | this.ParseHelper.UnexpectedElement(element, child); |
| 307 | break; | 304 | break; |
| 308 | } | 305 | } |
| 309 | } | 306 | } |
| 310 | else | 307 | else |
| 311 | { | 308 | { |
| 312 | this.Core.ParseExtensionElement(node, child); | 309 | this.ParseHelper.ParseExtensionElement(this.Context.Extensions, intermediate, section, element, child); |
| 313 | } | 310 | } |
| 314 | } | 311 | } |
| 315 | 312 | ||
| 316 | if (null != componentId) | 313 | if (null != componentId) |
| 317 | { | 314 | { |
| 318 | // Reference InstallSqlData and UninstallSqlData since nothing will happen without it | 315 | // Reference InstallSqlData and UninstallSqlData since nothing will happen without it |
| 319 | this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "InstallSqlData"); | 316 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "InstallSqlData"); |
| 320 | this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "UninstallSqlData"); | 317 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "UninstallSqlData"); |
| 321 | } | 318 | } |
| 322 | 319 | ||
| 323 | if (!this.Core.EncounteredError) | 320 | if (!this.Messaging.EncounteredError) |
| 324 | { | 321 | { |
| 325 | Row row = this.Core.CreateRow(sourceLineNumbers, "SqlDatabase"); | 322 | var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "SqlDatabase", id); |
| 326 | row[0] = id; | 323 | row.Set(1, server); |
| 327 | row[1] = server; | 324 | row.Set(2, instance); |
| 328 | row[2] = instance; | 325 | row.Set(3, database); |
| 329 | row[3] = database; | 326 | row.Set(4, componentId); |
| 330 | row[4] = componentId; | 327 | row.Set(5, user); |
| 331 | row[5] = user; | 328 | row.Set(6, fileSpec.Id); |
| 332 | row[6] = fileSpec; | 329 | row.Set(7, logFileSpec.Id); |
| 333 | row[7] = logFileSpec; | ||
| 334 | if (0 != attributes) | 330 | if (0 != attributes) |
| 335 | { | 331 | { |
| 336 | row[8] = attributes; | 332 | row.Set(8, attributes); |
| 337 | } | 333 | } |
| 338 | } | 334 | } |
| 339 | } | 335 | } |
| @@ -341,89 +337,90 @@ namespace WixToolset.Extensions | |||
| 341 | /// <summary> | 337 | /// <summary> |
| 342 | /// Parses a sql file specification element. | 338 | /// Parses a sql file specification element. |
| 343 | /// </summary> | 339 | /// </summary> |
| 344 | /// <param name="node">Element to parse.</param> | 340 | /// <param name="intermediate"></param> |
| 341 | /// <param name="section"></param> | ||
| 342 | /// <param name="element">Element to parse.</param> | ||
| 345 | /// <returns>Identifier of sql file specification.</returns> | 343 | /// <returns>Identifier of sql file specification.</returns> |
| 346 | private string ParseSqlFileSpecElement(XElement node) | 344 | private Identifier ParseSqlFileSpecElement(Intermediate intermediate, IntermediateSection section, XElement element) |
| 347 | { | 345 | { |
| 348 | SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); | 346 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); |
| 349 | string id = null; | 347 | Identifier id = null; |
| 350 | string fileName = null; | 348 | string fileName = null; |
| 351 | string growthSize = null; | 349 | string growthSize = null; |
| 352 | string maxSize = null; | 350 | string maxSize = null; |
| 353 | string name = null; | 351 | string name = null; |
| 354 | string size = null; | 352 | string size = null; |
| 355 | 353 | ||
| 356 | foreach (XAttribute attrib in node.Attributes()) | 354 | foreach (XAttribute attrib in element.Attributes()) |
| 357 | { | 355 | { |
| 358 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) | 356 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) |
| 359 | { | 357 | { |
| 360 | switch (attrib.Name.LocalName) | 358 | switch (attrib.Name.LocalName) |
| 361 | { | 359 | { |
| 362 | case "Id": | 360 | case "Id": |
| 363 | id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); | 361 | id = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); |
| 364 | break; | 362 | break; |
| 365 | case "Name": | 363 | case "Name": |
| 366 | name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 364 | name = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| 367 | break; | 365 | break; |
| 368 | case "Filename": | 366 | case "Filename": |
| 369 | fileName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 367 | fileName = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| 370 | break; | 368 | break; |
| 371 | case "Size": | 369 | case "Size": |
| 372 | size = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 370 | size = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| 373 | break; | 371 | break; |
| 374 | case "MaxSize": | 372 | case "MaxSize": |
| 375 | maxSize = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 373 | maxSize = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| 376 | break; | 374 | break; |
| 377 | case "GrowthSize": | 375 | case "GrowthSize": |
| 378 | growthSize = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 376 | growthSize = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| 379 | break; | 377 | break; |
| 380 | default: | 378 | default: |
| 381 | this.Core.UnexpectedAttribute(node, attrib); | 379 | this.ParseHelper.UnexpectedAttribute(element, attrib); |
| 382 | break; | 380 | break; |
| 383 | } | 381 | } |
| 384 | } | 382 | } |
| 385 | else | 383 | else |
| 386 | { | 384 | { |
| 387 | this.Core.ParseExtensionAttribute(node, attrib); | 385 | this.ParseHelper.ParseExtensionAttribute(this.Context.Extensions, intermediate, section, element, attrib); |
| 388 | } | 386 | } |
| 389 | } | 387 | } |
| 390 | 388 | ||
| 391 | if (null == id) | 389 | if (null == id) |
| 392 | { | 390 | { |
| 393 | this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); | 391 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Id")); |
| 394 | } | 392 | } |
| 395 | 393 | ||
| 396 | if (null == name) | 394 | if (null == name) |
| 397 | { | 395 | { |
| 398 | this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); | 396 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Name")); |
| 399 | } | 397 | } |
| 400 | 398 | ||
| 401 | if (null == fileName) | 399 | if (null == fileName) |
| 402 | { | 400 | { |
| 403 | this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Filename")); | 401 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Filename")); |
| 404 | } | 402 | } |
| 405 | 403 | ||
| 406 | this.Core.ParseForExtensionElements(node); | 404 | this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); |
| 407 | 405 | ||
| 408 | if (!this.Core.EncounteredError) | 406 | if (!this.Messaging.EncounteredError) |
| 409 | { | 407 | { |
| 410 | Row row = this.Core.CreateRow(sourceLineNumbers, "SqlFileSpec"); | 408 | var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "SqlFileSpec", id); |
| 411 | row[0] = id; | 409 | row.Set(1, name); |
| 412 | row[1] = name; | 410 | row.Set(2, fileName); |
| 413 | row[2] = fileName; | ||
| 414 | if (null != size) | 411 | if (null != size) |
| 415 | { | 412 | { |
| 416 | row[3] = size; | 413 | row.Set(3, size); |
| 417 | } | 414 | } |
| 418 | 415 | ||
| 419 | if (null != maxSize) | 416 | if (null != maxSize) |
| 420 | { | 417 | { |
| 421 | row[4] = maxSize; | 418 | row.Set(4, maxSize); |
| 422 | } | 419 | } |
| 423 | 420 | ||
| 424 | if (null != growthSize) | 421 | if (null != growthSize) |
| 425 | { | 422 | { |
| 426 | row[5] = growthSize; | 423 | row.Set(5, growthSize); |
| 427 | } | 424 | } |
| 428 | } | 425 | } |
| 429 | 426 | ||
| @@ -433,13 +430,13 @@ namespace WixToolset.Extensions | |||
| 433 | /// <summary> | 430 | /// <summary> |
| 434 | /// Parses a sql script element. | 431 | /// Parses a sql script element. |
| 435 | /// </summary> | 432 | /// </summary> |
| 436 | /// <param name="node">Element to parse.</param> | 433 | /// <param name="element">Element to parse.</param> |
| 437 | /// <param name="componentId">Identifier for parent component.</param> | 434 | /// <param name="componentId">Identifier for parent component.</param> |
| 438 | /// <param name="sqlDb">Optional database to execute script against.</param> | 435 | /// <param name="sqlDb">Optional database to execute script against.</param> |
| 439 | private void ParseSqlScriptElement(XElement node, string componentId, string sqlDb) | 436 | private void ParseSqlScriptElement(Intermediate intermediate, IntermediateSection section, XElement element, string componentId, string sqlDb) |
| 440 | { | 437 | { |
| 441 | SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); | 438 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); |
| 442 | string id = null; | 439 | Identifier id = null; |
| 443 | int attributes = 0; | 440 | int attributes = 0; |
| 444 | bool rollbackAttribute = false; | 441 | bool rollbackAttribute = false; |
| 445 | bool nonRollbackAttribute = false; | 442 | bool nonRollbackAttribute = false; |
| @@ -447,38 +444,38 @@ namespace WixToolset.Extensions | |||
| 447 | int sequence = CompilerConstants.IntegerNotSet; | 444 | int sequence = CompilerConstants.IntegerNotSet; |
| 448 | string user = null; | 445 | string user = null; |
| 449 | 446 | ||
| 450 | foreach (XAttribute attrib in node.Attributes()) | 447 | foreach (XAttribute attrib in element.Attributes()) |
| 451 | { | 448 | { |
| 452 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) | 449 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) |
| 453 | { | 450 | { |
| 454 | switch (attrib.Name.LocalName) | 451 | switch (attrib.Name.LocalName) |
| 455 | { | 452 | { |
| 456 | case "Id": | 453 | case "Id": |
| 457 | id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); | 454 | id = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); |
| 458 | break; | 455 | break; |
| 459 | case "BinaryKey": | 456 | case "BinaryKey": |
| 460 | binary = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); | 457 | binary = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); |
| 461 | this.Core.CreateSimpleReference(sourceLineNumbers, "Binary", binary); | 458 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "Binary", binary); |
| 462 | break; | 459 | break; |
| 463 | case "Sequence": | 460 | case "Sequence": |
| 464 | sequence = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, short.MaxValue); | 461 | sequence = this.ParseHelper.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, short.MaxValue); |
| 465 | break; | 462 | break; |
| 466 | case "SqlDb": | 463 | case "SqlDb": |
| 467 | if (null != sqlDb) | 464 | if (null != sqlDb) |
| 468 | { | 465 | { |
| 469 | this.Core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); | 466 | this.Messaging.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName, element.Parent.Name.LocalName)); |
| 470 | } | 467 | } |
| 471 | sqlDb = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 468 | sqlDb = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| 472 | this.Core.CreateSimpleReference(sourceLineNumbers, "SqlDatabase", sqlDb); | 469 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "SqlDatabase", sqlDb); |
| 473 | break; | 470 | break; |
| 474 | case "User": | 471 | case "User": |
| 475 | user = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); | 472 | user = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); |
| 476 | this.Core.CreateSimpleReference(sourceLineNumbers, "User", user); | 473 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "User", user); |
| 477 | break; | 474 | break; |
| 478 | 475 | ||
| 479 | // Flag-setting attributes | 476 | // Flag-setting attributes |
| 480 | case "ContinueOnError": | 477 | case "ContinueOnError": |
| 481 | if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) | 478 | if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) |
| 482 | { | 479 | { |
| 483 | attributes |= SqlContinueOnError; | 480 | attributes |= SqlContinueOnError; |
| 484 | } | 481 | } |
| @@ -486,11 +483,11 @@ namespace WixToolset.Extensions | |||
| 486 | case "ExecuteOnInstall": | 483 | case "ExecuteOnInstall": |
| 487 | if (rollbackAttribute) | 484 | if (rollbackAttribute) |
| 488 | { | 485 | { |
| 489 | this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "RollbackOnInstall", "RollbackOnReinstall", "RollbackOnUninstall")); | 486 | this.Messaging.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName, "RollbackOnInstall", "RollbackOnReinstall", "RollbackOnUninstall")); |
| 490 | } | 487 | } |
| 491 | nonRollbackAttribute = true; | 488 | nonRollbackAttribute = true; |
| 492 | 489 | ||
| 493 | if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) | 490 | if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) |
| 494 | { | 491 | { |
| 495 | attributes |= SqlExecuteOnInstall; | 492 | attributes |= SqlExecuteOnInstall; |
| 496 | } | 493 | } |
| @@ -498,11 +495,11 @@ namespace WixToolset.Extensions | |||
| 498 | case "ExecuteOnReinstall": | 495 | case "ExecuteOnReinstall": |
| 499 | if (rollbackAttribute) | 496 | if (rollbackAttribute) |
| 500 | { | 497 | { |
| 501 | this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "RollbackOnInstall", "RollbackOnReinstall", "RollbackOnUninstall")); | 498 | this.Messaging.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName, "RollbackOnInstall", "RollbackOnReinstall", "RollbackOnUninstall")); |
| 502 | } | 499 | } |
| 503 | nonRollbackAttribute = true; | 500 | nonRollbackAttribute = true; |
| 504 | 501 | ||
| 505 | if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) | 502 | if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) |
| 506 | { | 503 | { |
| 507 | attributes |= SqlExecuteOnReinstall; | 504 | attributes |= SqlExecuteOnReinstall; |
| 508 | } | 505 | } |
| @@ -510,11 +507,11 @@ namespace WixToolset.Extensions | |||
| 510 | case "ExecuteOnUninstall": | 507 | case "ExecuteOnUninstall": |
| 511 | if (rollbackAttribute) | 508 | if (rollbackAttribute) |
| 512 | { | 509 | { |
| 513 | this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "RollbackOnInstall", "RollbackOnReinstall", "RollbackOnUninstall")); | 510 | this.Messaging.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName, "RollbackOnInstall", "RollbackOnReinstall", "RollbackOnUninstall")); |
| 514 | } | 511 | } |
| 515 | nonRollbackAttribute = true; | 512 | nonRollbackAttribute = true; |
| 516 | 513 | ||
| 517 | if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) | 514 | if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) |
| 518 | { | 515 | { |
| 519 | attributes |= SqlExecuteOnUninstall; | 516 | attributes |= SqlExecuteOnUninstall; |
| 520 | } | 517 | } |
| @@ -522,11 +519,11 @@ namespace WixToolset.Extensions | |||
| 522 | case "RollbackOnInstall": | 519 | case "RollbackOnInstall": |
| 523 | if (nonRollbackAttribute) | 520 | if (nonRollbackAttribute) |
| 524 | { | 521 | { |
| 525 | this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "ExecuteOnInstall", "ExecuteOnReinstall", "ExecuteOnUninstall")); | 522 | this.Messaging.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName, "ExecuteOnInstall", "ExecuteOnReinstall", "ExecuteOnUninstall")); |
| 526 | } | 523 | } |
| 527 | rollbackAttribute = true; | 524 | rollbackAttribute = true; |
| 528 | 525 | ||
| 529 | if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) | 526 | if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) |
| 530 | { | 527 | { |
| 531 | attributes |= SqlExecuteOnInstall; | 528 | attributes |= SqlExecuteOnInstall; |
| 532 | attributes |= SqlRollback; | 529 | attributes |= SqlRollback; |
| @@ -535,11 +532,11 @@ namespace WixToolset.Extensions | |||
| 535 | case "RollbackOnReinstall": | 532 | case "RollbackOnReinstall": |
| 536 | if (nonRollbackAttribute) | 533 | if (nonRollbackAttribute) |
| 537 | { | 534 | { |
| 538 | this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "ExecuteOnInstall", "ExecuteOnReinstall", "ExecuteOnUninstall")); | 535 | this.Messaging.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName, "ExecuteOnInstall", "ExecuteOnReinstall", "ExecuteOnUninstall")); |
| 539 | } | 536 | } |
| 540 | rollbackAttribute = true; | 537 | rollbackAttribute = true; |
| 541 | 538 | ||
| 542 | if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) | 539 | if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) |
| 543 | { | 540 | { |
| 544 | attributes |= SqlExecuteOnReinstall; | 541 | attributes |= SqlExecuteOnReinstall; |
| 545 | attributes |= SqlRollback; | 542 | attributes |= SqlRollback; |
| @@ -548,65 +545,64 @@ namespace WixToolset.Extensions | |||
| 548 | case "RollbackOnUninstall": | 545 | case "RollbackOnUninstall": |
| 549 | if (nonRollbackAttribute) | 546 | if (nonRollbackAttribute) |
| 550 | { | 547 | { |
| 551 | this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "ExecuteOnInstall", "ExecuteOnReinstall", "ExecuteOnUninstall")); | 548 | this.Messaging.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName, "ExecuteOnInstall", "ExecuteOnReinstall", "ExecuteOnUninstall")); |
| 552 | } | 549 | } |
| 553 | rollbackAttribute = true; | 550 | rollbackAttribute = true; |
| 554 | 551 | ||
| 555 | if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) | 552 | if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) |
| 556 | { | 553 | { |
| 557 | attributes |= SqlExecuteOnUninstall; | 554 | attributes |= SqlExecuteOnUninstall; |
| 558 | attributes |= SqlRollback; | 555 | attributes |= SqlRollback; |
| 559 | } | 556 | } |
| 560 | break; | 557 | break; |
| 561 | default: | 558 | default: |
| 562 | this.Core.UnexpectedAttribute(node, attrib); | 559 | this.ParseHelper.UnexpectedAttribute(element, attrib); |
| 563 | break; | 560 | break; |
| 564 | } | 561 | } |
| 565 | } | 562 | } |
| 566 | else | 563 | else |
| 567 | { | 564 | { |
| 568 | this.Core.ParseExtensionAttribute(node, attrib); | 565 | this.ParseHelper.ParseExtensionAttribute(this.Context.Extensions, intermediate, section, element, attrib); |
| 569 | } | 566 | } |
| 570 | } | 567 | } |
| 571 | 568 | ||
| 572 | if (null == id) | 569 | if (null == id) |
| 573 | { | 570 | { |
| 574 | this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); | 571 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Id")); |
| 575 | } | 572 | } |
| 576 | 573 | ||
| 577 | if (null == binary) | 574 | if (null == binary) |
| 578 | { | 575 | { |
| 579 | this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "BinaryKey")); | 576 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "BinaryKey")); |
| 580 | } | 577 | } |
| 581 | 578 | ||
| 582 | if (null == sqlDb) | 579 | if (null == sqlDb) |
| 583 | { | 580 | { |
| 584 | this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "SqlDb")); | 581 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "SqlDb")); |
| 585 | } | 582 | } |
| 586 | 583 | ||
| 587 | if (0 == attributes) | 584 | if (0 == attributes) |
| 588 | { | 585 | { |
| 589 | this.Core.OnMessage(WixErrors.ExpectedAttributes(sourceLineNumbers, node.Name.LocalName, "ExecuteOnInstall", "ExecuteOnReinstall", "ExecuteOnUninstall", "RollbackOnInstall", "RollbackOnReinstall", "RollbackOnUninstall")); | 586 | this.Messaging.Write(ErrorMessages.ExpectedAttributes(sourceLineNumbers, element.Name.LocalName, "ExecuteOnInstall", "ExecuteOnReinstall", "ExecuteOnUninstall", "RollbackOnInstall", "RollbackOnReinstall", "RollbackOnUninstall")); |
| 590 | } | 587 | } |
| 591 | 588 | ||
| 592 | this.Core.ParseForExtensionElements(node); | 589 | this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); |
| 593 | 590 | ||
| 594 | // Reference InstallSqlData and UninstallSqlData since nothing will happen without it | 591 | // Reference InstallSqlData and UninstallSqlData since nothing will happen without it |
| 595 | this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "InstallSqlData"); | 592 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "InstallSqlData"); |
| 596 | this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "UninstallSqlData"); | 593 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "UninstallSqlData"); |
| 597 | 594 | ||
| 598 | if (!this.Core.EncounteredError) | 595 | if (!this.Messaging.EncounteredError) |
| 599 | { | 596 | { |
| 600 | Row row = this.Core.CreateRow(sourceLineNumbers, "SqlScript"); | 597 | var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "SqlScript", id); |
| 601 | row[0] = id; | 598 | row.Set(1, sqlDb); |
| 602 | row[1] = sqlDb; | 599 | row.Set(2, componentId); |
| 603 | row[2] = componentId; | 600 | row.Set(3, binary); |
| 604 | row[3] = binary; | 601 | row.Set(4, user); |
| 605 | row[4] = user; | 602 | row.Set(5, attributes); |
| 606 | row[5] = attributes; | ||
| 607 | if (CompilerConstants.IntegerNotSet != sequence) | 603 | if (CompilerConstants.IntegerNotSet != sequence) |
| 608 | { | 604 | { |
| 609 | row[6] = sequence; | 605 | row.Set(6, sequence); |
| 610 | } | 606 | } |
| 611 | } | 607 | } |
| 612 | } | 608 | } |
| @@ -614,13 +610,13 @@ namespace WixToolset.Extensions | |||
| 614 | /// <summary> | 610 | /// <summary> |
| 615 | /// Parses a sql string element. | 611 | /// Parses a sql string element. |
| 616 | /// </summary> | 612 | /// </summary> |
| 617 | /// <param name="node">Element to parse.</param> | 613 | /// <param name="element">Element to parse.</param> |
| 618 | /// <param name="componentId">Identifier for parent component.</param> | 614 | /// <param name="componentId">Identifier for parent component.</param> |
| 619 | /// <param name="sqlDb">Optional database to execute string against.</param> | 615 | /// <param name="sqlDb">Optional database to execute string against.</param> |
| 620 | private void ParseSqlStringElement(XElement node, string componentId, string sqlDb) | 616 | private void ParseSqlStringElement(Intermediate intermediate, IntermediateSection section, XElement element, string componentId, string sqlDb) |
| 621 | { | 617 | { |
| 622 | SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); | 618 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); |
| 623 | string id = null; | 619 | Identifier id = null; |
| 624 | int attributes = 0; | 620 | int attributes = 0; |
| 625 | bool rollbackAttribute = false; | 621 | bool rollbackAttribute = false; |
| 626 | bool nonRollbackAttribute = false; | 622 | bool nonRollbackAttribute = false; |
| @@ -628,17 +624,17 @@ namespace WixToolset.Extensions | |||
| 628 | string sql = null; | 624 | string sql = null; |
| 629 | string user = null; | 625 | string user = null; |
| 630 | 626 | ||
| 631 | foreach (XAttribute attrib in node.Attributes()) | 627 | foreach (XAttribute attrib in element.Attributes()) |
| 632 | { | 628 | { |
| 633 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) | 629 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) |
| 634 | { | 630 | { |
| 635 | switch (attrib.Name.LocalName) | 631 | switch (attrib.Name.LocalName) |
| 636 | { | 632 | { |
| 637 | case "Id": | 633 | case "Id": |
| 638 | id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); | 634 | id = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); |
| 639 | break; | 635 | break; |
| 640 | case "ContinueOnError": | 636 | case "ContinueOnError": |
| 641 | if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) | 637 | if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) |
| 642 | { | 638 | { |
| 643 | attributes |= SqlContinueOnError; | 639 | attributes |= SqlContinueOnError; |
| 644 | } | 640 | } |
| @@ -646,11 +642,11 @@ namespace WixToolset.Extensions | |||
| 646 | case "ExecuteOnInstall": | 642 | case "ExecuteOnInstall": |
| 647 | if (rollbackAttribute) | 643 | if (rollbackAttribute) |
| 648 | { | 644 | { |
| 649 | this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "RollbackOnInstall", "RollbackOnReinstall", "RollbackOnUninstall")); | 645 | this.Messaging.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName, "RollbackOnInstall", "RollbackOnReinstall", "RollbackOnUninstall")); |
| 650 | } | 646 | } |
| 651 | nonRollbackAttribute = true; | 647 | nonRollbackAttribute = true; |
| 652 | 648 | ||
| 653 | if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) | 649 | if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) |
| 654 | { | 650 | { |
| 655 | attributes |= SqlExecuteOnInstall; | 651 | attributes |= SqlExecuteOnInstall; |
| 656 | } | 652 | } |
| @@ -658,11 +654,11 @@ namespace WixToolset.Extensions | |||
| 658 | case "ExecuteOnReinstall": | 654 | case "ExecuteOnReinstall": |
| 659 | if (rollbackAttribute) | 655 | if (rollbackAttribute) |
| 660 | { | 656 | { |
| 661 | this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "RollbackOnInstall", "RollbackOnReinstall", "RollbackOnUninstall")); | 657 | this.Messaging.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName, "RollbackOnInstall", "RollbackOnReinstall", "RollbackOnUninstall")); |
| 662 | } | 658 | } |
| 663 | nonRollbackAttribute = true; | 659 | nonRollbackAttribute = true; |
| 664 | 660 | ||
| 665 | if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) | 661 | if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) |
| 666 | { | 662 | { |
| 667 | attributes |= SqlExecuteOnReinstall; | 663 | attributes |= SqlExecuteOnReinstall; |
| 668 | } | 664 | } |
| @@ -670,11 +666,11 @@ namespace WixToolset.Extensions | |||
| 670 | case "ExecuteOnUninstall": | 666 | case "ExecuteOnUninstall": |
| 671 | if (rollbackAttribute) | 667 | if (rollbackAttribute) |
| 672 | { | 668 | { |
| 673 | this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "RollbackOnInstall", "RollbackOnReinstall", "RollbackOnUninstall")); | 669 | this.Messaging.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName, "RollbackOnInstall", "RollbackOnReinstall", "RollbackOnUninstall")); |
| 674 | } | 670 | } |
| 675 | nonRollbackAttribute = true; | 671 | nonRollbackAttribute = true; |
| 676 | 672 | ||
| 677 | if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) | 673 | if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) |
| 678 | { | 674 | { |
| 679 | attributes |= SqlExecuteOnUninstall; | 675 | attributes |= SqlExecuteOnUninstall; |
| 680 | } | 676 | } |
| @@ -682,11 +678,11 @@ namespace WixToolset.Extensions | |||
| 682 | case "RollbackOnInstall": | 678 | case "RollbackOnInstall": |
| 683 | if (nonRollbackAttribute) | 679 | if (nonRollbackAttribute) |
| 684 | { | 680 | { |
| 685 | this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "ExecuteOnInstall", "ExecuteOnReinstall", "ExecuteOnUninstall")); | 681 | this.Messaging.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName, "ExecuteOnInstall", "ExecuteOnReinstall", "ExecuteOnUninstall")); |
| 686 | } | 682 | } |
| 687 | rollbackAttribute = true; | 683 | rollbackAttribute = true; |
| 688 | 684 | ||
| 689 | if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) | 685 | if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) |
| 690 | { | 686 | { |
| 691 | attributes |= SqlExecuteOnInstall; | 687 | attributes |= SqlExecuteOnInstall; |
| 692 | attributes |= SqlRollback; | 688 | attributes |= SqlRollback; |
| @@ -695,11 +691,11 @@ namespace WixToolset.Extensions | |||
| 695 | case "RollbackOnReinstall": | 691 | case "RollbackOnReinstall": |
| 696 | if (nonRollbackAttribute) | 692 | if (nonRollbackAttribute) |
| 697 | { | 693 | { |
| 698 | this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "ExecuteOnInstall", "ExecuteOnReinstall", "ExecuteOnUninstall")); | 694 | this.Messaging.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName, "ExecuteOnInstall", "ExecuteOnReinstall", "ExecuteOnUninstall")); |
| 699 | } | 695 | } |
| 700 | rollbackAttribute = true; | 696 | rollbackAttribute = true; |
| 701 | 697 | ||
| 702 | if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) | 698 | if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) |
| 703 | { | 699 | { |
| 704 | attributes |= SqlExecuteOnReinstall; | 700 | attributes |= SqlExecuteOnReinstall; |
| 705 | attributes |= SqlRollback; | 701 | attributes |= SqlRollback; |
| @@ -708,84 +704,83 @@ namespace WixToolset.Extensions | |||
| 708 | case "RollbackOnUninstall": | 704 | case "RollbackOnUninstall": |
| 709 | if (nonRollbackAttribute) | 705 | if (nonRollbackAttribute) |
| 710 | { | 706 | { |
| 711 | this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "ExecuteOnInstall", "ExecuteOnReinstall", "ExecuteOnUninstall")); | 707 | this.Messaging.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName, "ExecuteOnInstall", "ExecuteOnReinstall", "ExecuteOnUninstall")); |
| 712 | } | 708 | } |
| 713 | rollbackAttribute = true; | 709 | rollbackAttribute = true; |
| 714 | 710 | ||
| 715 | if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) | 711 | if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) |
| 716 | { | 712 | { |
| 717 | attributes |= SqlExecuteOnUninstall; | 713 | attributes |= SqlExecuteOnUninstall; |
| 718 | attributes |= SqlRollback; | 714 | attributes |= SqlRollback; |
| 719 | } | 715 | } |
| 720 | break; | 716 | break; |
| 721 | case "Sequence": | 717 | case "Sequence": |
| 722 | sequence = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, short.MaxValue); | 718 | sequence = this.ParseHelper.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, short.MaxValue); |
| 723 | break; | 719 | break; |
| 724 | case "SQL": | 720 | case "SQL": |
| 725 | sql = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 721 | sql = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| 726 | break; | 722 | break; |
| 727 | case "SqlDb": | 723 | case "SqlDb": |
| 728 | if (null != sqlDb) | 724 | if (null != sqlDb) |
| 729 | { | 725 | { |
| 730 | this.Core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, "SqlDb", "SqlDatabase")); | 726 | this.Messaging.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, element.Name.LocalName, "SqlDb", "SqlDatabase")); |
| 731 | } | 727 | } |
| 732 | 728 | ||
| 733 | sqlDb = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); | 729 | sqlDb = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); |
| 734 | this.Core.CreateSimpleReference(sourceLineNumbers, "SqlDatabase", sqlDb); | 730 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "SqlDatabase", sqlDb); |
| 735 | break; | 731 | break; |
| 736 | case "User": | 732 | case "User": |
| 737 | user = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); | 733 | user = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); |
| 738 | this.Core.CreateSimpleReference(sourceLineNumbers, "User", user); | 734 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "User", user); |
| 739 | break; | 735 | break; |
| 740 | default: | 736 | default: |
| 741 | this.Core.UnexpectedAttribute(node, attrib); | 737 | this.ParseHelper.UnexpectedAttribute(element, attrib); |
| 742 | break; | 738 | break; |
| 743 | } | 739 | } |
| 744 | } | 740 | } |
| 745 | else | 741 | else |
| 746 | { | 742 | { |
| 747 | this.Core.ParseExtensionAttribute(node, attrib); | 743 | this.ParseHelper.ParseExtensionAttribute(this.Context.Extensions, intermediate, section, element, attrib); |
| 748 | } | 744 | } |
| 749 | } | 745 | } |
| 750 | 746 | ||
| 751 | if (null == id) | 747 | if (null == id) |
| 752 | { | 748 | { |
| 753 | this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); | 749 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Id")); |
| 754 | } | 750 | } |
| 755 | 751 | ||
| 756 | if (null == sql) | 752 | if (null == sql) |
| 757 | { | 753 | { |
| 758 | this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "SQL")); | 754 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "SQL")); |
| 759 | } | 755 | } |
| 760 | 756 | ||
| 761 | if (null == sqlDb) | 757 | if (null == sqlDb) |
| 762 | { | 758 | { |
| 763 | this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "SqlDb")); | 759 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "SqlDb")); |
| 764 | } | 760 | } |
| 765 | 761 | ||
| 766 | if (0 == attributes) | 762 | if (0 == attributes) |
| 767 | { | 763 | { |
| 768 | this.Core.OnMessage(WixErrors.ExpectedAttributes(sourceLineNumbers, node.Name.LocalName, "ExecuteOnInstall", "ExecuteOnReinstall", "ExecuteOnUninstall", "RollbackOnInstall", "RollbackOnReinstall", "RollbackOnUninstall")); | 764 | this.Messaging.Write(ErrorMessages.ExpectedAttributes(sourceLineNumbers, element.Name.LocalName, "ExecuteOnInstall", "ExecuteOnReinstall", "ExecuteOnUninstall", "RollbackOnInstall", "RollbackOnReinstall", "RollbackOnUninstall")); |
| 769 | } | 765 | } |
| 770 | 766 | ||
| 771 | this.Core.ParseForExtensionElements(node); | 767 | this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); |
| 772 | 768 | ||
| 773 | // Reference InstallSqlData and UninstallSqlData since nothing will happen without it | 769 | // Reference InstallSqlData and UninstallSqlData since nothing will happen without it |
| 774 | this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "InstallSqlData"); | 770 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "InstallSqlData"); |
| 775 | this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "UninstallSqlData"); | 771 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "UninstallSqlData"); |
| 776 | 772 | ||
| 777 | if (!this.Core.EncounteredError) | 773 | if (!this.Messaging.EncounteredError) |
| 778 | { | 774 | { |
| 779 | Row row = this.Core.CreateRow(sourceLineNumbers, "SqlString"); | 775 | var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "SqlString", id); |
| 780 | row[0] = id; | 776 | row.Set(1, sqlDb); |
| 781 | row[1] = sqlDb; | 777 | row.Set(2, componentId); |
| 782 | row[2] = componentId; | 778 | row.Set(3, sql); |
| 783 | row[3] = sql; | 779 | row.Set(4, user); |
| 784 | row[4] = user; | 780 | row.Set(5, attributes); |
| 785 | row[5] = attributes; | ||
| 786 | if (CompilerConstants.IntegerNotSet != sequence) | 781 | if (CompilerConstants.IntegerNotSet != sequence) |
| 787 | { | 782 | { |
| 788 | row[6] = sequence; | 783 | row.Set(6, sequence); |
| 789 | } | 784 | } |
| 790 | } | 785 | } |
| 791 | } | 786 | } |
diff --git a/src/wixext/SqlDecompiler.cs b/src/wixext/SqlDecompiler.cs index 64192e84..52436b87 100644 --- a/src/wixext/SqlDecompiler.cs +++ b/src/wixext/SqlDecompiler.cs | |||
| @@ -1,7 +1,8 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. |
| 2 | 2 | ||
| 3 | namespace WixToolset.Extensions | 3 | namespace WixToolset.Sql |
| 4 | { | 4 | { |
| 5 | #if TODO_CONSIDER_DECOMPILER | ||
| 5 | using System.Collections; | 6 | using System.Collections; |
| 6 | using WixToolset.Data; | 7 | using WixToolset.Data; |
| 7 | using WixToolset.Extensibility; | 8 | using WixToolset.Extensibility; |
| @@ -509,4 +510,5 @@ namespace WixToolset.Extensions | |||
| 509 | } | 510 | } |
| 510 | } | 511 | } |
| 511 | } | 512 | } |
| 513 | #endif | ||
| 512 | } | 514 | } |
diff --git a/src/wixext/SqlErrors.cs b/src/wixext/SqlErrors.cs index 2043b658..f25728bd 100644 --- a/src/wixext/SqlErrors.cs +++ b/src/wixext/SqlErrors.cs | |||
| @@ -1,32 +1,48 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. |
| 2 | 2 | ||
| 3 | namespace WixToolset.Extensions | 3 | namespace WixToolset.Sql |
| 4 | { | 4 | { |
| 5 | public sealed class SqlErrors | 5 | using System.Resources; |
| 6 | using WixToolset.Data; | ||
| 7 | |||
| 8 | public static class SqlErrors | ||
| 6 | { | 9 | { |
| 7 | 10 | public static Message IllegalAttributeWithoutComponent(SourceLineNumber sourceLineNumbers, string elementName, string attributeName) | |
| 8 | private SqlErrors() | ||
| 9 | { | 11 | { |
| 12 | return Message(sourceLineNumbers, Ids.IllegalAttributeWithoutComponent, "The {0}/@{1} attribute cannot be specified unless the element has a Component as an ancestor. A {0} that does not have a Component ancestor is not installed.", elementName, attributeName); | ||
| 10 | } | 13 | } |
| 11 | 14 | ||
| 12 | public static MessageEventArgs IllegalAttributeWithoutComponent(SourceLineNumber sourceLineNumbers, string elementName, string attributeName) | 15 | public static Message IllegalElementWithoutComponent(SourceLineNumber sourceLineNumbers, string elementName) |
| 13 | { | 16 | { |
| 14 | return new SqlErrorEventArgs(sourceLineNumbers, 5100, "SqlErrors_IllegalAttributeWithoutComponent_1", elementName, attributeName); | 17 | return Message(sourceLineNumbers, Ids.IllegalElementWithoutComponent, "The {0} element cannot be specified unless the element has a Component as an ancestor. A {0} that does not have a Component ancestor is not installed.", elementName); |
| 15 | } | 18 | } |
| 16 | 19 | ||
| 17 | public static MessageEventArgs IllegalElementWithoutComponent(SourceLineNumber sourceLineNumbers, string elementName) | 20 | public static Message OneOfAttributesRequiredUnderComponent(SourceLineNumber sourceLineNumbers, string elementName, string attributeName1, string attributeName2, string attributeName3, string attributeName4) |
| 18 | { | 21 | { |
| 19 | return new SqlErrorEventArgs(sourceLineNumbers, 5101, "SqlErrors_IllegalElementWithoutComponent_1", elementName); | 22 | return Message(sourceLineNumbers, Ids.OneOfAttributesRequiredUnderComponent, "When nested under a Component, the {0} element must have one of the following attributes specified: {1}, {2}, {3} or {4}.", elementName, attributeName1, attributeName2, attributeName3, attributeName4); |
| 20 | } | 23 | } |
| 21 | 24 | ||
| 22 | public static MessageEventArgs OneOfAttributesRequiredUnderComponent(SourceLineNumber sourceLineNumbers, string elementName, string attributeName1, string attributeName2, string attributeName3, string attributeName4) | 25 | public static Message DeprecatedBinaryChildElement(SourceLineNumber sourceLineNumbers, string elementName) |
| 23 | { | 26 | { |
| 24 | return new SqlErrorEventArgs(sourceLineNumbers, 5102, "SqlErrors_OneOfAttributesRequiredUnderComponent_1", elementName, attributeName1, attributeName2, attributeName3, attributeName4); | 27 | return Message(sourceLineNumbers, Ids.DeprecatedBinaryChildElement, "The {0} element contains a deprecated child Binary element. Please move the Binary element under a Fragment, Module, or Product element and set the {0}/@BinaryKey attribute to the value of the Binary/@Id attribute.", elementName); |
| 25 | } | 28 | } |
| 26 | 29 | ||
| 27 | public static MessageEventArgs DeprecatedBinaryChildElement(SourceLineNumber sourceLineNumbers, string elementName) | 30 | private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args) |
| 31 | { | ||
| 32 | return new Message(sourceLineNumber, MessageLevel.Error, (int)id, format, args); | ||
| 33 | } | ||
| 34 | |||
| 35 | private static Message Message(SourceLineNumber sourceLineNumber, Ids id, ResourceManager resourceManager, string resourceName, params object[] args) | ||
| 36 | { | ||
| 37 | return new Message(sourceLineNumber, MessageLevel.Error, (int)id, resourceManager, resourceName, args); | ||
| 38 | } | ||
| 39 | |||
| 40 | public enum Ids | ||
| 28 | { | 41 | { |
| 29 | return new SqlErrorEventArgs(sourceLineNumbers, 5103, "SqlErrors_DeprecatedBinaryChildElement_1", elementName); | 42 | IllegalAttributeWithoutComponent = 5100, |
| 43 | IllegalElementWithoutComponent = 5101, | ||
| 44 | OneOfAttributesRequiredUnderComponent = 5102, | ||
| 45 | DeprecatedBinaryChildElement = 5103, | ||
| 30 | } | 46 | } |
| 31 | } | 47 | } |
| 32 | } \ No newline at end of file | 48 | } \ No newline at end of file |
diff --git a/src/wixext/SqlExtensionData.cs b/src/wixext/SqlExtensionData.cs index b43b0341..a1b24b07 100644 --- a/src/wixext/SqlExtensionData.cs +++ b/src/wixext/SqlExtensionData.cs | |||
| @@ -1,64 +1,30 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. |
| 2 | 2 | ||
| 3 | namespace WixToolset.Extensions | 3 | namespace WixToolset.Sql |
| 4 | { | 4 | { |
| 5 | using System; | ||
| 6 | using System.Reflection; | ||
| 7 | using WixToolset.Data; | 5 | using WixToolset.Data; |
| 8 | using WixToolset.Extensibility; | 6 | using WixToolset.Extensibility; |
| 9 | 7 | ||
| 10 | /// <summary> | 8 | /// <summary> |
| 11 | /// The WiX Toolset SQL Server Extension. | 9 | /// The WiX Toolset SQL Server Extension. |
| 12 | /// </summary> | 10 | /// </summary> |
| 13 | public sealed class SqlExtensionData : ExtensionData | 11 | public sealed class SqlExtensionData : BaseExtensionData |
| 14 | { | 12 | { |
| 15 | /// <summary> | 13 | /// <summary> |
| 16 | /// Gets the default culture. | 14 | /// Gets the default culture. |
| 17 | /// </summary> | 15 | /// </summary> |
| 18 | /// <value>The default culture.</value> | 16 | /// <value>The default culture.</value> |
| 19 | public override string DefaultCulture | 17 | public override string DefaultCulture => "en-US"; |
| 20 | { | ||
| 21 | get { return "en-us"; } | ||
| 22 | } | ||
| 23 | |||
| 24 | /// <summary> | ||
| 25 | /// Gets the optional table definitions for this extension. | ||
| 26 | /// </summary> | ||
| 27 | /// <value>The optional table definitions for this extension.</value> | ||
| 28 | public override TableDefinitionCollection TableDefinitions | ||
| 29 | { | ||
| 30 | get | ||
| 31 | { | ||
| 32 | return SqlExtensionData.GetExtensionTableDefinitions(); | ||
| 33 | } | ||
| 34 | } | ||
| 35 | |||
| 36 | /// <summary> | ||
| 37 | /// Gets the library associated with this extension. | ||
| 38 | /// </summary> | ||
| 39 | /// <param name="tableDefinitions">The table definitions to use while loading the library.</param> | ||
| 40 | /// <returns>The loaded library.</returns> | ||
| 41 | public override Library GetLibrary(TableDefinitionCollection tableDefinitions) | ||
| 42 | { | ||
| 43 | return SqlExtensionData.GetExtensionLibrary(tableDefinitions); | ||
| 44 | } | ||
| 45 | 18 | ||
| 46 | /// <summary> | 19 | public override bool TryGetTupleDefinitionByName(string name, out IntermediateTupleDefinition tupleDefinition) |
| 47 | /// Internal mechanism to access the extension's table definitions. | ||
| 48 | /// </summary> | ||
| 49 | /// <returns>Extension's table definitions.</returns> | ||
| 50 | internal static TableDefinitionCollection GetExtensionTableDefinitions() | ||
| 51 | { | 20 | { |
| 52 | return ExtensionData.LoadTableDefinitionHelper(Assembly.GetExecutingAssembly(), "WixToolset.Extensions.Data.tables.xml"); | 21 | tupleDefinition = null; |
| 22 | return tupleDefinition != null; | ||
| 53 | } | 23 | } |
| 54 | 24 | ||
| 55 | /// <summary> | 25 | public override Intermediate GetLibrary(ITupleDefinitionCreator tupleDefinitions) |
| 56 | /// Internal mechanism to access the extension's library. | ||
| 57 | /// </summary> | ||
| 58 | /// <returns>Extension's library.</returns> | ||
| 59 | internal static Library GetExtensionLibrary(TableDefinitionCollection tableDefinitions) | ||
| 60 | { | 26 | { |
| 61 | return ExtensionData.LoadLibraryHelper(Assembly.GetExecutingAssembly(), "WixToolset.Extensions.Data.sql.wixlib", tableDefinitions); | 27 | return Intermediate.Load(typeof(SqlExtensionData).Assembly, "WixToolset.Sql.sql.wixlib", tupleDefinitions); |
| 62 | } | 28 | } |
| 63 | } | 29 | } |
| 64 | } | 30 | } |
diff --git a/src/wixext/SqlExtensionFactory.cs b/src/wixext/SqlExtensionFactory.cs new file mode 100644 index 00000000..e7fafed2 --- /dev/null +++ b/src/wixext/SqlExtensionFactory.cs | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | namespace WixToolset.Sql | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | using System.Collections.Generic; | ||
| 7 | using WixToolset.Extensibility; | ||
| 8 | |||
| 9 | public class SqlExtensionFactory : BaseExtensionFactory | ||
| 10 | { | ||
| 11 | protected override IEnumerable<Type> ExtensionTypes => new[] | ||
| 12 | { | ||
| 13 | typeof(SqlCompiler), | ||
| 14 | typeof(SqlExtensionData), | ||
| 15 | typeof(SqlWindowsInstallerBackendBinderExtension), | ||
| 16 | }; | ||
| 17 | } | ||
| 18 | } | ||
diff --git a/src/wixext/SqlWindowsInstallerBackendExtension.cs b/src/wixext/SqlWindowsInstallerBackendExtension.cs new file mode 100644 index 00000000..56bdbb1f --- /dev/null +++ b/src/wixext/SqlWindowsInstallerBackendExtension.cs | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | namespace WixToolset.Sql | ||
| 4 | { | ||
| 5 | using System.Linq; | ||
| 6 | using System.Xml; | ||
| 7 | using WixToolset.Data.WindowsInstaller; | ||
| 8 | using WixToolset.Extensibility; | ||
| 9 | |||
| 10 | public class SqlWindowsInstallerBackendBinderExtension : BaseWindowsInstallerBackendBinderExtension | ||
| 11 | { | ||
| 12 | public SqlWindowsInstallerBackendBinderExtension() | ||
| 13 | { | ||
| 14 | |||
| 15 | } | ||
| 16 | |||
| 17 | private static readonly TableDefinition[] Tables = LoadTables(); | ||
| 18 | |||
| 19 | protected override TableDefinition[] TableDefinitionsForTuples => Tables; | ||
| 20 | |||
| 21 | private static TableDefinition[] LoadTables() | ||
| 22 | { | ||
| 23 | using (var resourceStream = typeof(SqlWindowsInstallerBackendBinderExtension).Assembly.GetManifestResourceStream("WixToolset.Sql.tables.xml")) | ||
| 24 | using (var reader = XmlReader.Create(resourceStream)) | ||
| 25 | { | ||
| 26 | var tables = TableDefinitionCollection.Load(reader); | ||
| 27 | return tables.ToArray(); | ||
| 28 | } | ||
| 29 | } | ||
| 30 | } | ||
| 31 | } | ||
diff --git a/src/wixext/WixToolset.Sql.wixext.csproj b/src/wixext/WixToolset.Sql.wixext.csproj new file mode 100644 index 00000000..a782ea8f --- /dev/null +++ b/src/wixext/WixToolset.Sql.wixext.csproj | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
| 3 | |||
| 4 | <Project Sdk="Microsoft.NET.Sdk"> | ||
| 5 | <PropertyGroup> | ||
| 6 | <TargetFramework>netstandard2.0</TargetFramework> | ||
| 7 | <RootNamespace>WixToolset.Sql</RootNamespace> | ||
| 8 | <Description>WiX Toolset Sql Extension</Description> | ||
| 9 | <Title>WiX Toolset Sql Extension</Title> | ||
| 10 | <IsTool>true</IsTool> | ||
| 11 | <ContentTargetFolders>build</ContentTargetFolders> | ||
| 12 | </PropertyGroup> | ||
| 13 | |||
| 14 | <ItemGroup> | ||
| 15 | <Content Include="$(MSBuildThisFileName).targets" /> | ||
| 16 | <Content Include="sql.xsd" PackagePath="tools" /> | ||
| 17 | <EmbeddedResource Include="tables.xml" /> | ||
| 18 | <EmbeddedResource Include="$(OutputPath)..\sql.wixlib" /> | ||
| 19 | </ItemGroup> | ||
| 20 | |||
| 21 | <ItemGroup> | ||
| 22 | <ProjectReference Include="$(WixToolsetRootFolder)\Data\src\WixToolset.Data\WixToolset.Data.csproj" Condition=" '$(Configuration)' == 'Debug' And Exists('$(WixToolsetRootFolder)\Data\README.md') " /> | ||
| 23 | <PackageReference Include="WixToolset.Data" Version="4.0.*" Condition=" '$(Configuration)' == 'Release' Or !Exists('$(WixToolsetRootFolder)\Data\README.md') " PrivateAssets="all" /> | ||
| 24 | |||
| 25 | <ProjectReference Include="$(WixToolsetRootFolder)\Extensibility\src\WixToolset.Extensibility\WixToolset.Extensibility.csproj" Condition=" '$(Configuration)' == 'Debug' And Exists('$(WixToolsetRootFolder)\Extensibility\README.md') " /> | ||
| 26 | <PackageReference Include="WixToolset.Extensibility" Version="4.0.*" Condition=" '$(Configuration)' == 'Release' Or !Exists('$(WixToolsetRootFolder)\Extensibility\README.md') " PrivateAssets="all" /> | ||
| 27 | </ItemGroup> | ||
| 28 | |||
| 29 | <ItemGroup> | ||
| 30 | <ProjectReference Include="..\wixlib\sql.wixproj" ReferenceOutputAssembly="false" Condition=" '$(NCrunch)'=='' " /> | ||
| 31 | </ItemGroup> | ||
| 32 | |||
| 33 | <ItemGroup> | ||
| 34 | <PackageReference Include="Nerdbank.GitVersioning" Version="2.1.65" PrivateAssets="all" /> | ||
| 35 | </ItemGroup> | ||
| 36 | </Project> | ||
diff --git a/src/wixext/WixToolset.Sql.wixext.targets b/src/wixext/WixToolset.Sql.wixext.targets new file mode 100644 index 00000000..4950e119 --- /dev/null +++ b/src/wixext/WixToolset.Sql.wixext.targets | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
| 3 | |||
| 4 | <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> | ||
| 5 | <PropertyGroup> | ||
| 6 | <WixToolsetSqlWixextPath Condition=" '$(WixToolsetSqlWixextPath)' == '' ">$(MSBuildThisFileDirectory)..\tools\WixToolset.Sql.wixext.dll</WixToolsetSqlWixextPath> | ||
| 7 | </PropertyGroup> | ||
| 8 | <ItemGroup> | ||
| 9 | <WixExtension Include="$(WixToolsetSqlWixextPath)" /> | ||
| 10 | </ItemGroup> | ||
| 11 | </Project> | ||
diff --git a/src/wixlib/SqlExtension.wxs b/src/wixlib/SqlExtension.wxs index 2ee9a3ab..6e08b7fa 100644 --- a/src/wixlib/SqlExtension.wxs +++ b/src/wixlib/SqlExtension.wxs | |||
| @@ -24,13 +24,13 @@ | |||
| 24 | </UI> | 24 | </UI> |
| 25 | 25 | ||
| 26 | <!-- The SQL custom actions should impersonate the user because the user"s cridentials are used when connected to the database if none are provided --> | 26 | <!-- The SQL custom actions should impersonate the user because the user"s cridentials are used when connected to the database if none are provided --> |
| 27 | <CustomAction Id="InstallSqlData" BinaryKey="ScaSchedule2" DllEntry="InstallSqlData" Execute="immediate" Return="check" /> | 27 | <CustomAction Id="InstallSqlData" BinaryKey="SqlCA" DllEntry="InstallSqlData" Execute="immediate" Return="check" /> |
| 28 | <CustomAction Id="UninstallSqlData" BinaryKey="ScaSchedule2" DllEntry="UninstallSqlData" Execute="immediate" Return="check" /> | 28 | <CustomAction Id="UninstallSqlData" BinaryKey="SqlCA" DllEntry="UninstallSqlData" Execute="immediate" Return="check" /> |
| 29 | <CustomAction Id="CreateDatabase" BinaryKey="ScaExecute2" DllEntry="CreateDatabase" Execute="deferred" Return="check" HideTarget="yes" SuppressModularization="yes" TerminalServerAware="yes" /> | 29 | <CustomAction Id="CreateDatabase" BinaryKey="SqlCA" DllEntry="CreateDatabase" Execute="deferred" Return="check" HideTarget="yes" SuppressModularization="yes" TerminalServerAware="yes" /> |
| 30 | <CustomAction Id="RollbackCreateDatabase" BinaryKey="ScaExecute2" DllEntry="DropDatabase" Execute="rollback" Return="check" HideTarget="yes" SuppressModularization="yes" TerminalServerAware="yes" /> | 30 | <CustomAction Id="RollbackCreateDatabase" BinaryKey="SqlCA" DllEntry="DropDatabase" Execute="rollback" Return="check" HideTarget="yes" SuppressModularization="yes" TerminalServerAware="yes" /> |
| 31 | <CustomAction Id="DropDatabase" BinaryKey="ScaExecute2" DllEntry="DropDatabase" Execute="deferred" Return="check" HideTarget="yes" SuppressModularization="yes" TerminalServerAware="yes" /> | 31 | <CustomAction Id="DropDatabase" BinaryKey="SqlCA" DllEntry="DropDatabase" Execute="deferred" Return="check" HideTarget="yes" SuppressModularization="yes" TerminalServerAware="yes" /> |
| 32 | <CustomAction Id="ExecuteSqlStrings" BinaryKey="ScaExecute2" DllEntry="ExecuteSqlStrings" Execute="deferred" Return="check" HideTarget="yes" SuppressModularization="yes" TerminalServerAware="yes" /> | 32 | <CustomAction Id="ExecuteSqlStrings" BinaryKey="SqlCA" DllEntry="ExecuteSqlStrings" Execute="deferred" Return="check" HideTarget="yes" SuppressModularization="yes" TerminalServerAware="yes" /> |
| 33 | <CustomAction Id="RollbackExecuteSqlStrings" BinaryKey="ScaExecute2" DllEntry="ExecuteSqlStrings" Execute="rollback" Return="check" HideTarget="yes" SuppressModularization="yes" TerminalServerAware="yes" /> | 33 | <CustomAction Id="RollbackExecuteSqlStrings" BinaryKey="SqlCA" DllEntry="ExecuteSqlStrings" Execute="rollback" Return="check" HideTarget="yes" SuppressModularization="yes" TerminalServerAware="yes" /> |
| 34 | 34 | ||
| 35 | <InstallExecuteSequence> | 35 | <InstallExecuteSequence> |
| 36 | <Custom Action="UninstallSqlData" Before="RemoveFiles" Overridable="yes">NOT SKIPUNINSTALLSQLDATA AND VersionNT > 400</Custom> | 36 | <Custom Action="UninstallSqlData" Before="RemoveFiles" Overridable="yes">NOT SKIPUNINSTALLSQLDATA AND VersionNT > 400</Custom> |
| @@ -40,7 +40,6 @@ | |||
| 40 | 40 | ||
| 41 | <!-- Server Custom Action DLL Definitions --> | 41 | <!-- Server Custom Action DLL Definitions --> |
| 42 | <Fragment> | 42 | <Fragment> |
| 43 | <Binary Id="ScaSchedule2" SourceFile="scasched.dll" /> | 43 | <Binary Id="SqlCA" SourceFile="sqlca.dll" /> |
| 44 | <Binary Id="ScaExecute2" SourceFile="scaexec.dll" /> | ||
| 45 | </Fragment> | 44 | </Fragment> |
| 46 | </Wix> | 45 | </Wix> |
diff --git a/src/wixlib/caerr.wxi b/src/wixlib/caerr.wxi new file mode 100644 index 00000000..141942f2 --- /dev/null +++ b/src/wixlib/caerr.wxi | |||
| @@ -0,0 +1,96 @@ | |||
| 1 | <Include> | ||
| 2 | <?define msierrSecureObjectsFailedCreateSD = 25520?> | ||
| 3 | <?define msierrSecureObjectsFailedSet = 25521?> | ||
| 4 | <?define msierrSecureObjectsUnknownType = 25522?> | ||
| 5 | <?define msierrXmlFileFailedRead = 25530?> | ||
| 6 | <?define msierrXmlFileFailedOpen = 25531?> | ||
| 7 | <?define msierrXmlFileFailedSelect = 25532?> | ||
| 8 | <?define msierrXmlFileFailedSave = 25533?> | ||
| 9 | <?define msierrXmlConfigFailedRead = 25540?> | ||
| 10 | <?define msierrXmlConfigFailedOpen = 25541?> | ||
| 11 | <?define msierrXmlConfigFailedSelect = 25542?> | ||
| 12 | <?define msierrXmlConfigFailedSave = 25543?> | ||
| 13 | <?define msierrFirewallCannotConnect = 25580?> | ||
| 14 | <?define msierrIISCannotConnect = 26001?> | ||
| 15 | <?define msierrIISFailedReadWebSite = 26002?> | ||
| 16 | <?define msierrIISFailedReadWebDirs = 26003?> | ||
| 17 | <?define msierrIISFailedReadVDirs = 26004?> | ||
| 18 | <?define msierrIISFailedReadFilters = 26005?> | ||
| 19 | <?define msierrIISFailedReadAppPool = 26006?> | ||
| 20 | <?define msierrIISFailedReadMimeMap = 26007?> | ||
| 21 | <?define msierrIISFailedReadProp = 26008?> | ||
| 22 | <?define msierrIISFailedReadWebSvcExt = 26009?> | ||
| 23 | <?define msierrIISFailedReadWebError = 26010?> | ||
| 24 | <?define msierrIISFailedReadHttpHeader = 26011?> | ||
| 25 | <?define msierrIISFailedSchedTransaction = 26031?> | ||
| 26 | <?define msierrIISFailedSchedInstallWebs = 26032?> | ||
| 27 | <?define msierrIISFailedSchedInstallWebDirs = 26033?> | ||
| 28 | <?define msierrIISFailedSchedInstallVDirs = 26034?> | ||
| 29 | <?define msierrIISFailedSchedInstallFilters = 26035?> | ||
| 30 | <?define msierrIISFailedSchedInstallAppPool = 26036?> | ||
| 31 | <?define msierrIISFailedSchedInstallProp = 26037?> | ||
| 32 | <?define msierrIISFailedSchedInstallWebSvcExt = 26038?> | ||
| 33 | <?define msierrIISFailedSchedUninstallWebs = 26051?> | ||
| 34 | <?define msierrIISFailedSchedUninstallWebDirs = 26052?> | ||
| 35 | <?define msierrIISFailedSchedUninstallVDirs = 26053?> | ||
| 36 | <?define msierrIISFailedSchedUninstallFilters = 26054?> | ||
| 37 | <?define msierrIISFailedSchedUninstallAppPool = 26055?> | ||
| 38 | <?define msierrIISFailedSchedUninstallProp = 26056?> | ||
| 39 | <?define msierrIISFailedSchedUninstallWebSvcExt = 26057?> | ||
| 40 | <?define msierrIISFailedStartTransaction = 26101?> | ||
| 41 | <?define msierrIISFailedOpenKey = 26102?> | ||
| 42 | <?define msierrIISFailedCreateKey = 26103?> | ||
| 43 | <?define msierrIISFailedWriteData = 26104?> | ||
| 44 | <?define msierrIISFailedCreateApp = 26105?> | ||
| 45 | <?define msierrIISFailedDeleteKey = 26106?> | ||
| 46 | <?define msierrIISFailedDeleteApp = 26107?> | ||
| 47 | <?define msierrIISFailedDeleteValue = 26108?> | ||
| 48 | <?define msierrIISFailedCommitInUse = 26109?> | ||
| 49 | <?define msierrSQLFailedCreateDatabase = 26201?> | ||
| 50 | <?define msierrSQLFailedDropDatabase = 26202?> | ||
| 51 | <?define msierrSQLFailedConnectDatabase = 26203?> | ||
| 52 | <?define msierrSQLFailedExecString = 26204?> | ||
| 53 | <?define msierrSQLDatabaseAlreadyExists = 26205?> | ||
| 54 | <?define msierrPERFMONFailedRegisterDLL = 26251?> | ||
| 55 | <?define msierrPERFMONFailedUnregisterDLL = 26252?> | ||
| 56 | <?define msierrInstallPerfCounterData = 26253?> | ||
| 57 | <?define msierrUninstallPerfCounterData = 26254?> | ||
| 58 | <?define msierrSMBFailedCreate = 26301?> | ||
| 59 | <?define msierrSMBFailedDrop = 26302?> | ||
| 60 | <?define msierrCERTFailedOpen = 26351?> | ||
| 61 | <?define msierrCERTFailedAdd = 26352?> | ||
| 62 | <?define msierrUSRFailedUserCreate = 26401?> | ||
| 63 | <?define msierrUSRFailedUserCreatePswd = 26402?> | ||
| 64 | <?define msierrUSRFailedUserGroupAdd = 26403?> | ||
| 65 | <?define msierrUSRFailedUserCreateExists = 26404?> | ||
| 66 | <?define msierrUSRFailedGrantLogonAsService = 26405?> | ||
| 67 | <?define msierrDependencyMissingDependencies = 26451?> | ||
| 68 | <?define msierrDependencyHasDependents = 26452?> | ||
| 69 | <?define msierrDotNetRuntimeRequired = 27000?> | ||
| 70 | <?define msierrComPlusCannotConnect = 28001?> | ||
| 71 | <?define msierrComPlusPartitionReadFailed = 28002?> | ||
| 72 | <?define msierrComPlusPartitionRoleReadFailed = 28003?> | ||
| 73 | <?define msierrComPlusUserInPartitionRoleReadFailed = 28004?> | ||
| 74 | <?define msierrComPlusPartitionUserReadFailed = 28005?> | ||
| 75 | <?define msierrComPlusApplicationReadFailed = 28006?> | ||
| 76 | <?define msierrComPlusApplicationRoleReadFailed = 28007?> | ||
| 77 | <?define msierrComPlusUserInApplicationRoleReadFailed = 28008?> | ||
| 78 | <?define msierrComPlusAssembliesReadFailed = 28009?> | ||
| 79 | <?define msierrComPlusSubscriptionReadFailed = 28010?> | ||
| 80 | <?define msierrComPlusPartitionDependency = 28011?> | ||
| 81 | <?define msierrComPlusPartitionNotFound = 28012?> | ||
| 82 | <?define msierrComPlusPartitionIdConflict = 28013?> | ||
| 83 | <?define msierrComPlusPartitionNameConflict = 28014?> | ||
| 84 | <?define msierrComPlusApplicationDependency = 28015?> | ||
| 85 | <?define msierrComPlusApplicationNotFound = 28016?> | ||
| 86 | <?define msierrComPlusApplicationIdConflict = 28017?> | ||
| 87 | <?define msierrComPlusApplicationNameConflict = 28018?> | ||
| 88 | <?define msierrComPlusApplicationRoleDependency = 28019?> | ||
| 89 | <?define msierrComPlusApplicationRoleNotFound = 28020?> | ||
| 90 | <?define msierrComPlusApplicationRoleConflict = 28021?> | ||
| 91 | <?define msierrComPlusAssemblyDependency = 28022?> | ||
| 92 | <?define msierrComPlusSubscriptionIdConflict = 28023?> | ||
| 93 | <?define msierrComPlusSubscriptionNameConflict = 28024?> | ||
| 94 | <?define msierrComPlusFailedLookupNames = 28025?> | ||
| 95 | <?define msierrMsmqCannotConnect = 28101?> | ||
| 96 | </Include> \ No newline at end of file | ||
diff --git a/src/wixlib/packages.config b/src/wixlib/packages.config new file mode 100644 index 00000000..f3d424e1 --- /dev/null +++ b/src/wixlib/packages.config | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <packages> | ||
| 3 | <package id="Nerdbank.GitVersioning" version="2.1.65" developmentDependency="true" targetFramework="net40" /> | ||
| 4 | <package id="WixToolset.MSBuild" version="4.0.0-build-0005" developmentDependency="true" targetFramework="net40" /> | ||
| 5 | </packages> \ No newline at end of file | ||
diff --git a/src/wixlib/sql.v3.ncrunchproject b/src/wixlib/sql.v3.ncrunchproject new file mode 100644 index 00000000..319cd523 --- /dev/null +++ b/src/wixlib/sql.v3.ncrunchproject | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | <ProjectConfiguration> | ||
| 2 | <Settings> | ||
| 3 | <IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely> | ||
| 4 | </Settings> | ||
| 5 | </ProjectConfiguration> \ No newline at end of file | ||
diff --git a/src/wixlib/sql.wixproj b/src/wixlib/sql.wixproj new file mode 100644 index 00000000..8a775f8f --- /dev/null +++ b/src/wixlib/sql.wixproj | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
| 3 | <Project DefaultTargets="Build" InitialTargets="EnsureWixToolsetInstalled" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="15.0"> | ||
| 4 | <Import Project="..\..\packages\WixToolset.MSBuild.4.0.0-build-0005\build\WixToolset.MSBuild.props" Condition="Exists('..\..\packages\WixToolset.MSBuild.4.0.0-build-0005\build\WixToolset.MSBuild.props')" /> | ||
| 5 | <Import Project="..\FindLocalWix.props" /> | ||
| 6 | <PropertyGroup> | ||
| 7 | <ProjectGuid>{9ACF1A20-D801-45CC-A463-F9D13E506AA3}</ProjectGuid> | ||
| 8 | <OutputName>sql</OutputName> | ||
| 9 | <OutputType>Library</OutputType> | ||
| 10 | <BindFiles>true</BindFiles> | ||
| 11 | <Pedantic>true</Pedantic> | ||
| 12 | <Cultures>en-us</Cultures> | ||
| 13 | </PropertyGroup> | ||
| 14 | <ItemGroup> | ||
| 15 | <Compile Include="SqlExtension.wxs" /> | ||
| 16 | <EmbeddedResource Include="de-de.wxl" /> | ||
| 17 | <EmbeddedResource Include="en-us.wxl" /> | ||
| 18 | <EmbeddedResource Include="es-es.wxl" /> | ||
| 19 | <EmbeddedResource Include="ja-jp.wxl" /> | ||
| 20 | <EmbeddedResource Include="pl-pl.wxl" /> | ||
| 21 | <EmbeddedResource Include="pt-br.wxl" /> | ||
| 22 | <EmbeddedResource Include="pt-pt.wxl" /> | ||
| 23 | </ItemGroup> | ||
| 24 | <ItemGroup> | ||
| 25 | <None Include="packages.config" /> | ||
| 26 | </ItemGroup> | ||
| 27 | <ItemGroup> | ||
| 28 | <ProjectReference Include="..\ca\sqlca.vcxproj"> | ||
| 29 | <Name>sqlca</Name> | ||
| 30 | <Project>{4DCA6E4B-A1F1-4450-BC2D-94AC20F31935}</Project> | ||
| 31 | </ProjectReference> | ||
| 32 | </ItemGroup> | ||
| 33 | <Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' AND Exists('$(WixTargetsPath)') " /> | ||
| 34 | <Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\wix.targets') " /> | ||
| 35 | <Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' "> | ||
| 36 | <Error Text="WiX Toolset build tools (v4.0 or later) must be installed to build this project. To download the WiX Toolset, go to http://wixtoolset.org/releases/." /> | ||
| 37 | </Target> | ||
| 38 | <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> | ||
| 39 | <PropertyGroup> | ||
| 40 | <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> | ||
| 41 | </PropertyGroup> | ||
| 42 | <Error Condition="!Exists('..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets'))" /> | ||
| 43 | <Error Condition="!Exists('..\..\packages\WixToolset.MSBuild.4.0.0-build-0005\build\WixToolset.MSBuild.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.MSBuild.4.0.0-build-0005\build\WixToolset.MSBuild.props'))" /> | ||
| 44 | </Target> | ||
| 45 | <Import Project="..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets" Condition="Exists('..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets')" /> | ||
| 46 | </Project> \ No newline at end of file | ||
