Removed unused dialects from Marr so it compiles with less dependencies.
This commit is contained in:
parent
b86cfd49ef
commit
8da6f7d7f4
|
@ -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 <http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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 <http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
namespace Marr.Data.QGen.Dialects
|
|
||||||
{
|
|
||||||
public class SqlServerDialect : Dialect
|
|
||||||
{
|
|
||||||
public override string IdentityQuery
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return "SELECT SCOPE_IDENTITY();";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -9,12 +9,6 @@ namespace Marr.Data.QGen
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class QueryFactory
|
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";
|
private const string DB_SQLiteClient = "System.Data.SQLite.SQLiteFactory";
|
||||||
|
|
||||||
public static IQuery CreateUpdateQuery(ColumnMapCollection columns, IDataMapper dataMapper, string target, string whereClause)
|
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();
|
string providerString = dataMapper.ProviderFactory.ToString();
|
||||||
switch (providerString)
|
switch (providerString)
|
||||||
{
|
{
|
||||||
case DB_SqlClient:
|
|
||||||
return new RowCountQueryDecorator(innerQuery);
|
|
||||||
|
|
||||||
case DB_SqlCeClient:
|
|
||||||
return new RowCountQueryDecorator(innerQuery);
|
|
||||||
|
|
||||||
case DB_SQLiteClient:
|
case DB_SQLiteClient:
|
||||||
return new SqliteRowCountQueryDecorator(innerQuery);
|
return new SqliteRowCountQueryDecorator(innerQuery);
|
||||||
|
|
||||||
|
@ -68,12 +56,6 @@ namespace Marr.Data.QGen
|
||||||
string providerString = dataMapper.ProviderFactory.ToString();
|
string providerString = dataMapper.ProviderFactory.ToString();
|
||||||
switch (providerString)
|
switch (providerString)
|
||||||
{
|
{
|
||||||
case DB_SqlClient:
|
|
||||||
return new PagingQueryDecorator(innerQuery, skip, take);
|
|
||||||
|
|
||||||
case DB_SqlCeClient:
|
|
||||||
return new PagingQueryDecorator(innerQuery, skip, take);
|
|
||||||
|
|
||||||
case DB_SQLiteClient:
|
case DB_SQLiteClient:
|
||||||
return new SqlitePagingQueryDecorator(innerQuery, skip, take);
|
return new SqlitePagingQueryDecorator(innerQuery, skip, take);
|
||||||
|
|
||||||
|
@ -87,21 +69,6 @@ namespace Marr.Data.QGen
|
||||||
string providerString = dataMapper.ProviderFactory.ToString();
|
string providerString = dataMapper.ProviderFactory.ToString();
|
||||||
switch (providerString)
|
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:
|
case DB_SQLiteClient:
|
||||||
return new SqliteDialect();
|
return new SqliteDialect();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue