├── .gitattributes ├── .gitignore ├── CreateSQLoogleBotUser.sql ├── LICENSE.txt ├── README.md ├── Sqloogle.Web ├── App_Start │ ├── BundleConfig.cs │ ├── FilterConfig.cs │ └── RouteConfig.cs ├── Content │ ├── colorbox.css │ ├── combined.min.css │ ├── images │ │ ├── SQLoogleLogo.png │ │ ├── SmallSQLoogleLogo.png │ │ ├── border1.png │ │ ├── border2.png │ │ ├── icons.jpg │ │ ├── icons.png │ │ ├── icons_hover.png │ │ ├── icons_selected.png │ │ ├── loader.gif │ │ └── loading.gif │ ├── prettify.css │ └── site.css ├── Controllers │ ├── HomeController.cs │ ├── MiaController.cs │ └── SqlController.cs ├── Global.asax ├── Global.asax.cs ├── Models │ ├── MissingIndices │ │ ├── SearchResponse.cs │ │ └── SearchResult.cs │ ├── ScriptedObjects │ │ ├── SearchResponse.cs │ │ └── SearchResult.cs │ └── SearchResponse.cs ├── Properties │ └── AssemblyInfo.cs ├── Scripts │ ├── codemirror-sql.js │ ├── date.format.js │ ├── google-code-prettify │ │ ├── lang-apollo.js │ │ ├── lang-clj.js │ │ ├── lang-css.js │ │ ├── lang-go.js │ │ ├── lang-hs.js │ │ ├── lang-lisp.js │ │ ├── lang-lua.js │ │ ├── lang-ml.js │ │ ├── lang-n.js │ │ ├── lang-proto.js │ │ ├── lang-scala.js │ │ ├── lang-sql.js │ │ ├── lang-tex.js │ │ ├── lang-vb.js │ │ ├── lang-vhdl.js │ │ ├── lang-wiki.js │ │ ├── lang-xq.js │ │ ├── lang-yaml.js │ │ ├── prettify.js │ │ └── stack-prettify.js │ ├── mergely-3.3.3 │ │ ├── LICENSE.html │ │ ├── doc │ │ │ ├── LICENSE │ │ │ └── index.html │ │ ├── editor │ │ │ ├── editor.css │ │ │ ├── editor.js │ │ │ ├── editor.php │ │ │ ├── images │ │ │ │ ├── arrow-down-v.png │ │ │ │ ├── arrow-left-v.png │ │ │ │ ├── arrow-right-v.png │ │ │ │ ├── arrow-right.png │ │ │ │ ├── arrow-up-v.png │ │ │ │ ├── banner.png │ │ │ │ ├── check.png │ │ │ │ ├── download.png │ │ │ │ ├── redo.png │ │ │ │ ├── share.png │ │ │ │ ├── swap.png │ │ │ │ ├── undo.png │ │ │ │ ├── upload.png │ │ │ │ └── x-mark.png │ │ │ └── lib │ │ │ │ ├── farbtastic │ │ │ │ ├── LICENSE.txt │ │ │ │ ├── farbtastic.css │ │ │ │ ├── farbtastic.js │ │ │ │ ├── index.html │ │ │ │ ├── marker.png │ │ │ │ ├── mask.png │ │ │ │ └── wheel.png │ │ │ │ ├── gatag.js │ │ │ │ ├── tipsy │ │ │ │ ├── jquery.tipsy.js │ │ │ │ └── tipsy.css │ │ │ │ ├── wicked-ui.css │ │ │ │ └── wicked-ui.js │ │ ├── examples │ │ │ ├── ajax.html │ │ │ ├── lhs.txt │ │ │ ├── rhs.txt │ │ │ ├── simple.html │ │ │ └── size.html │ │ └── lib │ │ │ ├── codemirror.css │ │ │ ├── codemirror.js │ │ │ ├── codemirror.min.js │ │ │ ├── mergely.css │ │ │ ├── mergely.js │ │ │ ├── mergely.min.js │ │ │ └── searchcursor.js │ └── sqloogle.js ├── Sqloogle.Web.csproj ├── Views │ ├── Home │ │ └── Index.cshtml │ ├── Shared │ │ ├── Error.cshtml │ │ └── _Layout.cshtml │ ├── Web.config │ └── _ViewStart.cshtml ├── Web.Debug.config ├── Web.Release.config ├── Web.config ├── favicon.ico └── packages.config ├── Sqloogle.sln ├── Sqloogle ├── IIndexWriter.cs ├── Libs │ └── DBDiff.Schema │ │ ├── Attributes │ │ └── ShowCollection.cs │ │ ├── Errors │ │ └── MessageLog.cs │ │ ├── Events │ │ ├── ProgressEventArgs.cs │ │ └── ProgressEventHandler.cs │ │ ├── LICENSE.txt │ │ ├── Misc │ │ └── SchemaException.cs │ │ ├── Model │ │ ├── IDatabase.cs │ │ ├── ISchemaBase.cs │ │ ├── ISchemaList.cs │ │ ├── SchemaBase.cs │ │ ├── SchemaList.cs │ │ └── SearchSchemaBase.cs │ │ ├── SQLScript.cs │ │ ├── SQLScriptList.cs │ │ ├── SqlAction.cs │ │ ├── SqlServer2005 │ │ ├── Compare │ │ │ ├── CompareAssemblies.cs │ │ │ ├── CompareBase.cs │ │ │ ├── CompareCLRFunction.cs │ │ │ ├── CompareCLRStoreProcedure.cs │ │ │ ├── CompareCLRTriggers.cs │ │ │ ├── CompareColumns.cs │ │ │ ├── CompareColumnsConstraints.cs │ │ │ ├── CompareConstraints.cs │ │ │ ├── CompareDDLTriggers.cs │ │ │ ├── CompareDatabase.cs │ │ │ ├── CompareFileGroups.cs │ │ │ ├── CompareFullText.cs │ │ │ ├── CompareFullTextIndex.cs │ │ │ ├── CompareFunctions.cs │ │ │ ├── CompareIndexes.cs │ │ │ ├── ComparePartitionFunction.cs │ │ │ ├── ComparePartitionSchemes.cs │ │ │ ├── CompareRoles.cs │ │ │ ├── CompareRules.cs │ │ │ ├── CompareSchemas.cs │ │ │ ├── CompareStoreProcedures.cs │ │ │ ├── CompareSynonyms.cs │ │ │ ├── CompareTableType.cs │ │ │ ├── CompareTables.cs │ │ │ ├── CompareTablesOptions.cs │ │ │ ├── CompareTriggers.cs │ │ │ ├── CompareUserDataTypes.cs │ │ │ ├── CompareUsers.cs │ │ │ ├── CompareViews.cs │ │ │ └── CompareXMLSchemas.cs │ │ ├── Generates │ │ │ ├── Generate.cs │ │ │ ├── GenerateAssemblies.cs │ │ │ ├── GenerateConstraint.cs │ │ │ ├── GenerateDDLTriggers.cs │ │ │ ├── GenerateDatabase.cs │ │ │ ├── GenerateDefaults.cs │ │ │ ├── GenerateExtendedProperties.cs │ │ │ ├── GenerateFileGroups.cs │ │ │ ├── GenerateFullText.cs │ │ │ ├── GenerateFullTextIndex.cs │ │ │ ├── GenerateFunctions.cs │ │ │ ├── GenerateIndex.cs │ │ │ ├── GeneratePartitionFunctions.cs │ │ │ ├── GeneratePartitionScheme.cs │ │ │ ├── GenerateRules.cs │ │ │ ├── GenerateSchemas.cs │ │ │ ├── GenerateStoreProcedures.cs │ │ │ ├── GenerateSynonyms.cs │ │ │ ├── GenerateTables.cs │ │ │ ├── GenerateTextObjects.cs │ │ │ ├── GenerateTriggers.cs │ │ │ ├── GenerateUserDataTypes.cs │ │ │ ├── GenerateUsers.cs │ │ │ ├── GenerateViews.cs │ │ │ ├── GenerateXMLSchemas.cs │ │ │ ├── SQLCommands │ │ │ │ ├── ConstraintSQLCommand.cs │ │ │ │ ├── DatabaseSQLCommand.cs │ │ │ │ ├── FullTextIndexSQLCommand.cs │ │ │ │ ├── FunctionSQLCommand.cs │ │ │ │ ├── IndexSQLCommand.cs │ │ │ │ ├── TableSQLCommand.cs │ │ │ │ ├── UserDataTypeCommand.cs │ │ │ │ ├── UserSQLCommand.cs │ │ │ │ └── ViewSQLCommand.cs │ │ │ └── Util │ │ │ │ ├── Constants.cs │ │ │ │ ├── ConvertType.cs │ │ │ │ ├── SqlStrings.cs │ │ │ │ └── Strings.cs │ │ ├── Model │ │ │ ├── Assembly.cs │ │ │ ├── AssemblyFile.cs │ │ │ ├── CLRCode.cs │ │ │ ├── CLRFunction.cs │ │ │ ├── CLRStoreProcedure.cs │ │ │ ├── CLRTrigger.cs │ │ │ ├── Code.cs │ │ │ ├── Column.cs │ │ │ ├── ColumnConstraint.cs │ │ │ ├── Columns.cs │ │ │ ├── Constraint.cs │ │ │ ├── ConstraintColumn.cs │ │ │ ├── ConstraintColumns.cs │ │ │ ├── Database.cs │ │ │ ├── DatabaseInfo.cs │ │ │ ├── Default.cs │ │ │ ├── Dependence.cs │ │ │ ├── Dependencies.cs │ │ │ ├── ExtendedProperty.cs │ │ │ ├── FileGroup.cs │ │ │ ├── FileGroupFile.cs │ │ │ ├── FileGroupFiles.cs │ │ │ ├── FullText.cs │ │ │ ├── FullTextIndex.cs │ │ │ ├── FullTextIndexColumn.cs │ │ │ ├── Function.cs │ │ │ ├── ITableType.cs │ │ │ ├── Index.cs │ │ │ ├── IndexColumn.cs │ │ │ ├── IndexColumns.cs │ │ │ ├── Interfaces │ │ │ │ ├── ICode.cs │ │ │ │ └── ISQLServerSchemaBase.cs │ │ │ ├── ObjectDependency.cs │ │ │ ├── Parameter.cs │ │ │ ├── PartitionFunction.cs │ │ │ ├── PartitionScheme.cs │ │ │ ├── Role.cs │ │ │ ├── Rule.cs │ │ │ ├── SQLServerSchemaBase.cs │ │ │ ├── Schema.cs │ │ │ ├── StoreProcedure.cs │ │ │ ├── Synonym.cs │ │ │ ├── Table.cs │ │ │ ├── TableOption.cs │ │ │ ├── TablePartition.cs │ │ │ ├── TableType.cs │ │ │ ├── Trigger.cs │ │ │ ├── User.cs │ │ │ ├── UserDataType.cs │ │ │ ├── Util │ │ │ │ └── FormatCode.cs │ │ │ ├── View.cs │ │ │ └── XMLSchema.cs │ │ └── Options │ │ │ ├── SqlOption.cs │ │ │ ├── SqlOptionComparison.cs │ │ │ ├── SqlOptionDefault.cs │ │ │ ├── SqlOptionFilter.cs │ │ │ ├── SqlOptionFilterItem.cs │ │ │ ├── SqlOptionIgnore.cs │ │ │ └── SqlOptionScript.cs │ │ └── StatusEnum.cs ├── LuceneFieldSettings.cs ├── LuceneWriter.cs ├── Operations │ ├── AbstractLuceneLoad.cs │ ├── CachedObjectStatsExtract.cs │ ├── CachedObjectStatsJoin.cs │ ├── CachedSqlAggregate.cs │ ├── CachedSqlExtract.cs │ ├── CachedSqlPostTransform.cs │ ├── CachedSqlPreTransform.cs │ ├── DatabaseExtract.cs │ ├── DatabaseFilter.cs │ ├── DefinitionExtract.cs │ ├── FakeOperation.cs │ ├── IndexStatsExtract.cs │ ├── IndexStatsJoin.cs │ ├── LuceneExtract.cs │ ├── LuceneLoad.cs │ ├── MissingIndexExtract.cs │ ├── MissingIndexTransform.cs │ ├── ReportingServicesExtract.cs │ ├── ReportingServicesTransform.cs │ ├── SqlAgentJobExtract.cs │ ├── SqloogleAggregate.cs │ ├── SqloogleCompare.cs │ ├── SqloogleTransform.cs │ ├── Support │ │ ├── AppendToRowOperation.cs │ │ ├── InputOperation.cs │ │ ├── KeyCheckOperation.cs │ │ ├── LogOperation.cs │ │ ├── ParallelUnionAllOperation.cs │ │ ├── SerialUnionAllOperation.cs │ │ ├── SqlOperation.cs │ │ ├── SqlSubOperation.cs │ │ └── UnionOperation.cs │ ├── TableStatsExtract.cs │ └── TableStatsJoin.cs ├── Processes │ ├── CachedSqlProcess.cs │ ├── DefinitionProcess.cs │ ├── ReportingServicesProcess.cs │ ├── ServerCrawlProcess.cs │ ├── ServerMiaCrawlProcess.cs │ ├── SqloogleEtlProcess.cs │ ├── SqloogleMiaProcess.cs │ └── SqloogleProcess.cs ├── Properties │ └── AssemblyInfo.cs ├── Search │ ├── IScriptSearcher.cs │ ├── SqloogleMiaSearcher.cs │ └── SqloogleSearcher.cs ├── SqlConnectionChecker.cs ├── Sqloogle.csproj ├── SqloogleBotConfiguration.cs ├── Utilities │ ├── Dates.cs │ ├── Docs.cs │ ├── Enums.cs │ ├── LinqExtensions.cs │ ├── SqlStrings.cs │ └── Strings.cs ├── app.config └── packages.config ├── SqloogleBot ├── App.config ├── NLog.config ├── Options.cs ├── Properties │ ├── AssemblyInfo.cs │ └── app.manifest ├── QuartzCronScheduler.cs ├── QuartzJobFactory.cs ├── QuartzLogAdaptor.cs ├── QuartzLogger.cs ├── SqloogleBot.cs ├── SqloogleBot.csproj ├── SqloogleJob.cs ├── Utility.cs ├── packages.config └── quartz.config ├── Tests ├── App.config ├── EtlProcessHelper.cs ├── Files │ └── Report.rdl ├── Properties │ └── AssemblyInfo.cs ├── TestConfig.cs ├── TestEtl.cs ├── TestSqlParameterReplacer.cs ├── TestSqlTableFinder.cs ├── TestSqloogleCompare.cs ├── TestUtility.cs ├── Tests.csproj └── packages.config └── packages └── repositories.config /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /CreateSQLoogleBotUser.sql: -------------------------------------------------------------------------------- 1 | USE master; 2 | 3 | IF NOT EXISTS ( 4 | SELECT * 5 | FROM master.sys.server_principals 6 | WHERE name = 'SQLoogleBot' 7 | ) BEGIN 8 | CREATE LOGIN [SQLoogleBot] WITH PASSWORD=N'password', DEFAULT_DATABASE=[master], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF; 9 | GRANT VIEW ANY DATABASE TO [SQLoogleBot]; 10 | GRANT VIEW ANY DEFINITION TO [SQLoogleBot]; 11 | GRANT VIEW SERVER STATE TO [SQLoogleBot]; 12 | PRINT 'Created Login with appropriate server level rights'; 13 | END 14 | 15 | -- NOTE: Once you've created SQLoogleBot in model database, it should already be in any new databases. 16 | EXECUTE master.sys.sp_MSforeachdb ' 17 | USE [?]; 18 | IF DB_NAME() != ''tempdb'' AND NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N''SQLoogleBot'') 19 | BEGIN 20 | CREATE USER [SQLoogleBot] FOR LOGIN [SQLoogleBot]; 21 | PRINT ''User Created in '' + DB_NAME(); 22 | END 23 | 24 | EXEC sp_change_users_login ''Auto_Fix'', ''SQLoogleBot''; 25 | 26 | IF DATABASE_PRINCIPAL_ID(''RSExecRole'') IS NOT NULL AND OBJECT_ID(''Catalog'') IS NOT NULL 27 | BEGIN 28 | GRANT SELECT ON [dbo].[Catalog] TO [SQLoogleBot]; 29 | PRINT ''Granted Permission to Reporting Services Jobs''; 30 | END 31 | 32 | IF DB_NAME() = ''msdb'' 33 | BEGIN 34 | GRANT SELECT ON [dbo].[sysjobs] TO [SQLoogleBot]; 35 | GRANT SELECT ON [dbo].[sysjobsteps] TO [SQLoogleBot]; 36 | PRINT ''Granted Permission to SQL Agent Jobs''; 37 | END 38 | ' -------------------------------------------------------------------------------- /Sqloogle.Web/App_Start/BundleConfig.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System.Web; 18 | using System.Web.Optimization; 19 | 20 | namespace Sqloogle.Web { 21 | public class BundleConfig { 22 | // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862 23 | public static void RegisterBundles(BundleCollection bundles) { 24 | //bundles.Add(new ScriptBundle("~/bundles/jquery").Include("~/Scripts/jquery-{version}.js")); 25 | //bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include("~/Scripts/jquery.validate*")); 26 | 27 | // Use the development version of Modernizr to develop with and learn from. Then, when you're 28 | // ready for production, use the build tool at http://modernizr.com to pick only the tests you need. 29 | 30 | //bundles.Add(new ScriptBundle("~/bundles/modernizr").Include("~/Scripts/modernizr-*")); 31 | //bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include("~/Scripts/bootstrap.js","~/Scripts/respond.js")); 32 | //bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/bootstrap.css","~/Content/site.css")); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Sqloogle.Web/App_Start/FilterConfig.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System.Web; 18 | using System.Web.Mvc; 19 | 20 | namespace Sqloogle.Web { 21 | public class FilterConfig { 22 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) { 23 | filters.Add(new HandleErrorAttribute()); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Sqloogle.Web/App_Start/RouteConfig.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System; 18 | using System.Collections.Generic; 19 | using System.Linq; 20 | using System.Web; 21 | using System.Web.Mvc; 22 | using System.Web.Routing; 23 | 24 | namespace Sqloogle.Web { 25 | public class RouteConfig { 26 | public static void RegisterRoutes(RouteCollection routes) { 27 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 28 | 29 | routes.MapRoute( 30 | name: "Default", 31 | url: "{controller}/{action}/{id}", 32 | defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } 33 | ); 34 | 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Sqloogle.Web/Content/images/SQLoogleLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/Content/images/SQLoogleLogo.png -------------------------------------------------------------------------------- /Sqloogle.Web/Content/images/SmallSQLoogleLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/Content/images/SmallSQLoogleLogo.png -------------------------------------------------------------------------------- /Sqloogle.Web/Content/images/border1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/Content/images/border1.png -------------------------------------------------------------------------------- /Sqloogle.Web/Content/images/border2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/Content/images/border2.png -------------------------------------------------------------------------------- /Sqloogle.Web/Content/images/icons.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/Content/images/icons.jpg -------------------------------------------------------------------------------- /Sqloogle.Web/Content/images/icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/Content/images/icons.png -------------------------------------------------------------------------------- /Sqloogle.Web/Content/images/icons_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/Content/images/icons_hover.png -------------------------------------------------------------------------------- /Sqloogle.Web/Content/images/icons_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/Content/images/icons_selected.png -------------------------------------------------------------------------------- /Sqloogle.Web/Content/images/loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/Content/images/loader.gif -------------------------------------------------------------------------------- /Sqloogle.Web/Content/images/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/Content/images/loading.gif -------------------------------------------------------------------------------- /Sqloogle.Web/Content/prettify.css: -------------------------------------------------------------------------------- 1 | .pln 2 | { 3 | color: #000; 4 | } 5 | @media screen 6 | { 7 | .str 8 | { 9 | color: #F00; 10 | } 11 | .kwd 12 | { 13 | color: #00E; 14 | } 15 | .com 16 | { 17 | color: #393; 18 | } 19 | .typ 20 | { 21 | color: #606; 22 | } 23 | .lit 24 | { 25 | color: #066; 26 | } 27 | .pun, .opn, .clo 28 | { 29 | color: #660; 30 | } 31 | .tag 32 | { 33 | color: #008; 34 | } 35 | .atn 36 | { 37 | color: #606; 38 | } 39 | .atv 40 | { 41 | color: #080; 42 | } 43 | .dec, .var 44 | { 45 | color: #606; 46 | } 47 | .fun 48 | { 49 | color: #F3C; 50 | } 51 | } 52 | @media print,projection 53 | { 54 | .str 55 | { 56 | color: #060; 57 | } 58 | .kwd 59 | { 60 | color: #006; 61 | font-weight: bold; 62 | } 63 | .com 64 | { 65 | color: #600; 66 | font-style: italic; 67 | } 68 | .typ 69 | { 70 | color: #404; 71 | font-weight: bold; 72 | } 73 | .lit 74 | { 75 | color: #044; 76 | } 77 | .pun, .opn, .clo 78 | { 79 | color: #440; 80 | } 81 | .tag 82 | { 83 | color: #006; 84 | font-weight: bold; 85 | } 86 | .atn 87 | { 88 | color: #404; 89 | } 90 | .atv 91 | { 92 | color: #060; 93 | } 94 | } 95 | ol.linenums 96 | { 97 | margin-top: 0; 98 | margin-bottom: 0; 99 | } 100 | li.L0, li.L1, li.L2, li.L3, li.L5, li.L6, li.L7, li.L8 101 | { 102 | list-style-type: none; 103 | } 104 | li.L1, li.L3, li.L5, li.L7, li.L9 105 | { 106 | background: #eee; 107 | } -------------------------------------------------------------------------------- /Sqloogle.Web/Content/site.css: -------------------------------------------------------------------------------- 1 | input.q { 2 | width: 500px; 3 | height: 33px; 4 | font-size: large; 5 | margin-bottom: 13px; 6 | } 7 | 8 | table { 9 | border-collapse: collapse; 10 | width: 100%; 11 | } 12 | 13 | th 14 | { 15 | text-align: left; 16 | padding: 0; 17 | padding-right: 1em; 18 | white-space: nowrap; 19 | } 20 | 21 | td { 22 | text-align: left; 23 | padding-right: 5px; 24 | } 25 | 26 | tr.hit td { 27 | border-bottom: thin solid lightgray; 28 | vertical-align: top; 29 | } 30 | 31 | tr.hit span { 32 | color: darkgray; 33 | } 34 | 35 | tr.hit:hover { 36 | background-color: lavender; 37 | } 38 | 39 | tr.selected { 40 | background-color: rgb(205, 205, 218); 41 | border-bottom: thin solid lightgray; 42 | vertical-align: top; 43 | } 44 | 45 | span.dim { 46 | border-bottom: thin solid Gray; 47 | } 48 | 49 | pre { 50 | font-size: 12pt; 51 | padding: 0px 7px 0px 7px; 52 | font-family: Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif; 53 | margin-bottom: 10px; 54 | /* background-color: #EEE; */ 55 | overflow: auto; 56 | width: auto; 57 | width: 100% !ie7; 58 | padding-bottom: 20px !ie7; 59 | height: 94%; 60 | white-space: normal; 61 | } 62 | 63 | span.icons { 64 | display: inline-block; 65 | width: 23px; 66 | height: 23px; 67 | background-image: url(images/icons.png); 68 | background-repeat: no-repeat; 69 | vertical-align: middle; 70 | cursor: pointer; 71 | } 72 | 73 | .download { background-position: -67px -239px; } 74 | .view { background-position: -98px -209px; } 75 | .close { background-position: -66px -0px; } 76 | .query { background-position: -98px -209px; } 77 | .query-indexes { background-position: -132px -209px; } 78 | .create { background-position: -32px -238px; } 79 | .error { color: red;font-weight: bold; } 80 | 81 | img { border: none; } 82 | 83 | div.logo { 84 | background-image: url(images/SQLoogleLogo.png); 85 | background-repeat: no-repeat; 86 | background-position: center; 87 | } 88 | 89 | img.loader { 90 | padding: 25px; 91 | } -------------------------------------------------------------------------------- /Sqloogle.Web/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System.Web.Mvc; 18 | using System.Web.SessionState; 19 | 20 | namespace Sqloogle.Web.Controllers { 21 | 22 | [SessionState(SessionStateBehavior.Disabled)] 23 | public class HomeController : Controller { 24 | public ActionResult Index() { 25 | return View(); 26 | } 27 | 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Sqloogle.Web/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="Sqloogle.Web.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /Sqloogle.Web/Global.asax.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System; 18 | using System.Collections.Generic; 19 | using System.Linq; 20 | using System.Web; 21 | using System.Web.Mvc; 22 | using System.Web.Optimization; 23 | using System.Web.Routing; 24 | 25 | namespace Sqloogle.Web { 26 | public class MvcApplication : System.Web.HttpApplication { 27 | protected void Application_Start() { 28 | AreaRegistration.RegisterAllAreas(); 29 | FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); 30 | RouteConfig.RegisterRoutes(RouteTable.Routes); 31 | BundleConfig.RegisterBundles(BundleTable.Bundles); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Sqloogle.Web/Models/MissingIndices/SearchResponse.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System.Collections.Generic; 18 | using System.Web.Helpers; 19 | 20 | namespace Sqloogle.Web.Models.MissingIndices 21 | { 22 | public class SearchResponse 23 | { 24 | public List searchresults = new List(); 25 | public bool success = true; 26 | public string message = string.Empty; 27 | 28 | public string ToJson() 29 | { 30 | return Json.Encode(this); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /Sqloogle.Web/Models/ScriptedObjects/SearchResponse.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System.Collections.Generic; 18 | using System.Web.Helpers; 19 | 20 | namespace Sqloogle.Web.Models.ScriptedObjects 21 | { 22 | public class SearchResponse 23 | { 24 | public List searchresults = new List(); 25 | public bool success = true; 26 | public string message = string.Empty; 27 | 28 | public string ToJson() 29 | { 30 | return Json.Encode(this); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /Sqloogle.Web/Models/SearchResponse.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System.Collections.Generic; 18 | using System.Web.Helpers; 19 | 20 | namespace Sqloogle.Web.Models { 21 | public class SearchResponse { 22 | public List searchresults = new List(); 23 | public bool success = true; 24 | public string message = string.Empty; 25 | 26 | public string ToJson() { 27 | return Json.Encode(this); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Sqloogle.Web/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System.Reflection; 18 | using System.Runtime.CompilerServices; 19 | using System.Runtime.InteropServices; 20 | 21 | // General Information about an assembly is controlled through the following 22 | // set of attributes. Change these attribute values to modify the information 23 | // associated with an assembly. 24 | [assembly: AssemblyTitle("Sqloogle.Web")] 25 | [assembly: AssemblyDescription("")] 26 | [assembly: AssemblyConfiguration("")] 27 | [assembly: AssemblyCompany("")] 28 | [assembly: AssemblyProduct("Sqloogle.Web")] 29 | [assembly: AssemblyCopyright("Copyright © Dale Newman 2015")] 30 | [assembly: AssemblyTrademark("")] 31 | [assembly: AssemblyCulture("")] 32 | 33 | // Setting ComVisible to false makes the types in this assembly not visible 34 | // to COM components. If you need to access a type in this assembly from 35 | // COM, set the ComVisible attribute to true on that type. 36 | [assembly: ComVisible(false)] 37 | 38 | // The following GUID is for the ID of the typelib if this project is exposed to COM 39 | [assembly: Guid("a59ab789-c066-434a-b67c-31b4007e3ad3")] 40 | 41 | // Version information for an assembly consists of the following four values: 42 | // 43 | // Major Version 44 | // Minor Version 45 | // Build Number 46 | // Revision 47 | // 48 | // You can specify all the values or you can default the Revision and Build Numbers 49 | // by using the '*' as shown below: 50 | [assembly: AssemblyVersion("0.0.1.0")] 51 | [assembly: AssemblyFileVersion("0.0.1.0")] 52 | -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/google-code-prettify/lang-apollo.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/Scripts/google-code-prettify/lang-apollo.js -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/google-code-prettify/lang-clj.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2011 Google Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | var a=null; 17 | PR.registerLangHandler(PR.createSimpleLexer([["opn",/^[([{]+/,a,"([{"],["clo",/^[)\]}]+/,a,")]}"],["com",/^;[^\n\r]*/,a,";"],["pln",/^[\t\n\r \xa0]+/,a,"\t\n\r \xa0"],["str",/^"(?:[^"\\]|\\[\S\s])*(?:"|$)/,a,'"']],[["kwd",/^(?:def|if|do|let|quote|var|fn|loop|recur|throw|try|monitor-enter|monitor-exit|defmacro|defn|defn-|macroexpand|macroexpand-1|for|doseq|dosync|dotimes|and|or|when|not|assert|doto|proxy|defstruct|first|rest|cons|defprotocol|deftype|defrecord|reify|defmulti|defmethod|meta|with-meta|ns|in-ns|create-ns|import|intern|refer|alias|namespace|resolve|ref|deref|refset|new|set!|memfn|to-array|into-array|aset|gen-class|reduce|map|filter|find|nil?|empty?|hash-map|hash-set|vec|vector|seq|flatten|reverse|assoc|dissoc|list|list?|disj|get|union|difference|intersection|extend|extend-type|extend-protocol|prn)\b/,a], 18 | ["typ",/^:[\dA-Za-z-]+/]]),["clj"]); 19 | -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/google-code-prettify/lang-css.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n "]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com", 2 | /^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); 3 | -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/google-code-prettify/lang-go.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/Scripts/google-code-prettify/lang-go.js -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/google-code-prettify/lang-hs.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t-\r ]+/,null,"\t\n \r "],["str",/^"(?:[^\n\f\r"\\]|\\[\S\s])*(?:"|$)/,null,'"'],["str",/^'(?:[^\n\f\r'\\]|\\[^&])'?/,null,"'"],["lit",/^(?:0o[0-7]+|0x[\da-f]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)/i,null,"0123456789"]],[["com",/^(?:--+[^\n\f\r]*|{-(?:[^-]|-+[^}-])*-})/],["kwd",/^(?:case|class|data|default|deriving|do|else|if|import|in|infix|infixl|infixr|instance|let|module|newtype|of|then|type|where|_)(?=[^\d'A-Za-z]|$)/, 2 | null],["pln",/^(?:[A-Z][\w']*\.)*[A-Za-z][\w']*/],["pun",/^[^\d\t-\r "'A-Za-z]+/]]),["hs"]); 3 | -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/google-code-prettify/lang-lisp.js: -------------------------------------------------------------------------------- 1 | var a=null; 2 | PR.registerLangHandler(PR.createSimpleLexer([["opn",/^\(+/,a,"("],["clo",/^\)+/,a,")"],["com",/^;[^\n\r]*/,a,";"],["pln",/^[\t\n\r \xa0]+/,a,"\t\n\r \xa0"],["str",/^"(?:[^"\\]|\\[\S\s])*(?:"|$)/,a,'"']],[["kwd",/^(?:block|c[ad]+r|catch|con[ds]|def(?:ine|un)|do|eq|eql|equal|equalp|eval-when|flet|format|go|if|labels|lambda|let|load-time-value|locally|macrolet|multiple-value-call|nil|progn|progv|quote|require|return-from|setq|symbol-macrolet|t|tagbody|the|throw|unwind)\b/,a], 3 | ["lit",/^[+-]?(?:[#0]x[\da-f]+|\d+\/\d+|(?:\.\d+|\d+(?:\.\d*)?)(?:[de][+-]?\d+)?)/i],["lit",/^'(?:-*(?:\w|\\[!-~])(?:[\w-]*|\\[!-~])[!=?]?)?/],["pln",/^-*(?:[_a-z]|\\[!-~])(?:[\w-]*|\\[!-~])[!=?]?/i],["pun",/^[^\w\t\n\r "'-);\\\xa0]+/]]),["cl","el","lisp","scm"]); 4 | -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/google-code-prettify/lang-lua.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/Scripts/google-code-prettify/lang-lua.js -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/google-code-prettify/lang-ml.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/Scripts/google-code-prettify/lang-ml.js -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/google-code-prettify/lang-n.js: -------------------------------------------------------------------------------- 1 | var a=null; 2 | PR.registerLangHandler(PR.createSimpleLexer([["str",/^(?:'(?:[^\n\r'\\]|\\.)*'|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,a,'"'],["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,a,"#"],["pln",/^\s+/,a," \r\n\t\xa0"]],[["str",/^@"(?:[^"]|"")*(?:"|$)/,a],["str",/^<#[^#>]*(?:#>|$)/,a],["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,a],["com",/^\/\/[^\n\r]*/,a],["com",/^\/\*[\S\s]*?(?:\*\/|$)/, 3 | a],["kwd",/^(?:abstract|and|as|base|catch|class|def|delegate|enum|event|extern|false|finally|fun|implements|interface|internal|is|macro|match|matches|module|mutable|namespace|new|null|out|override|params|partial|private|protected|public|ref|sealed|static|struct|syntax|this|throw|true|try|type|typeof|using|variant|virtual|volatile|when|where|with|assert|assert2|async|break|checked|continue|do|else|ensures|for|foreach|if|late|lock|new|nolate|otherwise|regexp|repeat|requires|return|surroundwith|unchecked|unless|using|while|yield)\b/, 4 | a],["typ",/^(?:array|bool|byte|char|decimal|double|float|int|list|long|object|sbyte|short|string|ulong|uint|ufloat|ulong|ushort|void)\b/,a],["lit",/^@[$_a-z][\w$@]*/i,a],["typ",/^@[A-Z]+[a-z][\w$@]*/,a],["pln",/^'?[$_a-z][\w$@]*/i,a],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,a,"0123456789"],["pun",/^.[^\s\w"-$'./@`]*/,a]]),["n","nemerle"]); 5 | -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/google-code-prettify/lang-proto.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.sourceDecorator({keywords:"bytes,default,double,enum,extend,extensions,false,group,import,max,message,option,optional,package,repeated,required,returns,rpc,service,syntax,to,true",types:/^(bool|(double|s?fixed|[su]?int)(32|64)|float|string)\b/,cStyleComments:!0}),["proto"]); 2 | -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/google-code-prettify/lang-scala.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/Scripts/google-code-prettify/lang-scala.js -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/google-code-prettify/lang-sql.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/Scripts/google-code-prettify/lang-sql.js -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/google-code-prettify/lang-tex.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/Scripts/google-code-prettify/lang-tex.js -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/google-code-prettify/lang-vb.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/Scripts/google-code-prettify/lang-vb.js -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/google-code-prettify/lang-vhdl.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/Scripts/google-code-prettify/lang-vhdl.js -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/google-code-prettify/lang-wiki.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/Scripts/google-code-prettify/lang-wiki.js -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/google-code-prettify/lang-yaml.js: -------------------------------------------------------------------------------- 1 | var a=null; 2 | PR.registerLangHandler(PR.createSimpleLexer([["pun",/^[:>?|]+/,a,":|>?"],["dec",/^%(?:YAML|TAG)[^\n\r#]+/,a,"%"],["typ",/^&\S+/,a,"&"],["typ",/^!\S*/,a,"!"],["str",/^"(?:[^"\\]|\\.)*(?:"|$)/,a,'"'],["str",/^'(?:[^']|'')*(?:'|$)/,a,"'"],["com",/^#[^\n\r]*/,a,"#"],["pln",/^\s+/,a," \t\r\n"]],[["dec",/^(?:---|\.\.\.)(?:[\n\r]|$)/],["pun",/^-/],["kwd",/^\w+:[\n\r ]/],["pln",/^\w+/]]),["yaml","yml"]); 3 | -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/mergely-3.3.3/LICENSE.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Mergely License 5 | 6 | 7 | 8 | 9 | 10 | 11 |

