From 4f728c3d42c1c01da76ad19586cb3146aaecf6d9 Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Tue, 24 Dec 2019 13:46:01 +0100 Subject: [PATCH] Removed unused dialects from Marr so it compiles with less dependencies. --- src/Marr.Data/Parameters/OleDbTypeBuilder.cs | 68 ------------------ src/Marr.Data/Parameters/SqlDbTypeBuilder.cs | 71 ------------------- .../QGen/Dialects/FirebirdDialect.cs | 17 ----- src/Marr.Data/QGen/Dialects/OracleDialect.cs | 35 --------- .../QGen/Dialects/SqlServerCeDialect.cs | 21 ------ .../QGen/Dialects/SqlServerDialect.cs | 13 ---- src/Marr.Data/QGen/QueryFactory.cs | 33 --------- 7 files changed, 258 deletions(-) delete mode 100644 src/Marr.Data/Parameters/OleDbTypeBuilder.cs delete mode 100644 src/Marr.Data/Parameters/SqlDbTypeBuilder.cs delete mode 100644 src/Marr.Data/QGen/Dialects/FirebirdDialect.cs delete mode 100644 src/Marr.Data/QGen/Dialects/OracleDialect.cs delete mode 100644 src/Marr.Data/QGen/Dialects/SqlServerCeDialect.cs delete mode 100644 src/Marr.Data/QGen/Dialects/SqlServerDialect.cs diff --git a/src/Marr.Data/Parameters/OleDbTypeBuilder.cs b/src/Marr.Data/Parameters/OleDbTypeBuilder.cs deleted file mode 100644 index d8af140a4..000000000 --- a/src/Marr.Data/Parameters/OleDbTypeBuilder.cs +++ /dev/null @@ -1,68 +0,0 @@ -/* Copyright (C) 2008 - 2011 Jordan Marr - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 3 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . */ - -using System; -using System.Data; -using System.Data.OleDb; - -namespace Marr.Data.Parameters -{ - public class OleDbTypeBuilder : IDbTypeBuilder - { - public Enum GetDbType(Type type) - { - if (type == typeof(String)) - return OleDbType.VarChar; - - if (type == typeof(Int32)) - return OleDbType.Integer; - - if (type == typeof(Decimal)) - return OleDbType.Decimal; - - if (type == typeof(DateTime)) - return OleDbType.DBTimeStamp; - - if (type == typeof(Boolean)) - return OleDbType.Boolean; - - if (type == typeof(Int16)) - return OleDbType.SmallInt; - - if (type == typeof(Int64)) - return OleDbType.BigInt; - - if (type == typeof(Double)) - return OleDbType.Double; - - if (type == typeof(Byte)) - return OleDbType.Binary; - - if (type == typeof(Byte[])) - return OleDbType.VarBinary; - - if (type == typeof(Guid)) - return OleDbType.Guid; - - return OleDbType.Variant; - } - - public void SetDbType(IDbDataParameter param, Enum dbType) - { - var oleDbParam = (OleDbParameter)param; - oleDbParam.OleDbType = (OleDbType)dbType; - } - } -} diff --git a/src/Marr.Data/Parameters/SqlDbTypeBuilder.cs b/src/Marr.Data/Parameters/SqlDbTypeBuilder.cs deleted file mode 100644 index 39d2fdaae..000000000 --- a/src/Marr.Data/Parameters/SqlDbTypeBuilder.cs +++ /dev/null @@ -1,71 +0,0 @@ -/* Copyright (C) 2008 - 2011 Jordan Marr - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 3 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . */ - -using System; -using System.Data; -using System.Data.SqlClient; - -namespace Marr.Data.Parameters -{ - public class SqlDbTypeBuilder : IDbTypeBuilder - { - public Enum GetDbType(Type type) - { - if (type == typeof(String)) - return SqlDbType.VarChar; - - if (type == typeof(Int32)) - return SqlDbType.Int; - - if (type == typeof(Decimal)) - return SqlDbType.Decimal; - - if (type == typeof(DateTime)) - return SqlDbType.DateTime; - - if (type == typeof(Boolean)) - return SqlDbType.Bit; - - if (type == typeof(Int16)) - return SqlDbType.SmallInt; - - if (type == typeof(Int64)) - return SqlDbType.BigInt; - - if (type == typeof(Double)) - return SqlDbType.Float; - - if (type == typeof(Char)) - return SqlDbType.Char; - - if (type == typeof(Byte)) - return SqlDbType.Binary; - - if (type == typeof(Byte[])) - return SqlDbType.VarBinary; - - if (type == typeof(Guid)) - return SqlDbType.UniqueIdentifier; - - return SqlDbType.Variant; - } - - public void SetDbType(IDbDataParameter param, Enum dbType) - { - var sqlDbParam = (SqlParameter)param; - sqlDbParam.SqlDbType = (SqlDbType)dbType; - } - } -} diff --git a/src/Marr.Data/QGen/Dialects/FirebirdDialect.cs b/src/Marr.Data/QGen/Dialects/FirebirdDialect.cs deleted file mode 100644 index 49f42ab21..000000000 --- a/src/Marr.Data/QGen/Dialects/FirebirdDialect.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; - -namespace Marr.Data.QGen.Dialects -{ - public class FirebirdDialect : Dialect - { - public override string CreateToken(string token) - { - if (string.IsNullOrEmpty(token)) - { - return string.Empty; - } - - return token.Replace('[', new Char()).Replace(']', new Char()); - } - } -} diff --git a/src/Marr.Data/QGen/Dialects/OracleDialect.cs b/src/Marr.Data/QGen/Dialects/OracleDialect.cs deleted file mode 100644 index 23bc76751..000000000 --- a/src/Marr.Data/QGen/Dialects/OracleDialect.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using System.Linq; -using System.Text; - -namespace Marr.Data.QGen.Dialects -{ - public class OracleDialect : Dialect - { - public override string CreateToken(string token) - { - if (string.IsNullOrEmpty(token)) - { - return string.Empty; - } - - string[] parts = token.Replace('[', new Char()).Replace(']', new Char()).Split('.'); - - StringBuilder sb = new StringBuilder(); - foreach (string part in parts) - { - if (sb.Length > 0) - sb.Append("."); - - bool hasSpaces = part.Contains(' '); - - if (hasSpaces) - sb.Append("[").Append(part).Append("]"); - else - sb.Append(part); - } - - return sb.ToString(); - } - } -} diff --git a/src/Marr.Data/QGen/Dialects/SqlServerCeDialect.cs b/src/Marr.Data/QGen/Dialects/SqlServerCeDialect.cs deleted file mode 100644 index 355037f19..000000000 --- a/src/Marr.Data/QGen/Dialects/SqlServerCeDialect.cs +++ /dev/null @@ -1,21 +0,0 @@ -namespace Marr.Data.QGen.Dialects -{ - public class SqlServerCeDialect : Dialect - { - public override string IdentityQuery - { - get - { - return "SELECT @@IDENTITY;"; - } - } - - public override bool SupportsBatchQueries - { - get - { - return false; - } - } - } -} diff --git a/src/Marr.Data/QGen/Dialects/SqlServerDialect.cs b/src/Marr.Data/QGen/Dialects/SqlServerDialect.cs deleted file mode 100644 index 54bf61de4..000000000 --- a/src/Marr.Data/QGen/Dialects/SqlServerDialect.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace Marr.Data.QGen.Dialects -{ - public class SqlServerDialect : Dialect - { - public override string IdentityQuery - { - get - { - return "SELECT SCOPE_IDENTITY();"; - } - } - } -} diff --git a/src/Marr.Data/QGen/QueryFactory.cs b/src/Marr.Data/QGen/QueryFactory.cs index 5e1d90b9a..cc7315943 100644 --- a/src/Marr.Data/QGen/QueryFactory.cs +++ b/src/Marr.Data/QGen/QueryFactory.cs @@ -9,12 +9,6 @@ namespace Marr.Data.QGen /// internal class QueryFactory { - private const string DB_SqlClient = "System.Data.SqlClient.SqlClientFactory"; - private const string DB_OleDb = "System.Data.OleDb.OleDbFactory"; - private const string DB_SqlCeClient = "System.Data.SqlServerCe.SqlCeProviderFactory"; - private const string DB_SystemDataOracleClient = "System.Data.OracleClientFactory"; - private const string DB_OracleDataAccessClient = "Oracle.DataAccess.Client.OracleClientFactory"; - private const string DB_FireBirdClient = "FirebirdSql.Data.FirebirdClient.FirebirdClientFactory"; private const string DB_SQLiteClient = "System.Data.SQLite.SQLiteFactory"; public static IQuery CreateUpdateQuery(ColumnMapCollection columns, IDataMapper dataMapper, string target, string whereClause) @@ -47,12 +41,6 @@ namespace Marr.Data.QGen string providerString = dataMapper.ProviderFactory.ToString(); switch (providerString) { - case DB_SqlClient: - return new RowCountQueryDecorator(innerQuery); - - case DB_SqlCeClient: - return new RowCountQueryDecorator(innerQuery); - case DB_SQLiteClient: return new SqliteRowCountQueryDecorator(innerQuery); @@ -68,12 +56,6 @@ namespace Marr.Data.QGen string providerString = dataMapper.ProviderFactory.ToString(); switch (providerString) { - case DB_SqlClient: - return new PagingQueryDecorator(innerQuery, skip, take); - - case DB_SqlCeClient: - return new PagingQueryDecorator(innerQuery, skip, take); - case DB_SQLiteClient: return new SqlitePagingQueryDecorator(innerQuery, skip, take); @@ -87,21 +69,6 @@ namespace Marr.Data.QGen string providerString = dataMapper.ProviderFactory.ToString(); switch (providerString) { - case DB_SqlClient: - return new SqlServerDialect(); - - case DB_OracleDataAccessClient: - return new OracleDialect(); - - case DB_SystemDataOracleClient: - return new OracleDialect(); - - case DB_SqlCeClient: - return new SqlServerCeDialect(); - - case DB_FireBirdClient: - return new FirebirdDialect(); - case DB_SQLiteClient: return new SqliteDialect();