Software License Agreement

12 |

13 | Mergely - Copyright © 2012, Jamie Peabody. All rights reserved. 14 |

15 |

16 | Please see the Mergely license agreement. 17 |

18 | 19 | 20 | -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/mergely-3.3.3/editor/images/arrow-down-v.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/Scripts/mergely-3.3.3/editor/images/arrow-down-v.png -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/mergely-3.3.3/editor/images/arrow-left-v.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/Scripts/mergely-3.3.3/editor/images/arrow-left-v.png -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/mergely-3.3.3/editor/images/arrow-right-v.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/Scripts/mergely-3.3.3/editor/images/arrow-right-v.png -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/mergely-3.3.3/editor/images/arrow-right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/Scripts/mergely-3.3.3/editor/images/arrow-right.png -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/mergely-3.3.3/editor/images/arrow-up-v.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/Scripts/mergely-3.3.3/editor/images/arrow-up-v.png -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/mergely-3.3.3/editor/images/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/Scripts/mergely-3.3.3/editor/images/banner.png -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/mergely-3.3.3/editor/images/check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/Scripts/mergely-3.3.3/editor/images/check.png -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/mergely-3.3.3/editor/images/download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/Scripts/mergely-3.3.3/editor/images/download.png -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/mergely-3.3.3/editor/images/redo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/Scripts/mergely-3.3.3/editor/images/redo.png -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/mergely-3.3.3/editor/images/share.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/Scripts/mergely-3.3.3/editor/images/share.png -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/mergely-3.3.3/editor/images/swap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/Scripts/mergely-3.3.3/editor/images/swap.png -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/mergely-3.3.3/editor/images/undo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/Scripts/mergely-3.3.3/editor/images/undo.png -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/mergely-3.3.3/editor/images/upload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/Scripts/mergely-3.3.3/editor/images/upload.png -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/mergely-3.3.3/editor/images/x-mark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/Scripts/mergely-3.3.3/editor/images/x-mark.png -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/mergely-3.3.3/editor/lib/farbtastic/farbtastic.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Farbtastic Color Picker 1.2 3 | * © 2008 Steven Wittens 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | .farbtastic { 20 | position: relative; 21 | } 22 | .farbtastic * { 23 | position: absolute; 24 | cursor: crosshair; 25 | } 26 | .farbtastic, .farbtastic .wheel { 27 | width: 195px; 28 | height: 195px; 29 | } 30 | .farbtastic .color, .farbtastic .overlay { 31 | top: 47px; 32 | left: 47px; 33 | width: 101px; 34 | height: 101px; 35 | } 36 | .farbtastic .wheel { 37 | background: url(wheel.png) no-repeat; 38 | width: 195px; 39 | height: 195px; 40 | } 41 | .farbtastic .overlay { 42 | background: url(mask.png) no-repeat; 43 | } 44 | .farbtastic .marker { 45 | width: 17px; 46 | height: 17px; 47 | margin: -8px 0 0 -8px; 48 | overflow: hidden; 49 | background: url(marker.png) no-repeat; 50 | } 51 | 52 | -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/mergely-3.3.3/editor/lib/farbtastic/marker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/Scripts/mergely-3.3.3/editor/lib/farbtastic/marker.png -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/mergely-3.3.3/editor/lib/farbtastic/mask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/Scripts/mergely-3.3.3/editor/lib/farbtastic/mask.png -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/mergely-3.3.3/editor/lib/farbtastic/wheel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/Scripts/mergely-3.3.3/editor/lib/farbtastic/wheel.png -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/mergely-3.3.3/editor/lib/tipsy/tipsy.css: -------------------------------------------------------------------------------- 1 | .tipsy { font-size: 10px; position: absolute; padding: 5px; z-index: 100000; } 2 | .tipsy-inner { background-color: #000; color: #FFF; max-width: 200px; padding: 5px 8px 4px 8px; text-align: center; } 3 | 4 | /* Rounded corners */ 5 | .tipsy-inner { border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; } 6 | 7 | /* Uncomment for shadow */ 8 | /*.tipsy-inner { box-shadow: 0 0 5px #000000; -webkit-box-shadow: 0 0 5px #000000; -moz-box-shadow: 0 0 5px #000000; }*/ 9 | 10 | .tipsy-arrow { position: absolute; width: 0; height: 0; line-height: 0; border: 5px dashed #000; } 11 | 12 | /* Rules to colour arrows */ 13 | .tipsy-arrow-n { border-bottom-color: #000; } 14 | .tipsy-arrow-s { border-top-color: #000; } 15 | .tipsy-arrow-e { border-left-color: #000; } 16 | .tipsy-arrow-w { border-right-color: #000; } 17 | 18 | .tipsy-n .tipsy-arrow { top: 0px; left: 50%; margin-left: -5px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent; } 19 | .tipsy-nw .tipsy-arrow { top: 0; left: 10px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent;} 20 | .tipsy-ne .tipsy-arrow { top: 0; right: 10px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent;} 21 | .tipsy-s .tipsy-arrow { bottom: 0; left: 50%; margin-left: -5px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; } 22 | .tipsy-sw .tipsy-arrow { bottom: 0; left: 10px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; } 23 | .tipsy-se .tipsy-arrow { bottom: 0; right: 10px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; } 24 | .tipsy-e .tipsy-arrow { right: 0; top: 50%; margin-top: -5px; border-left-style: solid; border-right: none; border-top-color: transparent; border-bottom-color: transparent; } 25 | .tipsy-w .tipsy-arrow { left: 0; top: 50%; margin-top: -5px; border-right-style: solid; border-left: none; border-top-color: transparent; border-bottom-color: transparent; } 26 | -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/mergely-3.3.3/examples/ajax.html: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | Mergely - Simple Example 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 47 | 48 | 49 | 50 |
51 |
52 |
53 |
54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/mergely-3.3.3/examples/lhs.txt: -------------------------------------------------------------------------------- 1 | the quick red fox jumped 2 | over the hairy dog 3 | -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/mergely-3.3.3/examples/rhs.txt: -------------------------------------------------------------------------------- 1 | the quick brown fox jumped 2 | over the lazy dog 3 | -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/mergely-3.3.3/examples/simple.html: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | Mergely - Simple Example 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 39 | 40 | 41 | 42 |
43 |
44 |
45 |
46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /Sqloogle.Web/Scripts/mergely-3.3.3/lib/mergely.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2013 by Jamie Peabody, http://www.mergely.com 3 | * All rights reserved. 4 | * Version: 3.3.3 2013-06-24 5 | */ 6 | 7 | /* required */ 8 | .mergely-column textarea { width: 80px; height: 200px; } 9 | .mergely-column { float: left; } 10 | .mergely-margin { float: left; } 11 | .mergely-canvas { float: left; width: 28px; } 12 | 13 | /* resizeable */ 14 | .mergely-resizer { width: 100%; height: 100%; } 15 | 16 | /* style configuration */ 17 | .mergely-column { border: 1px solid #ccc; } 18 | .mergely-active { border: 1px solid #a3d1ff; } 19 | 20 | .mergely.a.rhs.start { border-top: 1px solid #a3d1ff; } 21 | .mergely.a.lhs.start.end, 22 | .mergely.a.rhs.end { border-bottom: 1px solid #a3d1ff; } 23 | .mergely.a.rhs { background-color: #ddeeff; } 24 | .mergely.a.lhs.start.end.first { border-bottom: 0; border-top: 1px solid #a3d1ff; } 25 | 26 | .mergely.d.lhs { background-color: #edc0c0; } 27 | .mergely.d.lhs.end, 28 | .mergely.d.rhs.start.end { border-bottom: 1px solid #ff7f7f; } 29 | .mergely.d.rhs.start.end.first { border-bottom: 0; border-top: 1px solid #ff7f7f; } 30 | .mergely.d.lhs.start { border-top: 1px solid #ff7f7f; } 31 | 32 | .mergely.c.lhs, 33 | .mergely.c.rhs { background-color: #fafafa; } 34 | .mergely.c.lhs.start, 35 | .mergely.c.rhs.start { border-top: 1px solid #a3a3a3; } 36 | .mergely.c.lhs.end, 37 | .mergely.c.rhs.end { border-bottom: 1px solid #a3a3a3; } 38 | 39 | .mergely.ch.a.rhs { background-color: #ddeeff; } 40 | .mergely.ch.d.lhs { background-color: #edc0c0; text-decoration: line-through; color: #888; } 41 | -------------------------------------------------------------------------------- /Sqloogle.Web/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Error 6 | 7 | 8 |
9 |

Error.

10 |

An error occurred while processing your request.

11 |
12 | 13 | 14 | -------------------------------------------------------------------------------- /Sqloogle.Web/Views/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 |
7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /Sqloogle.Web/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_Layout.cshtml"; 3 | } 4 | -------------------------------------------------------------------------------- /Sqloogle.Web/Web.Debug.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /Sqloogle.Web/Web.Release.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /Sqloogle.Web/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle.Web/favicon.ico -------------------------------------------------------------------------------- /Sqloogle.Web/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Sqloogle/IIndexWriter.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | namespace Sqloogle 18 | { 19 | public interface IIndexWriter { 20 | void Clean(); 21 | void Add(object doc); 22 | void Delete(string id); 23 | void Update(string id, object doc); 24 | 25 | void Commit(); 26 | 27 | void Optimize(); 28 | } 29 | } -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/Attributes/ShowCollection.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System; 18 | 19 | namespace Sqloogle.Libs.DBDiff.Schema.Attributes 20 | { 21 | [AttributeUsage(AttributeTargets.Property,AllowMultiple = true)] 22 | public sealed class ShowItemAttribute:Attribute 23 | { 24 | private string name; 25 | private string image; 26 | private Boolean isFullName; 27 | 28 | public ShowItemAttribute(string name) 29 | { 30 | this.name = name; 31 | this.image = "Folder"; 32 | } 33 | 34 | public ShowItemAttribute(string name, string image) 35 | { 36 | this.name = name; 37 | this.image = image; 38 | } 39 | 40 | public ShowItemAttribute(string name, string image, Boolean isFullName) 41 | { 42 | this.name = name; 43 | this.image = image; 44 | this.isFullName = isFullName; 45 | } 46 | 47 | public string Name 48 | { 49 | get { return name; } 50 | } 51 | 52 | public string Image 53 | { 54 | get { return image; } 55 | } 56 | 57 | public Boolean IsFullName 58 | { 59 | get { return isFullName; } 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/Errors/MessageLog.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | namespace Sqloogle.Libs.DBDiff.Schema.Errors 18 | { 19 | public class MessageLog 20 | { 21 | public enum LogType 22 | { 23 | Information = 0, 24 | Warning = 1, 25 | Error = 2 26 | } 27 | private string description; 28 | private string fullDescription; 29 | private LogType type; 30 | 31 | public MessageLog(string description, string fullDescription, LogType type) 32 | { 33 | this.description = description; 34 | this.fullDescription = fullDescription; 35 | this.type = type; 36 | } 37 | 38 | public LogType Type 39 | { 40 | get { return type; } 41 | } 42 | 43 | public string FullDescription 44 | { 45 | get { return fullDescription; } 46 | } 47 | 48 | public string Description 49 | { 50 | get { return description; } 51 | } 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/Events/ProgressEventArgs.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System; 18 | 19 | namespace Sqloogle.Libs.DBDiff.Schema.Events 20 | { 21 | public class ProgressEventArgs:EventArgs 22 | { 23 | private int progress; 24 | private string message; 25 | 26 | public string Message 27 | { 28 | get { return message; } 29 | set { message = value; } 30 | } 31 | 32 | public ProgressEventArgs(string message, int progress) 33 | { 34 | this.progress = progress; 35 | this.message = message; 36 | } 37 | 38 | public int Progress 39 | { 40 | get { return progress; } 41 | set { progress = value; } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/Events/ProgressEventHandler.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | namespace Sqloogle.Libs.DBDiff.Schema.Events 18 | { 19 | public class ProgressEventHandler 20 | { 21 | public delegate void ProgressHandler(ProgressEventArgs e); 22 | 23 | public static event ProgressHandler OnProgress; 24 | 25 | public static void RaiseOnChange(ProgressEventArgs e) 26 | { 27 | if (OnProgress != null) OnProgress(e); 28 | } 29 | 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/Misc/SchemaException.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System; 18 | using System.Text; 19 | using System.IO; 20 | using System.Runtime.Serialization; 21 | using System.Globalization; 22 | 23 | namespace Sqloogle.Libs.DBDiff.Schema.Misc 24 | { 25 | [Serializable] 26 | public class SchemaException : Exception 27 | { 28 | private static void Write(string message) 29 | { 30 | try 31 | { 32 | StreamWriter writer = new StreamWriter("OpenDBDiff.log", true, Encoding.ASCII); 33 | writer.WriteLine("ERROR: " + DateTime.Now.ToString("yyyy/MM/dd hh:mm", CultureInfo.InvariantCulture) + "-" + message); 34 | writer.Close(); 35 | } 36 | finally { } 37 | } 38 | 39 | public SchemaException():base() 40 | { 41 | } 42 | 43 | public SchemaException(string message) 44 | : base(message) 45 | { 46 | Write(base.StackTrace); 47 | } 48 | 49 | public SchemaException(string message, Exception exception) 50 | : base(message, exception) 51 | { 52 | Write(exception.StackTrace); 53 | } 54 | 55 | protected SchemaException(SerializationInfo info, StreamingContext context):base(info, context) 56 | { 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/Model/IDatabase.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | namespace Sqloogle.Libs.DBDiff.Schema.Model 18 | { 19 | public interface IDatabase:ISchemaBase 20 | { 21 | bool IsCaseSensity { get; } 22 | SqlAction ActionMessage { get; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/Model/ISchemaBase.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System; 18 | 19 | namespace Sqloogle.Libs.DBDiff.Schema.Model 20 | { 21 | public interface ISchemaBase 22 | { 23 | ISchemaBase Clone(ISchemaBase parent); 24 | int DependenciesCount { get; } 25 | string FullName { get; } 26 | int Id { get; set; } 27 | Boolean HasState(Enums.ObjectStatusType statusFind); 28 | string Name { get; set; } 29 | string Owner { get; set; } 30 | ISchemaBase Parent { get; set;} 31 | Enums.ObjectStatusType Status { get; set;} 32 | Boolean IsSystem { get; set; } 33 | Enums.ObjectType ObjectType { get; set;} 34 | Boolean GetWasInsertInDiffList(Enums.ScripActionType action); 35 | void SetWasInsertInDiffList(Enums.ScripActionType action); 36 | void ResetWasInsertInDiffList(); 37 | string ToSqlDrop(); 38 | string ToSqlAdd(); 39 | string ToSql(); 40 | SQLScriptList ToSqlDiff(); 41 | SQLScript Create(); 42 | SQLScript Drop(); 43 | int CompareFullNameTo(string name, string myName); 44 | Boolean IsCodeType { get; } 45 | IDatabase RootParent { get; } 46 | DateTime ModifyDate { get; set; } 47 | DateTime CreateDate { get; set; } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/Model/ISchemaList.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | namespace Sqloogle.Libs.DBDiff.Schema.Model 18 | { 19 | public interface ISchemaList 20 | where T : ISchemaBase 21 | where P : ISchemaBase 22 | { 23 | void Add(T item); 24 | SchemaList Clone(P parentObject); 25 | bool Exists(string name); 26 | T Find(int id); 27 | T this[string name] { get; set; } 28 | T this[int index] { get; set; } 29 | P Parent { get; } 30 | int Count { get; } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/SqlServer2005/Compare/CompareCLRFunction.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using Sqloogle.Libs.DBDiff.Schema.Model; 18 | using Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Model; 19 | 20 | namespace Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Compare 21 | { 22 | internal class CompareCLRFunction : CompareBase 23 | { 24 | protected override void DoUpdate(SchemaList CamposOrigen, CLRFunction node) 25 | { 26 | if (!node.Compare(CamposOrigen[node.FullName])) 27 | { 28 | CLRFunction newNode = node;//.Clone(CamposOrigen.Parent); 29 | newNode.Status = Enums.ObjectStatusType.AlterStatus; 30 | CamposOrigen[node.FullName] = newNode; 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/SqlServer2005/Compare/CompareCLRStoreProcedure.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using Sqloogle.Libs.DBDiff.Schema.Model; 18 | using Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Model; 19 | 20 | namespace Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Compare 21 | { 22 | internal class CompareCLRStoreProcedure : CompareBase 23 | { 24 | protected override void DoUpdate(SchemaList CamposOrigen, CLRStoreProcedure node) 25 | { 26 | if (!node.Compare(CamposOrigen[node.FullName])) 27 | { 28 | CLRStoreProcedure newNode = node;//.Clone(CamposOrigen.Parent); 29 | newNode.Status = Enums.ObjectStatusType.AlterStatus; 30 | CamposOrigen[node.FullName] = newNode; 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/SqlServer2005/Compare/CompareCLRTriggers.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using Sqloogle.Libs.DBDiff.Schema.Model; 18 | using Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Model; 19 | 20 | namespace Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Compare 21 | { 22 | internal class CompareCLRTriggers : CompareBase 23 | { 24 | protected override void DoUpdate(SchemaList CamposOrigen, CLRTrigger node) 25 | { 26 | if (!node.Compare(CamposOrigen[node.FullName])) 27 | { 28 | CLRTrigger newNode = node; 29 | newNode.Status = Enums.ObjectStatusType.AlterStatus; 30 | CompareExtendedProperties(newNode, CamposOrigen[node.FullName]); 31 | CamposOrigen[node.FullName] = newNode; 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/SqlServer2005/Compare/CompareConstraints.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using Sqloogle.Libs.DBDiff.Schema.Model; 18 | using Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Model; 19 | 20 | namespace Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Compare 21 | { 22 | internal class CompareConstraints:CompareBase 23 | { 24 | protected override void DoUpdate(SchemaList CamposOrigen, Constraint node) 25 | { 26 | Constraint origen = CamposOrigen[node.FullName]; 27 | if (!Constraint.Compare(origen, node)) 28 | { 29 | Constraint newNode = (Constraint)node.Clone(CamposOrigen.Parent); 30 | if (node.IsDisabled == origen.IsDisabled) 31 | { 32 | newNode.Status = Enums.ObjectStatusType.AlterStatus; 33 | } 34 | else 35 | newNode.Status = Enums.ObjectStatusType.AlterStatus + (int)Enums.ObjectStatusType.DisabledStatus; 36 | CamposOrigen[node.FullName] = newNode; 37 | } 38 | else 39 | { 40 | if (node.IsDisabled != origen.IsDisabled) 41 | { 42 | Constraint newNode = (Constraint)node.Clone(CamposOrigen.Parent); 43 | newNode.Status = Enums.ObjectStatusType.DisabledStatus; 44 | CamposOrigen[node.FullName] = newNode; 45 | } 46 | } 47 | } 48 | 49 | protected override void DoNew(SchemaList CamposOrigen, Constraint node) 50 | { 51 | Constraint newNode = (Constraint)node.Clone(CamposOrigen.Parent); 52 | newNode.Status = Enums.ObjectStatusType.CreateStatus; 53 | CamposOrigen.Add(newNode); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/SqlServer2005/Compare/CompareDDLTriggers.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using Sqloogle.Libs.DBDiff.Schema.Model; 18 | using Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Model; 19 | 20 | namespace Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Compare 21 | { 22 | internal class CompareDDLTriggers : CompareBase 23 | { 24 | protected override void DoUpdate(SchemaList CamposOrigen, Trigger node) 25 | { 26 | if (!node.Compare(CamposOrigen[node.FullName])) 27 | { 28 | Trigger newNode = (Trigger)node.Clone(CamposOrigen.Parent); 29 | if (!newNode.Text.Equals(CamposOrigen[node.FullName].Text)) 30 | newNode.Status = Enums.ObjectStatusType.AlterStatus; 31 | if (node.IsDisabled != CamposOrigen[node.FullName].IsDisabled) 32 | newNode.Status = newNode.Status + (int)Enums.ObjectStatusType.DisabledStatus; 33 | CamposOrigen[node.FullName] = newNode; 34 | } 35 | } 36 | 37 | protected override void DoNew(SchemaList CamposOrigen, Trigger node) 38 | { 39 | Trigger newNode = (Trigger)node.Clone(CamposOrigen.Parent); 40 | newNode.Status = Enums.ObjectStatusType.CreateStatus; 41 | CamposOrigen.Add(newNode); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/SqlServer2005/Compare/CompareFullText.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using Sqloogle.Libs.DBDiff.Schema.Model; 18 | using Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Model; 19 | 20 | namespace Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Compare 21 | { 22 | internal class CompareFullText : CompareBase 23 | { 24 | protected override void DoUpdate(SchemaList CamposOrigen, FullText node) 25 | { 26 | if (!node.Compare(CamposOrigen[node.FullName])) 27 | { 28 | FullText newNode = node;//.Clone(CamposOrigen.Parent); 29 | if (node.IsDefault != CamposOrigen[node.FullName].IsDefault) 30 | newNode.Status += (int)Enums.ObjectStatusType.DisabledStatus; 31 | if (!node.Owner.Equals(CamposOrigen[node.FullName].Owner)) 32 | newNode.Status += (int)Enums.ObjectStatusType.ChangeOwner; 33 | if (node.IsAccentSensity != CamposOrigen[node.FullName].IsAccentSensity) 34 | newNode.Status += (int)Enums.ObjectStatusType.AlterStatus; 35 | CamposOrigen[node.FullName] = newNode; 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/SqlServer2005/Compare/CompareFullTextIndex.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using Sqloogle.Libs.DBDiff.Schema.Model; 18 | using Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Model; 19 | 20 | namespace Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Compare 21 | { 22 | internal class CompareFullTextIndex : CompareBase 23 | { 24 | protected override void DoNew(SchemaList CamposOrigen, FullTextIndex node) 25 | { 26 | FullTextIndex newNode = (FullTextIndex)node.Clone(CamposOrigen.Parent); 27 | newNode.Status = Enums.ObjectStatusType.CreateStatus; 28 | CamposOrigen.Add(newNode); 29 | } 30 | 31 | protected override void DoUpdate(SchemaList CamposOrigen, FullTextIndex node) 32 | { 33 | if (!node.Compare(CamposOrigen[node.FullName])) 34 | { 35 | FullTextIndex newNode = (FullTextIndex)node.Clone(CamposOrigen.Parent); 36 | if (node.IsDisabled != CamposOrigen[node.FullName].IsDisabled) 37 | newNode.Status += (int)Enums.ObjectStatusType.DisabledStatus; 38 | else 39 | newNode.Status += (int)Enums.ObjectStatusType.AlterStatus; 40 | CamposOrigen[node.FullName] = newNode; 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/SqlServer2005/Compare/CompareIndexes.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using Sqloogle.Libs.DBDiff.Schema.Model; 18 | using Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Model; 19 | 20 | namespace Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Compare 21 | { 22 | internal class CompareIndexes:CompareBase 23 | { 24 | protected override void DoNew(SchemaList CamposOrigen, Index node) 25 | { 26 | Index newNode = (Index)node.Clone(CamposOrigen.Parent); 27 | newNode.Status = Enums.ObjectStatusType.CreateStatus; 28 | CamposOrigen.Add(newNode); 29 | } 30 | 31 | protected override void DoUpdate(SchemaList CamposOrigen, Index node) 32 | { 33 | if (!Index.Compare(node, CamposOrigen[node.FullName])) 34 | { 35 | Index newNode = (Index)node.Clone(CamposOrigen.Parent); 36 | if (!Index.CompareExceptIsDisabled(node, CamposOrigen[node.FullName])) 37 | { 38 | newNode.Status = Enums.ObjectStatusType.AlterStatus; 39 | } 40 | else 41 | newNode.Status = Enums.ObjectStatusType.DisabledStatus; 42 | CamposOrigen[node.FullName] = newNode; 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/SqlServer2005/Compare/ComparePartitionFunction.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using Sqloogle.Libs.DBDiff.Schema.Model; 18 | using Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Model; 19 | 20 | namespace Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Compare 21 | { 22 | internal class ComparePartitionFunction:CompareBase 23 | { 24 | protected override void DoUpdate(SchemaList CamposOrigen, PartitionFunction node) 25 | { 26 | if (!PartitionFunction.Compare(node, CamposOrigen[node.FullName])) 27 | { 28 | PartitionFunction newNode = node;//.Clone(CamposOrigen.Parent); 29 | newNode.Status = Enums.ObjectStatusType.RebuildStatus; 30 | CamposOrigen[node.FullName] = newNode; 31 | } 32 | else 33 | { 34 | if (!PartitionFunction.CompareValues(node, CamposOrigen[node.FullName])) 35 | { 36 | PartitionFunction newNode = node.Clone(CamposOrigen.Parent); 37 | if (newNode.Values.Count == CamposOrigen[node.FullName].Values.Count) 38 | newNode.Status = Enums.ObjectStatusType.RebuildStatus; 39 | else 40 | newNode.Status = Enums.ObjectStatusType.AlterStatus; 41 | newNode.Old = CamposOrigen[node.FullName].Clone(CamposOrigen.Parent); 42 | CamposOrigen[node.FullName] = newNode; 43 | } 44 | } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/SqlServer2005/Compare/ComparePartitionSchemes.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using Sqloogle.Libs.DBDiff.Schema.Model; 18 | using Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Model; 19 | 20 | namespace Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Compare 21 | { 22 | internal class ComparePartitionSchemes : CompareBase 23 | { 24 | protected override void DoUpdate(SchemaList CamposOrigen, PartitionScheme node) 25 | { 26 | if (!PartitionScheme.Compare(node, CamposOrigen[node.FullName])) 27 | { 28 | PartitionScheme newNode = node;//.Clone(CamposOrigen.Parent); 29 | newNode.Status = Enums.ObjectStatusType.RebuildStatus; 30 | CamposOrigen[node.FullName] = newNode; 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/SqlServer2005/Compare/CompareRoles.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using Sqloogle.Libs.DBDiff.Schema.Model; 18 | using Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Model; 19 | 20 | namespace Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Compare 21 | { 22 | internal class CompareRoles : CompareBase 23 | { 24 | protected override void DoUpdate(SchemaList CamposOrigen, Role node) 25 | { 26 | if (!node.Compare(CamposOrigen[node.FullName])) 27 | { 28 | Role newNode = node; 29 | newNode.Status = Enums.ObjectStatusType.AlterStatus; 30 | CamposOrigen[node.FullName] = newNode; 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/SqlServer2005/Compare/CompareRules.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using Sqloogle.Libs.DBDiff.Schema.Model; 18 | using Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Model; 19 | 20 | namespace Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Compare 21 | { 22 | internal class CompareRules:CompareBase 23 | { 24 | protected override void DoUpdate(SchemaList CamposOrigen, Rule node) 25 | { 26 | if (!node.Compare(CamposOrigen[node.FullName])) 27 | { 28 | Rule newNode = node.Clone(CamposOrigen.Parent); 29 | newNode.Status = Enums.ObjectStatusType.AlterStatus; 30 | CamposOrigen[node.FullName] = newNode; 31 | } 32 | } 33 | 34 | protected override void DoNew(SchemaList CamposOrigen, Rule node) 35 | { 36 | Rule newNode = node.Clone(CamposOrigen.Parent); 37 | newNode.Status = Enums.ObjectStatusType.CreateStatus; 38 | CamposOrigen.Add(newNode); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/SqlServer2005/Compare/CompareSchemas.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | namespace Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Compare 18 | { 19 | internal class CompareSchemas:CompareBase 20 | { 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/SqlServer2005/Compare/CompareStoreProcedures.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using Sqloogle.Libs.DBDiff.Schema.Model; 18 | using Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Model; 19 | 20 | namespace Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Compare 21 | { 22 | internal class CompareStoreProcedures:CompareBase 23 | { 24 | protected override void DoUpdate(SchemaList CamposOrigen, StoreProcedure node) 25 | { 26 | if (!node.Compare(CamposOrigen[node.FullName])) 27 | { 28 | StoreProcedure newNode = node;//.Clone(CamposOrigen.Parent); 29 | newNode.Status = Enums.ObjectStatusType.AlterStatus; 30 | CamposOrigen[node.FullName] = newNode; 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/SqlServer2005/Compare/CompareSynonyms.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using Sqloogle.Libs.DBDiff.Schema.Model; 18 | using Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Model; 19 | 20 | namespace Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Compare 21 | { 22 | internal class CompareSynonyms:CompareBase 23 | { 24 | protected override void DoUpdate(SchemaList CamposOrigen, Synonym node) 25 | { 26 | if (!Synonym.Compare(node, CamposOrigen[node.FullName])) 27 | { 28 | Synonym newNode = node;//.Clone(CamposOrigen.Parent); 29 | newNode.Status = Enums.ObjectStatusType.AlterStatus; 30 | CamposOrigen[node.FullName] = newNode; 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/SqlServer2005/Compare/CompareTablesOptions.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using Sqloogle.Libs.DBDiff.Schema.Model; 18 | using Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Model; 19 | 20 | namespace Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Compare 21 | { 22 | internal class CompareTablesOptions:CompareBase 23 | { 24 | protected override void DoNew(SchemaList CamposOrigen, TableOption node) 25 | { 26 | TableOption newNode = (TableOption)node.Clone(CamposOrigen.Parent); 27 | newNode.Status = Enums.ObjectStatusType.CreateStatus; 28 | CamposOrigen.Add(newNode); 29 | } 30 | 31 | protected override void DoUpdate(SchemaList CamposOrigen, TableOption node) 32 | { 33 | if (!TableOption.Compare(node, CamposOrigen[node.FullName])) 34 | { 35 | TableOption newNode = (TableOption)node.Clone(CamposOrigen.Parent); 36 | newNode.Status = Enums.ObjectStatusType.AlterStatus; 37 | CamposOrigen[node.FullName] = newNode; 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/SqlServer2005/Compare/CompareTriggers.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using Sqloogle.Libs.DBDiff.Schema.Model; 18 | using Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Model; 19 | 20 | namespace Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Compare 21 | { 22 | internal class CompareTriggers:CompareBase 23 | { 24 | protected override void DoNew(SchemaList CamposOrigen, Trigger node) 25 | { 26 | Trigger newNode = (Trigger)node.Clone(CamposOrigen.Parent); 27 | newNode.Status = Enums.ObjectStatusType.CreateStatus; 28 | CamposOrigen.Add(newNode); 29 | } 30 | 31 | protected override void DoUpdate(SchemaList CamposOrigen, Trigger node) 32 | { 33 | if (!node.Compare(CamposOrigen[node.FullName])) 34 | { 35 | Trigger newNode = (Trigger)node.Clone(CamposOrigen.Parent); 36 | if (!newNode.Text.Equals(CamposOrigen[node.FullName].Text)) 37 | newNode.Status = Enums.ObjectStatusType.AlterStatus; 38 | if (node.IsDisabled != CamposOrigen[node.FullName].IsDisabled) 39 | newNode.Status = newNode.Status + (int)Enums.ObjectStatusType.DisabledStatus; 40 | CamposOrigen[node.FullName] = newNode; 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/SqlServer2005/Compare/CompareUsers.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Model; 18 | 19 | namespace Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Compare 20 | { 21 | internal class CompareUsers : CompareBase 22 | { 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/SqlServer2005/Compare/CompareXMLSchemas.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using Sqloogle.Libs.DBDiff.Schema.Model; 18 | using Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Model; 19 | 20 | namespace Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Compare 21 | { 22 | internal class CompareXMLSchemas:CompareBase 23 | { 24 | protected override void DoUpdate(SchemaList CamposOrigen, XMLSchema node) 25 | { 26 | if (!node.Compare(CamposOrigen[node.FullName])) 27 | { 28 | XMLSchema newNode = node.Clone(CamposOrigen.Parent); 29 | newNode.Status = Enums.ObjectStatusType.AlterStatus; 30 | CamposOrigen[node.FullName] = newNode; 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/SqlServer2005/Generates/Util/Constants.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | namespace Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Generates.Util 18 | { 19 | internal class Constants 20 | { 21 | public const int READING_RULES = 0; 22 | public const int READING_TABLES = 1; 23 | public const int READING_CONSTRAINTS = 2; 24 | public const int READING_UDT = 3; 25 | public const int READING_XMLSCHEMAS = 4; 26 | public const int READING_SCHEMAS = 5; 27 | public const int READING_USER = 6; 28 | public const int READING_PARTITIONFUNCTION = 7; 29 | public const int READING_PARTITIONSCHEME = 8; 30 | public const int READING_FILEGROUPS = 9; 31 | public const int READING_DLLTRIGGERS = 10; 32 | public const int READING_SYNONYMS = 11; 33 | public const int READING_ASSEMBLIES = 12; 34 | public const int READING_PROCEDURES = 13; 35 | public const int READING_VIEWS = 14; 36 | public const int READING_FUNCTIONS = 15; 37 | public const int READING_INDEXES = 16; 38 | public const int READING_TRIGGERS = 17; 39 | public const int READING_TEXTOBJECTS = 18; 40 | public const int READING_EXTENDED_PROPERTIES = 19; 41 | public const int READING_MAX = 20; 42 | 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/SqlServer2005/Generates/Util/ConvertType.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | namespace Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Generates.Util 18 | { 19 | internal static class ConvertType 20 | { 21 | public static Enums.ObjectType GetObjectType(string type) 22 | { 23 | if (type.Trim().Equals("V")) return Enums.ObjectType.View; 24 | if (type.Trim().Equals("U")) return Enums.ObjectType.Table; 25 | if (type.Trim().Equals("FN")) return Enums.ObjectType.Function; 26 | if (type.Trim().Equals("TF")) return Enums.ObjectType.Function; 27 | if (type.Trim().Equals("IF")) return Enums.ObjectType.Function; 28 | if (type.Trim().Equals("P")) return Enums.ObjectType.StoreProcedure; 29 | if (type.Trim().Equals("TR")) return Enums.ObjectType.Trigger; 30 | return Enums.ObjectType.None; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/SqlServer2005/Model/CLRCode.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System; 18 | using Sqloogle.Libs.DBDiff.Schema.Model; 19 | 20 | namespace Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Model 21 | { 22 | public abstract class CLRCode:Code 23 | { 24 | private Boolean isAssembly; 25 | private int assemblyId; 26 | private string assemblyClass; 27 | private string assemblyName; 28 | private string assemblyExecuteAs; 29 | private string assemblyMethod; 30 | 31 | public CLRCode(ISchemaBase parent, Enums.ObjectType type, Enums.ScripActionType addAction, Enums.ScripActionType dropAction) 32 | : base(parent, type, addAction, dropAction) 33 | { 34 | } 35 | 36 | public string AssemblyMethod 37 | { 38 | get { return assemblyMethod; } 39 | set { assemblyMethod = value; } 40 | } 41 | 42 | public string AssemblyExecuteAs 43 | { 44 | get { return assemblyExecuteAs; } 45 | set { assemblyExecuteAs = value; } 46 | } 47 | 48 | public string AssemblyName 49 | { 50 | get { return assemblyName; } 51 | set { assemblyName = value; } 52 | } 53 | 54 | public Boolean IsAssembly 55 | { 56 | get { return isAssembly; } 57 | set { isAssembly = value; } 58 | } 59 | 60 | public string AssemblyClass 61 | { 62 | get { return assemblyClass; } 63 | set { assemblyClass = value; } 64 | } 65 | 66 | public int AssemblyId 67 | { 68 | get { return assemblyId; } 69 | set { assemblyId = value; } 70 | } 71 | 72 | public override Boolean IsCodeType 73 | { 74 | get { return true; } 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/SqlServer2005/Model/Column.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dalenewman/SQLoogle/47447882a64c418142f504361bf1b78585582018/Sqloogle/Libs/DBDiff.Schema/SqlServer2005/Model/Column.cs -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/SqlServer2005/Model/Dependence.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | namespace Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Model 18 | { 19 | internal class Dependence 20 | { 21 | private int objectId; 22 | private int subObjectId; 23 | private int ownerTableId; 24 | private string fullName; 25 | private int typeId; 26 | private Enums.ObjectType type; 27 | 28 | public string FullName 29 | { 30 | get { return fullName; } 31 | set { fullName = value; } 32 | } 33 | 34 | public int DataTypeId 35 | { 36 | get { return typeId; } 37 | set { typeId = value; } 38 | } 39 | 40 | public Enums.ObjectType Type 41 | { 42 | get { return type; } 43 | set { type = value; } 44 | } 45 | 46 | public int SubObjectId 47 | { 48 | get { return subObjectId; } 49 | set { subObjectId = value; } 50 | } 51 | 52 | /// 53 | /// ID de la tabla a la que hace referencia la constraint. 54 | /// 55 | public int ObjectId 56 | { 57 | get { return objectId; } 58 | set { objectId = value; } 59 | } 60 | 61 | /// 62 | /// ID de la tabla a la que pertenece la constraint. 63 | /// 64 | public int OwnerTableId 65 | { 66 | get { return ownerTableId; } 67 | set { ownerTableId = value; } 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/SqlServer2005/Model/FullTextIndexColumn.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | namespace Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Model 18 | { 19 | public class FullTextIndexColumn 20 | { 21 | private string columnName; 22 | private string language; 23 | 24 | public string Language 25 | { 26 | get { return language; } 27 | set { language = value; } 28 | } 29 | 30 | public string ColumnName 31 | { 32 | get { return columnName; } 33 | set { columnName = value; } 34 | } 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/SqlServer2005/Model/ITableType.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using Sqloogle.Libs.DBDiff.Schema.Model; 18 | 19 | namespace Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Model 20 | { 21 | public interface ITable where T : ISchemaBase 22 | { 23 | Columns Columns { get; } 24 | SchemaList Constraints { get; } 25 | SchemaList Indexes { get; } 26 | ISchemaBase Parent { get; set; } 27 | string Owner { get; set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/SqlServer2005/Model/Interfaces/ICode.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System.Collections.Generic; 18 | using Sqloogle.Libs.DBDiff.Schema.Model; 19 | 20 | namespace Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Model.Interfaces 21 | { 22 | public interface ICode:ISchemaBase 23 | { 24 | SQLScriptList Rebuild(); 25 | List DependenciesIn { get; set; } 26 | List DependenciesOut { get; set; } 27 | bool IsSchemaBinding { get; set; } 28 | string Text { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/SqlServer2005/Model/Interfaces/ISQLServerSchemaBase.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using Sqloogle.Libs.DBDiff.Schema.Model; 18 | 19 | namespace Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Model.Interfaces 20 | { 21 | public interface ISQLServerSchemaBase 22 | { 23 | SchemaList ExtendedProperties { get; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/SqlServer2005/Model/ObjectDependency.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | namespace Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Model 18 | { 19 | public class ObjectDependency 20 | { 21 | private string columnName; 22 | private string name; 23 | private Enums.ObjectType type; 24 | 25 | public ObjectDependency(string name, string Column, Enums.ObjectType type) 26 | { 27 | this.name = name; 28 | this.columnName = Column; 29 | this.type = type; 30 | } 31 | 32 | public ObjectDependency(string name, string Column) 33 | { 34 | this.name = name; 35 | this.columnName = Column; 36 | } 37 | 38 | public string Name 39 | { 40 | get { return name; } 41 | set { name = value; } 42 | } 43 | 44 | public string ColumnName 45 | { 46 | get { return columnName; } 47 | set { columnName = value; } 48 | } 49 | 50 | public Enums.ObjectType Type 51 | { 52 | get { return type; } 53 | set { type = value; } 54 | } 55 | 56 | public bool IsCodeType 57 | { 58 | get { return ((type == Enums.ObjectType.StoreProcedure) || (type == Enums.ObjectType.Trigger) || (type == Enums.ObjectType.View) || (type == Enums.ObjectType.Function)); } 59 | 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/SqlServer2005/Model/SQLServerSchemaBase.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using Sqloogle.Libs.DBDiff.Schema.Model; 18 | using Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Model.Interfaces; 19 | 20 | namespace Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Model 21 | { 22 | public abstract class SQLServerSchemaBase:SchemaBase, ISQLServerSchemaBase 23 | { 24 | private SchemaList extendedProperties; 25 | 26 | protected SQLServerSchemaBase(ISchemaBase parent, Enums.ObjectType objectType):base("[", "]", objectType) 27 | { 28 | this.Parent = parent; 29 | extendedProperties = new SchemaList(parent); 30 | } 31 | 32 | public SchemaList ExtendedProperties 33 | { 34 | get { return extendedProperties; } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/SqlServer2005/Model/Schema.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System.Text; 18 | 19 | namespace Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Model 20 | { 21 | public class Schema : SQLServerSchemaBase 22 | { 23 | public Schema(Database parent) 24 | : base(parent, Enums.ObjectType.Schema) 25 | { 26 | } 27 | 28 | public override string ToSql() 29 | { 30 | StringBuilder sql = new StringBuilder(); 31 | sql.Append("CREATE SCHEMA "); 32 | sql.Append("[" + this.Name + "] AUTHORIZATION [" + Owner + "]"); 33 | sql.Append("\r\nGO\r\n"); 34 | return sql.ToString(); 35 | } 36 | 37 | public override string ToSqlAdd() 38 | { 39 | return ToSql(); 40 | } 41 | 42 | public override string ToSqlDrop() 43 | { 44 | return "DROP SCHEMA [" + Name + "]\r\nGO\r\n"; 45 | } 46 | 47 | /// 48 | /// Devuelve el schema de diferencias del Schema en formato SQL. 49 | /// 50 | public override SQLScriptList ToSqlDiff() 51 | { 52 | SQLScriptList listDiff = new SQLScriptList(); 53 | 54 | if (this.Status == Enums.ObjectStatusType.DropStatus) 55 | { 56 | listDiff.Add(ToSqlDrop(), 0, Enums.ScripActionType.DropSchema); 57 | } 58 | if (this.Status == Enums.ObjectStatusType.CreateStatus) 59 | { 60 | listDiff.Add(ToSql(), 0, Enums.ScripActionType.AddSchema); 61 | } 62 | return listDiff; 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/SqlServer2005/Model/TablePartition.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System; 18 | 19 | namespace Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Model 20 | { 21 | public class TablePartition:SQLServerSchemaBase 22 | { 23 | private string compressType; 24 | 25 | public TablePartition(Table parent) 26 | : base(parent, Enums.ObjectType.Partition) 27 | { 28 | } 29 | 30 | public string CompressType 31 | { 32 | get { return compressType; } 33 | set { compressType = value; } 34 | } 35 | 36 | 37 | public override string ToSql() 38 | { 39 | throw new NotImplementedException(); 40 | } 41 | 42 | public override string ToSqlDrop() 43 | { 44 | throw new NotImplementedException(); 45 | } 46 | 47 | public override string ToSqlAdd() 48 | { 49 | throw new NotImplementedException(); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/SqlServer2005/Options/SqlOptionComparison.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | namespace Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Options 18 | { 19 | public class SqlOptionComparison 20 | { 21 | public enum CaseSensityOptions 22 | { 23 | Automatic = 0, 24 | CaseInsensity = 1, 25 | CaseSensity = 2 26 | } 27 | 28 | private CaseSensityOptions caseSensityType; 29 | private CaseSensityOptions caseSensityInCode = CaseSensityOptions.CaseInsensity; 30 | private bool ignoreWhiteSpacesInCode = false; 31 | 32 | public bool IgnoreWhiteSpacesInCode 33 | { 34 | get { return ignoreWhiteSpacesInCode; } 35 | set { ignoreWhiteSpacesInCode = value; } 36 | } 37 | 38 | 39 | public CaseSensityOptions CaseSensityInCode 40 | { 41 | get { return caseSensityInCode; } 42 | set { caseSensityInCode = value; } 43 | } 44 | 45 | public CaseSensityOptions CaseSensityType 46 | { 47 | get { return caseSensityType; } 48 | set { caseSensityType = value; } 49 | } 50 | 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/SqlServer2005/Options/SqlOptionFilterItem.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | namespace Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Options 18 | { 19 | public class SqlOptionFilterItem 20 | { 21 | private Enums.ObjectType type; 22 | private string filter; 23 | 24 | public SqlOptionFilterItem(Enums.ObjectType type, string value) 25 | { 26 | this.filter = value; 27 | this.type = type; 28 | } 29 | 30 | public Enums.ObjectType Type 31 | { 32 | get { return type; } 33 | set { type = value; } 34 | } 35 | public string Filter 36 | { 37 | get { return filter; } 38 | set { this.filter = value; } 39 | } 40 | 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Sqloogle/Libs/DBDiff.Schema/SqlServer2005/Options/SqlOptionScript.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System; 18 | 19 | namespace Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Options 20 | { 21 | public class SqlOptionScript 22 | { 23 | private Boolean alterObjectOnSchemaBinding = true; 24 | 25 | public Boolean AlterObjectOnSchemaBinding 26 | { 27 | get { return alterObjectOnSchemaBinding; } 28 | set { alterObjectOnSchemaBinding = value; } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Sqloogle/LuceneFieldSettings.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using Lucene.Net.Documents; 18 | 19 | namespace Sqloogle { 20 | public class LuceneFieldSettings { 21 | public Field.Store Store { get; set; } 22 | public Field.Index Index { get; set; } 23 | public LuceneFieldSettings(Field.Store store, Field.Index index) { 24 | Store = store; 25 | Index = index; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Sqloogle/Operations/CachedObjectStatsExtract.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System.Data; 18 | using Rhino.Etl.Core; 19 | using Sqloogle.Operations.Support; 20 | 21 | namespace Sqloogle.Operations { 22 | 23 | public class CachedObjectStatsExtract : InputOperation { 24 | 25 | public CachedObjectStatsExtract(string connectionString) 26 | : base(connectionString) 27 | { 28 | UseTransaction = false; 29 | } 30 | 31 | protected override Row CreateRowFromReader(IDataReader reader) { 32 | return Row.FromReader(reader); 33 | } 34 | 35 | protected override void PrepareCommand(IDbCommand cmd) { 36 | cmd.CommandText = @"/* SQLoogle */ 37 | 38 | SELECT 39 | DB_NAME(ph.dbid) AS [database] 40 | ,ph.objectid AS objectid 41 | ,MAX(cp.usecounts) AS [use] 42 | FROM master.sys.dm_exec_cached_plans cp WITH (NOLOCK) 43 | CROSS APPLY master.sys.dm_exec_sql_text(plan_handle) ph 44 | WHERE cp.cacheobjtype != 'Extended Proc' 45 | AND ph.objectid IS NOT NULL 46 | AND DB_NAME(ph.dbid) IS NOT NULL 47 | GROUP BY 48 | DB_NAME(ph.dbid), 49 | ph.objectid 50 | ORDER BY [Database], ObjectId 51 | "; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Sqloogle/Operations/CachedObjectStatsJoin.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System; 18 | using Rhino.Etl.Core; 19 | using Rhino.Etl.Core.Operations; 20 | 21 | namespace Sqloogle.Operations { 22 | public class CachedObjectStatsJoin : JoinOperation { 23 | 24 | public CachedObjectStatsJoin() { 25 | UseTransaction = false; 26 | } 27 | 28 | protected override Row MergeRows(Row leftRow, Row rightRow) { 29 | 30 | var row = leftRow.Clone(); 31 | if (rightRow["use"] != null) { 32 | row["use"] = rightRow["use"]; 33 | row["lastused"] = DateTime.Now; 34 | } 35 | return row; 36 | } 37 | 38 | protected override void SetupJoinConditions() { 39 | LeftJoin.Left("database", "objectid").Right("database", "objectid"); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /Sqloogle/Operations/CachedSqlAggregate.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System; 18 | using System.Collections.Generic; 19 | using System.Linq; 20 | using Rhino.Etl.Core; 21 | using Rhino.Etl.Core.Operations; 22 | 23 | namespace Sqloogle.Operations { 24 | 25 | public class CachedSqlAggregate : AbstractAggregationOperation { 26 | 27 | public CachedSqlAggregate() { 28 | UseTransaction = false; 29 | } 30 | 31 | protected override string[] GetColumnsToGroupBy() { 32 | return new[] { "sqlscript" }; 33 | } 34 | 35 | protected override void Accumulate(Row row, Row aggregate) { 36 | 37 | // init 38 | if (aggregate["sqlscript"] == null) 39 | aggregate["sqlscript"] = row["sqlscript"]; 40 | 41 | if (aggregate["type"] == null) 42 | aggregate["type"] = row["type"]; 43 | 44 | if (aggregate["database"] == null) { 45 | aggregate["database"] = new Object[0]; 46 | } 47 | 48 | if (aggregate["use"] == null) { 49 | aggregate["use"] = 0; 50 | } 51 | 52 | //aggregate 53 | if (row["database"] != null) { 54 | var existing = new List((Object[])aggregate["database"]); 55 | if (!existing.Contains(row["database"])) { 56 | existing.Add(row["database"]); 57 | aggregate["database"] = existing.ToArray(); 58 | } 59 | } 60 | 61 | aggregate["use"] = ((int)aggregate["use"]) + ((int)row["use"]); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Sqloogle/Operations/CachedSqlExtract.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System.Data; 18 | using Rhino.Etl.Core; 19 | using Sqloogle.Operations.Support; 20 | 21 | namespace Sqloogle.Operations { 22 | public class CachedSqlExtract : InputOperation { 23 | 24 | public CachedSqlExtract(string connectionString) 25 | : base(connectionString) 26 | { 27 | UseTransaction = false; 28 | } 29 | 30 | protected override Row CreateRowFromReader(IDataReader reader) { 31 | return Row.FromReader(reader); 32 | } 33 | 34 | protected override void PrepareCommand(IDbCommand cmd) { 35 | cmd.CommandText = @"/* SQLoogle */ 36 | SELECT 37 | ph.[text] AS sqlscript 38 | ,DB_NAME(ph.[dbid]) AS [database] 39 | ,MAX(cp.objtype) AS [type] 40 | ,MAX(cp.usecounts) AS [use] 41 | FROM sys.dm_exec_cached_plans cp WITH (NOLOCK) 42 | CROSS APPLY sys.dm_exec_sql_text(plan_handle) ph 43 | WHERE cp.cacheobjtype = N'Compiled Plan' 44 | AND cp.objtype IN (N'Adhoc', N'Prepared') 45 | AND ph.[text] NOT LIKE '/* SQLoogle */%' 46 | GROUP BY ph.[text], DB_NAME(ph.[dbid]) 47 | ORDER BY ph.[text]; 48 | "; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Sqloogle/Operations/CachedSqlPostTransform.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System; 18 | using System.Collections.Generic; 19 | using Rhino.Etl.Core; 20 | using Rhino.Etl.Core.Operations; 21 | 22 | namespace Sqloogle.Operations { 23 | public class CachedSqlPostTransform : AbstractOperation { 24 | 25 | public CachedSqlPostTransform() { 26 | UseTransaction = false; 27 | } 28 | public override IEnumerable Execute(IEnumerable rows) { 29 | 30 | foreach (var row in rows) { 31 | row["schema"] = string.Empty; 32 | row["name"] = string.Empty; 33 | row["path"] = string.Empty; 34 | row["created"] = DateTime.Now; 35 | row["modified"] = DateTime.Now; 36 | row["lastused"] = DateTime.Now; 37 | yield return row; 38 | } 39 | 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Sqloogle/Operations/DatabaseFilter.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System.Collections.Generic; 18 | using System.Configuration; 19 | using System.Linq; 20 | using Rhino.Etl.Core; 21 | using Rhino.Etl.Core.Operations; 22 | 23 | namespace Sqloogle.Operations { 24 | public class DatabaseFilter : AbstractOperation { 25 | 26 | private readonly SqloogleBotConfiguration _config; 27 | 28 | public DatabaseFilter() 29 | { 30 | UseTransaction = false; 31 | _config = (SqloogleBotConfiguration)ConfigurationManager.GetSection("sqloogleBot"); 32 | } 33 | 34 | public override IEnumerable Execute(IEnumerable rows) { 35 | return rows.Where(row => !_config.Skips.Match(row["database"].ToString())); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Sqloogle/Operations/FakeOperation.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System.Collections.Generic; 18 | using Rhino.Etl.Core; 19 | using Rhino.Etl.Core.Operations; 20 | 21 | namespace Tests { 22 | 23 | public class FakeOperation : AbstractOperation { 24 | 25 | private readonly List _rows = new List(); 26 | 27 | public FakeOperation(IEnumerable rows ) 28 | { 29 | UseTransaction = false; 30 | _rows.AddRange(rows); 31 | } 32 | 33 | public FakeOperation(params Row[] rows) { 34 | _rows.AddRange(rows); 35 | } 36 | 37 | public FakeOperation Add(IEnumerable rows ) { 38 | _rows.AddRange(rows); 39 | return this; 40 | } 41 | 42 | public override IEnumerable Execute(IEnumerable rows) { 43 | return _rows; 44 | } 45 | 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Sqloogle/Operations/IndexStatsExtract.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System.Data; 18 | using Rhino.Etl.Core; 19 | using Sqloogle.Operations.Support; 20 | 21 | namespace Sqloogle.Operations { 22 | 23 | public class IndexStatsExtract : InputOperation { 24 | 25 | public IndexStatsExtract(string connectionString) : base(connectionString) { 26 | UseTransaction = false; 27 | } 28 | 29 | protected override Row CreateRowFromReader(IDataReader reader) { 30 | return Row.FromReader(reader); 31 | } 32 | 33 | protected override void PrepareCommand(IDbCommand cmd) { 34 | cmd.CommandText = @"/* SQLoogle */ 35 | 36 | SELECT 37 | DB_NAME(ius.database_id) AS [database] 38 | ,ius.[object_id] AS objectId 39 | ,ius.index_id AS indexId 40 | ,(user_seeks + user_scans + user_lookups + user_updates) AS [use] 41 | ,COALESCE(last_user_seek, last_user_scan, last_user_lookup, last_user_update) AS lastused 42 | FROM sys.dm_db_index_usage_stats ius WITH (NOLOCK) 43 | WHERE (user_seeks + user_scans + user_lookups + user_updates) > 0 44 | ORDER BY [Database], ObjectId, IndexId; 45 | "; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Sqloogle/Operations/IndexStatsJoin.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using Rhino.Etl.Core; 18 | using Rhino.Etl.Core.Operations; 19 | 20 | namespace Sqloogle.Operations { 21 | public class IndexStatsJoin : JoinOperation { 22 | 23 | public IndexStatsJoin() { 24 | UseTransaction = false; 25 | } 26 | 27 | protected override Row MergeRows(Row leftRow, Row rightRow) { 28 | 29 | var row = leftRow.Clone(); 30 | 31 | if (!leftRow["type"].Equals("Index")) 32 | return row; 33 | 34 | if (rightRow["use"] != null) 35 | row["use"] = rightRow["use"]; 36 | 37 | if (rightRow["lastused"] != null) 38 | row["lastused"] = rightRow["lastused"]; 39 | 40 | return row; 41 | } 42 | 43 | protected override void SetupJoinConditions() { 44 | LeftJoin 45 | .Left("database", "objectid", "indexid") 46 | .Right("database", "objectid", "indexid"); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Sqloogle/Operations/LuceneLoad.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using Lucene.Net.Documents; 18 | 19 | namespace Sqloogle.Operations { 20 | public class LuceneLoad : AbstractLuceneLoad { 21 | 22 | public LuceneLoad(string folder) : base(folder) 23 | { 24 | UseTransaction = false; 25 | } 26 | 27 | public override void PrepareSchema() { 28 | Schema["id"] = new LuceneFieldSettings(Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS); 29 | Schema["use"] = new LuceneFieldSettings(Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS); 30 | Schema["count"] = new LuceneFieldSettings(Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS); 31 | Schema["dropped"] = new LuceneFieldSettings(Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS); 32 | Schema["score"] = new LuceneFieldSettings(Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS); 33 | Schema["created"] = new LuceneFieldSettings(Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS); 34 | Schema["modified"] = new LuceneFieldSettings(Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS); 35 | Schema["lastused"] = new LuceneFieldSettings(Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS); 36 | Schema["lastneeded"] = new LuceneFieldSettings(Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS); 37 | Schema["sql"] = new LuceneFieldSettings(Field.Store.NO, Field.Index.ANALYZED); 38 | Schema["sqlscript"] = new LuceneFieldSettings(Field.Store.YES, Field.Index.NO); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /Sqloogle/Operations/ReportingServicesTransform.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System; 18 | using System.Collections.Generic; 19 | using System.Globalization; 20 | using System.IO; 21 | using System.Xml.Linq; 22 | using Rhino.Etl.Core; 23 | using Rhino.Etl.Core.Operations; 24 | 25 | namespace Sqloogle.Operations { 26 | 27 | public class ReportingServicesTransform : AbstractOperation { 28 | 29 | public ReportingServicesTransform() { 30 | UseTransaction = false; 31 | } 32 | 33 | public override IEnumerable Execute(IEnumerable rows) { 34 | 35 | foreach (var row in rows) { 36 | 37 | var rdl = XDocument.Parse(row["rdl"].ToString()); 38 | 39 | if (rdl.Root == null) 40 | continue; 41 | 42 | var nameSpace = rdl.Root.GetDefaultNamespace().NamespaceName; 43 | var commands = rdl.Root.Descendants("{" + nameSpace + "}CommandText"); 44 | var counter = 0; 45 | 46 | foreach (var command in commands) { 47 | counter++; 48 | var commandRow = new Row(); 49 | commandRow.Copy(row); 50 | 51 | commandRow["sqlscript"] = command.Value; 52 | commandRow["name"] = row["name"] + " - " + counter.ToString(CultureInfo.InvariantCulture).PadLeft(2, '0'); 53 | commandRow["path"] = Path.Combine("Reporting Services", row["path"].ToString().Replace("/", "\\").TrimStart('\\')); 54 | commandRow["type"] = "SSRS Command"; 55 | commandRow["schema"] = string.Empty; 56 | commandRow["lastused"] = DateTime.MinValue; 57 | yield return commandRow; 58 | } 59 | 60 | } 61 | } 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /Sqloogle/Operations/Support/AppendToRowOperation.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System.Collections.Generic; 18 | using Rhino.Etl.Core; 19 | using Rhino.Etl.Core.Operations; 20 | 21 | namespace Sqloogle.Operations.Support { 22 | 23 | public class AppendToRowOperation : AbstractOperation { 24 | 25 | public AppendToRowOperation() { 26 | UseTransaction = false; 27 | } 28 | 29 | private readonly IDictionary _data; 30 | 31 | public AppendToRowOperation(string key, object value) { 32 | _data = new Dictionary { { key, value } }; 33 | } 34 | 35 | public AppendToRowOperation(IDictionary data) { 36 | _data = data; 37 | } 38 | 39 | public AppendToRowOperation Add(KeyValuePair data) { 40 | _data.Add(data); 41 | return this; 42 | } 43 | 44 | public override IEnumerable Execute(IEnumerable rows) { 45 | foreach (var row in rows) { 46 | foreach (var kv in _data) { 47 | row.Add(kv.Key, kv.Value); 48 | } 49 | yield return row; 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Sqloogle/Operations/Support/InputOperation.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System.Configuration; 18 | using Rhino.Etl.Core.Operations; 19 | 20 | namespace Sqloogle.Operations.Support { 21 | 22 | /// 23 | /// Generic input command operation that takes the 24 | /// actual connection string itself, rather than a 25 | /// connection string from the configuration, or a 26 | /// connection string settings object. 27 | /// 28 | public abstract class InputOperation : InputCommandOperation { 29 | 30 | private const string PROVIDER = "System.Data.SqlClient.SqlConnection, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; 31 | private static string _connectionString; 32 | 33 | protected InputOperation(string connectionString) : base(GetConnectionStringSettings(connectionString)) 34 | { 35 | UseTransaction = false; 36 | } 37 | 38 | private static ConnectionStringSettings GetConnectionStringSettings(string connectionString) 39 | { 40 | _connectionString = connectionString; 41 | return new ConnectionStringSettings { 42 | ConnectionString = _connectionString, 43 | ProviderName = PROVIDER, 44 | }; 45 | } 46 | 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Sqloogle/Operations/Support/KeyCheckOperation.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System.Collections.Generic; 18 | using Rhino.Etl.Core; 19 | using Rhino.Etl.Core.Operations; 20 | 21 | namespace Sqloogle.Operations.Support { 22 | 23 | public class KeyCheckOperation : AbstractOperation { 24 | 25 | public KeyCheckOperation() { 26 | UseTransaction = false; 27 | } 28 | 29 | private readonly List _keys = new List(); 30 | 31 | public KeyCheckOperation(IEnumerable keys) { 32 | _keys.AddRange(keys); 33 | } 34 | 35 | public KeyCheckOperation AddRange(IEnumerable keys) { 36 | _keys.AddRange(keys); 37 | return this; 38 | } 39 | 40 | public KeyCheckOperation AddParams(params string[] keys) { 41 | _keys.AddRange(keys); 42 | return this; 43 | } 44 | 45 | public override IEnumerable Execute(IEnumerable rows) { 46 | foreach (var row in rows) { 47 | foreach (var key in _keys) { 48 | Guard.Against(!row.Contains(key), string.Format("Row must contain {0} key", key)); 49 | } 50 | yield return row; 51 | } 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Sqloogle/Operations/Support/SerialUnionAllOperation.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System.Collections.Generic; 18 | using Rhino.Etl.Core; 19 | using Rhino.Etl.Core.Operations; 20 | 21 | namespace Sqloogle.Operations.Support { 22 | public class SerialUnionAllOperation : AbstractOperation { 23 | 24 | private readonly List _operations = new List(); 25 | 26 | public SerialUnionAllOperation() { 27 | UseTransaction = false; 28 | } 29 | 30 | public SerialUnionAllOperation(IEnumerable ops) { 31 | _operations.AddRange(ops); 32 | } 33 | 34 | public SerialUnionAllOperation(params IOperation[] ops) { 35 | _operations.AddRange(ops); 36 | } 37 | 38 | public override IEnumerable Execute(IEnumerable rows) { 39 | foreach (var operation in _operations) 40 | foreach (var row in operation.Execute(null)) 41 | yield return row; 42 | } 43 | 44 | public SerialUnionAllOperation Add(params IOperation[] operation) { 45 | _operations.AddRange(operation); 46 | return this; 47 | } 48 | 49 | /// 50 | /// Initializes this instance 51 | /// 52 | /// The current pipeline executer. 53 | public override void PrepareForExecution(IPipelineExecuter pipelineExecuter) { 54 | foreach (var operation in _operations) { 55 | operation.PrepareForExecution(pipelineExecuter); 56 | } 57 | } 58 | 59 | } 60 | } -------------------------------------------------------------------------------- /Sqloogle/Operations/Support/SqlOperation.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System.Data; 18 | using Rhino.Etl.Core; 19 | 20 | namespace Sqloogle.Operations.Support 21 | { 22 | 23 | /// 24 | /// Generic input command operation that takes the 25 | /// connection string and sql you want to run. Use 26 | /// this when your program is creating the connection 27 | /// string and sql (you don't know it up front). 28 | /// 29 | public class SqlOperation : InputOperation 30 | { 31 | private readonly string _sql; 32 | 33 | public SqlOperation(string connectionString, string sql) : base(connectionString) 34 | { 35 | UseTransaction = false; 36 | _sql = sql; 37 | } 38 | 39 | protected override Row CreateRowFromReader(IDataReader reader) 40 | { 41 | return Row.FromReader(reader); 42 | } 43 | 44 | protected override void PrepareCommand(IDbCommand cmd) 45 | { 46 | cmd.CommandText = _sql; 47 | cmd.CommandTimeout = 0; 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /Sqloogle/Operations/Support/SqlSubOperation.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System.Collections.Generic; 18 | using Rhino.Etl.Core; 19 | using Rhino.Etl.Core.Operations; 20 | 21 | namespace Sqloogle.Operations.Support { 22 | 23 | public class SqlSubOperation : AbstractOperation { 24 | 25 | private const string COLUMN_WITH_CONNECTION_STRING = "connectionstring"; 26 | private readonly string _columnWithSql; 27 | 28 | public SqlSubOperation(string columnWithSql) 29 | { 30 | UseTransaction = false; 31 | _columnWithSql = columnWithSql; 32 | } 33 | 34 | public override IEnumerable Execute(IEnumerable rows) { 35 | 36 | foreach (var row in rows) { 37 | foreach (var subRow in GetSubOperation(row).Execute(null)) { 38 | foreach (var column in row.Columns) 39 | if (column != _columnWithSql) 40 | subRow.Add(column, row[column]); 41 | 42 | yield return subRow; 43 | } 44 | } 45 | 46 | } 47 | 48 | protected IOperation GetSubOperation(Row row) 49 | { 50 | Guard.Against(!row.Contains(COLUMN_WITH_CONNECTION_STRING), string.Format("Rows must contain \"{0}\" key.", COLUMN_WITH_CONNECTION_STRING)); 51 | Guard.Against(!row.Contains(_columnWithSql), string.Format("Rows must contain \"{0}\" key.", _columnWithSql)); 52 | 53 | var connectionString = row[COLUMN_WITH_CONNECTION_STRING].ToString(); 54 | var sql = row[_columnWithSql].ToString(); 55 | return new SqlOperation(connectionString, sql); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Sqloogle/Operations/Support/UnionOperation.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System.Collections.Generic; 18 | using System.Linq; 19 | using Rhino.Etl.Core; 20 | using Rhino.Etl.Core.Operations; 21 | 22 | namespace Sqloogle.Operations.Support { 23 | 24 | public class UnionOperation : AbstractAggregationOperation { 25 | 26 | private readonly IEnumerable _groupByColumns; 27 | 28 | public UnionOperation(IEnumerable groupByColumns) 29 | { 30 | UseTransaction = false; 31 | _groupByColumns = groupByColumns; 32 | } 33 | 34 | protected override void Accumulate(Row row, Row aggregate) { 35 | 36 | foreach (var column in _groupByColumns) { 37 | aggregate[column] = row[column]; 38 | } 39 | 40 | if (aggregate["Count"] == null) 41 | aggregate["Count"] = 0; 42 | 43 | aggregate["Count"] = (int)aggregate["Count"] + 1; 44 | } 45 | 46 | protected override string[] GetColumnsToGroupBy() { 47 | return _groupByColumns.ToArray(); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Sqloogle/Operations/TableStatsExtract.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System.Data; 18 | using Rhino.Etl.Core; 19 | using Sqloogle.Operations.Support; 20 | 21 | namespace Sqloogle.Operations { 22 | public class TableStatsExtract : InputOperation { 23 | 24 | public TableStatsExtract(string connectionString) 25 | : base(connectionString) 26 | { 27 | UseTransaction = false; 28 | } 29 | 30 | protected override Row CreateRowFromReader(IDataReader reader) { 31 | return Row.FromReader(reader); 32 | } 33 | 34 | protected override void PrepareCommand(IDbCommand cmd) { 35 | cmd.CommandText = @"/* SQLoogle */ 36 | 37 | SELECT 38 | DB_NAME(ius.database_id) AS [database] 39 | ,ius.[object_id] AS objectid 40 | ,SUM(user_seeks + user_scans + user_lookups + user_updates) AS [use] 41 | ,MAX(COALESCE(last_user_seek, last_user_scan, last_user_lookup, last_user_update)) AS lastused 42 | FROM sys.dm_db_index_usage_stats ius WITH (NOLOCK) 43 | WHERE (user_seeks + user_scans + user_lookups + user_updates) > 0 44 | GROUP BY 45 | DB_NAME(ius.database_id) 46 | ,ius.[object_id] 47 | ORDER BY [Database], ObjectId 48 | "; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Sqloogle/Operations/TableStatsJoin.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using Rhino.Etl.Core; 18 | using Rhino.Etl.Core.Operations; 19 | 20 | namespace Sqloogle.Operations { 21 | public class TableStatsJoin : JoinOperation { 22 | 23 | public TableStatsJoin() { 24 | UseTransaction = false; 25 | } 26 | 27 | protected override Row MergeRows(Row leftRow, Row rightRow) { 28 | 29 | var row = leftRow.Clone(); 30 | 31 | if (!leftRow["type"].Equals("Table")) 32 | return row; 33 | 34 | if (rightRow["use"] != null) 35 | row["use"] = rightRow["use"]; 36 | 37 | if (rightRow["lastused"] != null) 38 | row["lastused"] = rightRow["lastused"]; 39 | 40 | return row; 41 | } 42 | 43 | protected override void SetupJoinConditions() { 44 | LeftJoin 45 | .Left("database", "objectid") 46 | .Right("database", "objectid"); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Sqloogle/Processes/CachedSqlProcess.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using Rhino.Etl.Core.Operations; 18 | using Sqloogle.Operations; 19 | 20 | namespace Sqloogle.Processes { 21 | public class CachedSqlProcess : PartialProcessOperation { 22 | public CachedSqlProcess(string connectionString) 23 | { 24 | UseTransaction = false; 25 | Register(new CachedSqlExtract(connectionString)); 26 | Register(new CachedSqlPreTransform()); 27 | Register(new CachedSqlAggregate()); 28 | Register(new CachedSqlPostTransform()); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Sqloogle/Processes/DefinitionProcess.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using Rhino.Etl.Core.Operations; 18 | using Sqloogle.Operations; 19 | 20 | namespace Sqloogle.Processes { 21 | 22 | /// 23 | /// A DefinitionProcess queries object definitions from each database 24 | /// on a server. It also queries statistics (use and last used). 25 | /// 26 | public class DefinitionProcess : PartialProcessOperation { 27 | 28 | public DefinitionProcess(string connectionString) { 29 | UseTransaction = false; 30 | Register(new DatabaseExtract(connectionString)); 31 | Register(new DatabaseFilter()); 32 | Register(new DefinitionExtract()); 33 | Register(new CachedObjectStatsJoin().Right(new CachedObjectStatsExtract(connectionString))); 34 | Register(new TableStatsJoin().Right(new TableStatsExtract(connectionString))); 35 | RegisterLast(new IndexStatsJoin().Right(new IndexStatsExtract(connectionString))); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Sqloogle/Processes/ReportingServicesProcess.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using Rhino.Etl.Core.Operations; 18 | using Sqloogle.Operations; 19 | 20 | namespace Sqloogle.Processes { 21 | 22 | public class ReportingServicesProcess : PartialProcessOperation { 23 | 24 | public ReportingServicesProcess(string connectionString) 25 | { 26 | UseTransaction = false; 27 | Register(new DatabaseExtract(connectionString)); 28 | Register(new ReportingServicesExtract()); 29 | Register(new ReportingServicesTransform()); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Sqloogle/Processes/ServerCrawlProcess.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using Rhino.Etl.Core.Operations; 18 | using Sqloogle.Operations; 19 | using Sqloogle.Operations.Support; 20 | 21 | namespace Sqloogle.Processes { 22 | 23 | /// 24 | /// A ServerProcess queries cached sql, sql agent jobs, 25 | /// reporting services commands, and object definitions from 26 | /// a single SQL Server. 27 | /// 28 | public class ServerCrawlProcess : PartialProcessOperation { 29 | 30 | public ServerCrawlProcess(string connectionString, string server) { 31 | 32 | UseTransaction = false; 33 | 34 | var union = new ParallelUnionAllOperation( 35 | new DefinitionProcess(connectionString), 36 | new CachedSqlProcess(connectionString), 37 | new SqlAgentJobExtract(connectionString), 38 | new ReportingServicesProcess(connectionString) 39 | ); 40 | 41 | Register(union); 42 | RegisterLast(new AppendToRowOperation("server", server)); 43 | 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Sqloogle/Processes/ServerMiaCrawlProcess.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using Rhino.Etl.Core.Operations; 18 | using Sqloogle.Operations; 19 | 20 | namespace Sqloogle.Processes { 21 | 22 | public class ServerMiaCrawlProcess : PartialProcessOperation { 23 | 24 | public ServerMiaCrawlProcess(string connectionString, string server) { 25 | UseTransaction = false; 26 | Register(new DatabaseExtract(connectionString)); 27 | Register(new DatabaseFilter()); 28 | RegisterLast(new MissingIndexExtract(server)); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Sqloogle/Processes/SqloogleEtlProcess.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using Rhino.Etl.Core; 18 | using Rhino.Etl.Core.Operations; 19 | 20 | namespace Sqloogle.Processes { 21 | 22 | /// 23 | /// An EtlProcess with some extra logging. 24 | /// 25 | public abstract class SqloogleEtlProcess : EtlProcess { 26 | 27 | protected SqloogleEtlProcess() { 28 | UseTransaction = false; 29 | } 30 | 31 | protected override void OnFinishedProcessing(IOperation op) { 32 | Info("{0} Output {1} rows.", op.Name, op.Statistics.OutputtedRows); 33 | base.OnFinishedProcessing(op); 34 | } 35 | 36 | protected override void PostProcessing() { 37 | Info("Process Complete."); 38 | base.PostProcessing(); 39 | } 40 | 41 | protected override void OnRowProcessed(IOperation op, Row dictionary) { 42 | if (op.Statistics.OutputtedRows % 1000 == 0) 43 | Info("Processed {0} rows in {1}", op.Statistics.OutputtedRows, op.Name); 44 | else { 45 | if (op.Statistics.OutputtedRows % 100 == 0) 46 | Debug("Processed {0} rows in {1}", op.Statistics.OutputtedRows, op.Name); 47 | else 48 | Trace("Processed {0} rows in {1}", op.Statistics.OutputtedRows, op.Name); 49 | } 50 | } 51 | 52 | public void ReportErrors() { 53 | foreach (var exception in GetAllErrors()) { 54 | Error(exception, "*** ERROR IN {0} PROCESS ***", Name.ToUpper()); 55 | Info(exception.Message); 56 | if (exception.StackTrace != null) 57 | Info(exception.StackTrace); 58 | } 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Sqloogle/Processes/SqloogleMiaProcess.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System.Configuration; 18 | using System.IO; 19 | using Sqloogle.Operations; 20 | using Sqloogle.Operations.Support; 21 | 22 | namespace Sqloogle.Processes { 23 | 24 | /// 25 | /// The SQLoogle MIA (Missing Index Analyzer) process. 26 | /// 27 | public class SqloogleMiaProcess : SqloogleEtlProcess { 28 | 29 | public SqloogleMiaProcess() { 30 | UseTransaction = false; 31 | } 32 | 33 | protected override void Initialize() { 34 | 35 | var config = (SqloogleBotConfiguration)ConfigurationManager.GetSection("sqloogleBot"); 36 | var miaFolder = Path.Combine(config.SearchIndexPath, "MIA"); 37 | 38 | if (!Directory.Exists(miaFolder)) 39 | Directory.CreateDirectory(miaFolder); 40 | 41 | using (var writer = new LuceneWriter(miaFolder)) { 42 | writer.Clean(); 43 | } 44 | 45 | Register(new ParallelUnionAllOperation(config.ServerMiaCrawlProcesses())); 46 | Register(new MissingIndexTransform()); 47 | RegisterLast(new LuceneLoad(miaFolder)); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Sqloogle/Processes/SqloogleProcess.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System.Configuration; 18 | using System.IO; 19 | using Sqloogle.Operations; 20 | using Sqloogle.Operations.Support; 21 | 22 | namespace Sqloogle.Processes { 23 | 24 | /// 25 | /// The SQLoogle process. This is where it all comes together. It SQLoogles! 26 | /// 27 | public class SqloogleProcess : SqloogleEtlProcess { 28 | 29 | public SqloogleProcess() { 30 | UseTransaction = false; 31 | } 32 | 33 | protected override void Initialize() { 34 | 35 | var config = (SqloogleBotConfiguration)ConfigurationManager.GetSection("sqloogleBot"); 36 | 37 | if (!Directory.Exists(config.SearchIndexPath)) 38 | Directory.CreateDirectory(config.SearchIndexPath); 39 | 40 | Register(new ParallelUnionAllOperation(config.ServerCrawlProcesses())); 41 | Register(new SqloogleAggregate()); 42 | Register(new SqloogleTransform()); 43 | Register(new SqloogleCompare().Right(new LuceneExtract(config.SearchIndexPath))); 44 | Register(new LuceneLoad(config.SearchIndexPath)); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Sqloogle/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System.Reflection; 18 | using System.Runtime.InteropServices; 19 | 20 | // General Information about an assembly is controlled through the following 21 | // set of attributes. Change these attribute values to modify the information 22 | // associated with an assembly. 23 | [assembly: AssemblyTitle("Sqloogle")] 24 | [assembly: AssemblyDescription("")] 25 | [assembly: AssemblyConfiguration("")] 26 | [assembly: AssemblyCompany("Dale Newman")] 27 | [assembly: AssemblyProduct("Sqloogle")] 28 | [assembly: AssemblyCopyright("Copyright © Dale Newman 2011")] 29 | [assembly: AssemblyTrademark("")] 30 | [assembly: AssemblyCulture("")] 31 | 32 | // Setting ComVisible to false makes the types in this assembly not visible 33 | // to COM components. If you need to access a type in this assembly from 34 | // COM, set the ComVisible attribute to true on that type. 35 | [assembly: ComVisible(false)] 36 | 37 | // The following GUID is for the ID of the typelib if this project is exposed to COM 38 | [assembly: Guid("8c837a72-db32-42f9-b84c-a37d815b62c0")] 39 | 40 | // Version information for an assembly consists of the following four values: 41 | // 42 | // Major Version 43 | // Minor Version 44 | // Build Number 45 | // Revision 46 | // 47 | // You can specify all the values or you can default the Build and Revision Numbers 48 | // by using the '*' as shown below: 49 | // [assembly: AssemblyVersion("1.0.*")] 50 | [assembly: AssemblyVersion("0.0.1.0")] 51 | [assembly: AssemblyFileVersion("0.0.1.0")] 52 | -------------------------------------------------------------------------------- /Sqloogle/Search/IScriptSearcher.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System.Collections.Generic; 18 | 19 | namespace Sqloogle.Search 20 | { 21 | public interface IScriptSearcher { 22 | IEnumerable> Search(string query); 23 | IDictionary Find(string id); 24 | void Close(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Sqloogle/SqlConnectionChecker.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System; 18 | using System.Collections.Generic; 19 | using System.Data; 20 | using System.Data.SqlClient; 21 | using System.Linq; 22 | using Rhino.Etl.Core; 23 | 24 | namespace Sqloogle { 25 | public class SqlConnectionChecker : WithLoggingMixin { 26 | 27 | private readonly List _builders = new List(); 28 | 29 | public SqlConnectionChecker(IEnumerable connectionStrings, int timeOut = 7) { 30 | foreach (var connectionString in connectionStrings) { 31 | _builders.Add(new SqlConnectionStringBuilder(connectionString) { ConnectTimeout = timeOut }); 32 | } 33 | } 34 | 35 | public bool AllGood() { 36 | var results = new List(); 37 | 38 | foreach (var builder in _builders) { 39 | SqlConnection sqlConnection; 40 | using (sqlConnection = new SqlConnection(builder.ConnectionString)) { 41 | try { 42 | sqlConnection.Open(); 43 | results.Add(sqlConnection.State == ConnectionState.Open); 44 | } 45 | catch (Exception e) { 46 | results.Add(false); 47 | Error(e, String.Format("Failed to connect to server: {0}, database: {1}.", builder.DataSource, builder.InitialCatalog)); 48 | } 49 | } 50 | } 51 | 52 | var result = results.All(b => b); 53 | if(result) 54 | Debug("All databases are online. Proceed."); 55 | return result; 56 | } 57 | 58 | } 59 | } -------------------------------------------------------------------------------- /Sqloogle/Utilities/Dates.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System; 18 | 19 | namespace Sqloogle.Utilities 20 | { 21 | public static class Dates 22 | { 23 | 24 | public static DateTime ConvertDocDate(string docDate) 25 | { 26 | var year = docDate.Substring(0, 4); 27 | var month = docDate.Substring(4, 2); 28 | var day = docDate.Substring(6, 2); 29 | return Convert.ToDateTime(string.Concat(year, "-", month, "-", day)); 30 | } 31 | 32 | public static string FormatDate(DateTime dateTime) 33 | { 34 | if (dateTime.Equals(DateTime.MinValue)) 35 | return string.Empty; 36 | if (DateTime.Now.Subtract(dateTime).TotalDays > 365) 37 | return dateTime.ToString("yyyy"); 38 | return DateTime.Now.Year == dateTime.Year ? dateTime.ToString("MM-dd") : dateTime.ToString("yyyy-MM-dd"); 39 | } 40 | 41 | } 42 | } -------------------------------------------------------------------------------- /Sqloogle/Utilities/Docs.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System.Collections.Generic; 18 | using System.Globalization; 19 | using Lucene.Net.Documents; 20 | 21 | namespace Sqloogle.Utilities { 22 | public class Docs { 23 | public static IDictionary DocToDict(Document doc, float score = 0) { 24 | var dict = new Dictionary(); 25 | foreach (var field in doc.GetFields()) { 26 | if (field.IsStored) 27 | dict[field.Name] = doc.Get(field.Name); 28 | } 29 | dict["rank"] = score.ToString(CultureInfo.InvariantCulture); 30 | return dict; 31 | } 32 | 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Sqloogle/Utilities/Enums.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | namespace Sqloogle.Utilities 18 | { 19 | public static class Enums 20 | { 21 | public enum DirectoryType 22 | { 23 | FileSystem, 24 | Memory 25 | } 26 | 27 | public enum WriteType 28 | { 29 | None, 30 | Create, 31 | Alter, 32 | Drop, 33 | Move 34 | } 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Sqloogle/Utilities/LinqExtensions.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System; 18 | using System.Collections.Generic; 19 | using System.Linq; 20 | 21 | namespace Sqloogle.Utilities 22 | { 23 | public static class LinqExtensions 24 | { 25 | public static Boolean IsEmpty(this IEnumerable source) 26 | { 27 | return source == null || !source.Any(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Sqloogle/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Sqloogle/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /SqloogleBot/NLog.config: -------------------------------------------------------------------------------- 1 |  2 | 9 | 10 | 11 | 14 | 15 | 16 | 20 | 21 | 22 | 23 | 27 | 28 | 33 | 34 | 35 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /SqloogleBot/Options.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using CommandLine; 18 | using CommandLine.Text; 19 | 20 | namespace SqloogleBot { 21 | public class Options { 22 | [Option('s', "schedule", Required = false, HelpText = "a cron expression (http://www.quartz-scheduler.org/documentation/quartz-1.x/tutorials/crontrigger)")] 23 | public string Schedule { get; set; } 24 | 25 | [HelpOption] 26 | public string GetUsage() { 27 | return HelpText.AutoBuild(this, current => HelpText.DefaultParsingErrorsHandler(this, current)); 28 | } 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /SqloogleBot/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System.Reflection; 18 | using System.Runtime.CompilerServices; 19 | using System.Runtime.InteropServices; 20 | 21 | // General Information about an assembly is controlled through the following 22 | // set of attributes. Change these attribute values to modify the information 23 | // associated with an assembly. 24 | [assembly: AssemblyTitle("SqloogleBot")] 25 | [assembly: AssemblyDescription("This is bot that crawls SQL Servers for object definitions.")] 26 | [assembly: AssemblyConfiguration("")] 27 | [assembly: AssemblyCompany("Dale Newman")] 28 | [assembly: AssemblyProduct("Console")] 29 | [assembly: AssemblyCopyright("Copyright © Dale Newman 2011")] 30 | [assembly: AssemblyTrademark("")] 31 | [assembly: AssemblyCulture("")] 32 | 33 | // Setting ComVisible to false makes the types in this assembly not visible 34 | // to COM components. If you need to access a type in this assembly from 35 | // COM, set the ComVisible attribute to true on that type. 36 | [assembly: ComVisible(false)] 37 | 38 | // The following GUID is for the ID of the typelib if this project is exposed to COM 39 | [assembly: Guid("db0fd38d-da68-414c-b010-11f8653139f6")] 40 | 41 | // Version information for an assembly consists of the following four values: 42 | // 43 | // Major Version 44 | // Minor Version 45 | // Build Number 46 | // Revision 47 | // 48 | // You can specify all the values or you can default the Build and Revision Numbers 49 | // by using the '*' as shown below: 50 | // [assembly: AssemblyVersion("1.0.*")] 51 | [assembly: AssemblyVersion("0.0.1.0")] 52 | [assembly: AssemblyFileVersion("0.0.1.0")] 53 | -------------------------------------------------------------------------------- /SqloogleBot/QuartzCronScheduler.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using Common.Logging; 18 | using Quartz; 19 | using Quartz.Impl; 20 | using Quartz.Spi; 21 | 22 | namespace SqloogleBot { 23 | 24 | public class QuartzCronScheduler { 25 | readonly IScheduler _scheduler; 26 | private readonly Options _options; 27 | private readonly ILog _logger; 28 | 29 | public QuartzCronScheduler(Options options, IJobFactory jobFactory, ILoggerFactoryAdapter loggerFactory) { 30 | _options = options; 31 | _scheduler = StdSchedulerFactory.GetDefaultScheduler(); 32 | _scheduler.JobFactory = jobFactory; 33 | 34 | LogManager.Adapter = loggerFactory; 35 | _logger = LogManager.GetLogger("Quartz.Net"); 36 | } 37 | 38 | public void Start() { 39 | 40 | _logger.Info($"Starting Scheduler: {_options.Schedule}"); 41 | _scheduler.Start(); 42 | 43 | var job = JobBuilder.Create() 44 | .WithIdentity("Job", "SQLoogleBotJob") 45 | .StoreDurably(false) 46 | .RequestRecovery(false) 47 | .WithDescription("I am a SQLoogleBot Quartz.Net Job!") 48 | .UsingJobData("Schedule", _options.Schedule) 49 | .Build(); 50 | 51 | var trigger = TriggerBuilder.Create() 52 | .WithIdentity("Trigger", "SQLoogleBotTrigger") 53 | .StartNow() 54 | .WithCronSchedule(_options.Schedule, x => x.WithMisfireHandlingInstructionIgnoreMisfires()) 55 | .Build(); 56 | 57 | _scheduler.ScheduleJob(job, trigger); 58 | } 59 | 60 | public void Stop() { 61 | if (!_scheduler.IsStarted) 62 | return; 63 | 64 | _logger.Info("Stopping Scheduler..."); 65 | _scheduler.Shutdown(true); 66 | } 67 | 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /SqloogleBot/QuartzJobFactory.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System; 18 | using Quartz; 19 | using Quartz.Spi; 20 | using IScheduler = Quartz.IScheduler; 21 | 22 | namespace SqloogleBot { 23 | 24 | public class QuartzJobFactory : IJobFactory { 25 | 26 | public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler) { 27 | return new SqloogleJob(); 28 | } 29 | 30 | public void ReturnJob(IJob job) { 31 | var disposable = job as IDisposable; 32 | disposable?.Dispose(); 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /SqloogleBot/QuartzLogAdaptor.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using Common.Logging; 18 | using Common.Logging.Simple; 19 | 20 | namespace SqloogleBot { 21 | 22 | public class QuartzLogAdaptor : AbstractSimpleLoggerFactoryAdapter { 23 | 24 | public QuartzLogAdaptor(LogLevel level, bool showLevel, bool showDateTime, bool showLogName, string dateTimeFormat) :base(level, showDateTime, showLogName, showLevel, dateTimeFormat) { 25 | } 26 | 27 | protected override ILog CreateLogger(string name, LogLevel level, bool showLevel, bool showDateTime, bool showLogName, string dateTimeFormat) { 28 | return new QuartzLogger(level, showLevel, showDateTime, showLogName, dateTimeFormat); 29 | } 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /SqloogleBot/SqloogleJob.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using Quartz; 18 | using Sqloogle.Processes; 19 | 20 | namespace SqloogleBot { 21 | public class SqloogleJob : IJob { 22 | public void Execute(IJobExecutionContext context) { 23 | using (var sqloogle = new SqloogleProcess()) { 24 | sqloogle.Execute(); 25 | sqloogle.ReportErrors(); 26 | } 27 | 28 | using (var sqloogleMia = new SqloogleMiaProcess()) { 29 | sqloogleMia.Execute(); 30 | sqloogleMia.ReportErrors(); 31 | } 32 | 33 | } 34 | 35 | } 36 | } -------------------------------------------------------------------------------- /SqloogleBot/Utility.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System.Linq; 18 | using Common.Logging; 19 | 20 | namespace SqloogleBot { 21 | public static class Utility { 22 | 23 | public static LogLevel GetConsoleLogLevel() { 24 | var logLevel = LogLevel.Info; 25 | 26 | var target = NLog.LogManager.Configuration.FindTargetByName("console"); 27 | if (target == null) 28 | return logLevel; 29 | 30 | var rule = NLog.LogManager.Configuration.LoggingRules.FirstOrDefault(r => r.Targets.Contains(target)); 31 | var level = rule?.Levels.FirstOrDefault(); 32 | if (level != null) { 33 | logLevel = ConvertLevel(level); 34 | } 35 | 36 | return logLevel; 37 | 38 | } 39 | private static LogLevel ConvertLevel(NLog.LogLevel level) { 40 | switch (level.Name) { 41 | case "Debug": 42 | return LogLevel.Debug; 43 | case "Info": 44 | return LogLevel.Info; 45 | case "Warn": 46 | return LogLevel.Warn; 47 | case "Error": 48 | return LogLevel.Error; 49 | case "Off": 50 | return LogLevel.Off; 51 | default: 52 | return LogLevel.Info; 53 | } 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /SqloogleBot/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /SqloogleBot/quartz.config: -------------------------------------------------------------------------------- 1 | quartz.scheduler.instanceName = Pipeline.Net.Scheduler 2 | quartz.threadPool.threadCount = 1 3 | quartz.jobStore.type = Quartz.Simpl.RAMJobStore, Quartz -------------------------------------------------------------------------------- /Tests/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /Tests/EtlProcessHelper.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System.Collections.Generic; 18 | using Rhino.Etl.Core; 19 | using Rhino.Etl.Core.Operations; 20 | 21 | namespace Tests { 22 | 23 | public class EtlProcessHelper { 24 | protected List TestOperation(params IOperation[] operations) { 25 | return new TestProcess(operations).ExecuteWithResults(); 26 | } 27 | 28 | protected class TestProcess : EtlProcess { 29 | List returnRows = new List(); 30 | 31 | private class ResultsOperation : AbstractOperation { 32 | public ResultsOperation(List returnRows) { 33 | this.returnRows = returnRows; 34 | } 35 | 36 | List returnRows = null; 37 | 38 | public override IEnumerable Execute(IEnumerable rows) { 39 | returnRows.AddRange(rows); 40 | 41 | return rows; 42 | } 43 | } 44 | 45 | public TestProcess(params IOperation[] testOperations) { 46 | this.testOperations = testOperations; 47 | } 48 | 49 | IEnumerable testOperations = null; 50 | 51 | protected override void Initialize() { 52 | foreach (var testOperation in testOperations) 53 | Register(testOperation); 54 | 55 | Register(new ResultsOperation(returnRows)); 56 | } 57 | 58 | public List ExecuteWithResults() { 59 | Execute(); 60 | return returnRows; 61 | } 62 | } 63 | 64 | 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System.Reflection; 18 | using System.Runtime.CompilerServices; 19 | using System.Runtime.InteropServices; 20 | 21 | // General Information about an assembly is controlled through the following 22 | // set of attributes. Change these attribute values to modify the information 23 | // associated with an assembly. 24 | [assembly: AssemblyTitle("Tests")] 25 | [assembly: AssemblyDescription("")] 26 | [assembly: AssemblyConfiguration("")] 27 | [assembly: AssemblyCompany("Microsoft")] 28 | [assembly: AssemblyProduct("Tests")] 29 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")] 30 | [assembly: AssemblyTrademark("")] 31 | [assembly: AssemblyCulture("")] 32 | 33 | // Setting ComVisible to false makes the types in this assembly not visible 34 | // to COM components. If you need to access a type in this assembly from 35 | // COM, set the ComVisible attribute to true on that type. 36 | [assembly: ComVisible(false)] 37 | 38 | // The following GUID is for the ID of the typelib if this project is exposed to COM 39 | [assembly: Guid("fd1f6b23-74eb-4743-b341-23e32d325948")] 40 | 41 | // Version information for an assembly consists of the following four values: 42 | // 43 | // Major Version 44 | // Minor Version 45 | // Build Number 46 | // Revision 47 | // 48 | // You can specify all the values or you can default the Build and Revision Numbers 49 | // by using the '*' as shown below: 50 | [assembly: AssemblyVersion("1.0.0.0")] 51 | [assembly: AssemblyFileVersion("1.0.0.0")] 52 | -------------------------------------------------------------------------------- /Tests/TestConfig.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Sqloogle 3 | // Copyright 2013-2017 Dale Newman 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | #endregion 17 | using System.Configuration; 18 | using NUnit.Framework; 19 | using Sqloogle; 20 | 21 | namespace Tests { 22 | 23 | [TestFixture] 24 | public class TestConfig { 25 | 26 | [Test] 27 | public void TestConfiguration() { 28 | 29 | var config = (SqloogleBotConfiguration)ConfigurationManager.GetSection("sqloogleBot"); 30 | Assert.AreEqual(@"c:\Sqloogle\SearchIndex\", config.SearchIndexPath); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /Tests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /packages/repositories.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | --------------------------------------------------------------------------------