Skip to content

Commit

Permalink
Renamed BasePhrase to IPhrase
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgindi committed Sep 12, 2014
1 parent 459cb0a commit 8ffa9f6
Show file tree
Hide file tree
Showing 36 changed files with 49 additions and 49 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Structure of this library
* `FactoryBase` is a special base class which is responsible for creating special objects like `DbCommand`s and `DbDataAdapter`s. Each connector has a subclass of this class.
* `AbstractRecord` is a DAL class that represents your data, and contains a `TableSchema`, data accessors, and helper functions. Using `AbstractRecord` is completely optional!
* `TableSchema` is a class representing the an actual db schema. This assists the `Query` in converting values where necessary, bulding queries or even building `CREATE TABLE`, `ALTER TABLE` and `CREATE INDEX` queries...
* There's a namespace `Phrases` which includes many objects that wrap native sql functions. You can add your own, based on the `BasePhrase` class.
* There's a namespace `Phrases` which includes many objects that wrap native sql functions. You can add your own, based on the `IPhrase` class.

Bonus
-----
Expand Down
4 changes: 2 additions & 2 deletions dg.Sql/Connector/ConnectorBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,9 @@ public virtual string PrepareValue(object Value)
{ // Must be formatted specifically, to avoid decimal separator confusion
return PrepareValue((double)Value);
}
else if (Value is dg.Sql.BasePhrase)
else if (Value is dg.Sql.IPhrase)
{
return ((dg.Sql.BasePhrase)Value).BuildPhrase(this);
return ((dg.Sql.IPhrase)Value).BuildPhrase(this);
}
else if (Value is dg.Sql.Geometry)
{
Expand Down
2 changes: 1 addition & 1 deletion dg.Sql/Sql/Phrases/DateTime/DateTimeAdd.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace dg.Sql.Phrases
{
public class DateTimeAdd : BasePhrase
public class DateTimeAdd : IPhrase
{
string TableName;
object Object;
Expand Down
2 changes: 1 addition & 1 deletion dg.Sql/Sql/Phrases/DateTime/Day.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace dg.Sql.Phrases
{
public class Day : BasePhrase
public class Day : IPhrase
{
string TableName;
object Object;
Expand Down
2 changes: 1 addition & 1 deletion dg.Sql/Sql/Phrases/DateTime/Hour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace dg.Sql.Phrases
{
public class Hour : BasePhrase
public class Hour : IPhrase
{
string TableName;
object Object;
Expand Down
2 changes: 1 addition & 1 deletion dg.Sql/Sql/Phrases/DateTime/Minute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace dg.Sql.Phrases
{
public class Minute : BasePhrase
public class Minute : IPhrase
{
string TableName;
object Object;
Expand Down
2 changes: 1 addition & 1 deletion dg.Sql/Sql/Phrases/DateTime/Month.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace dg.Sql.Phrases
{
public class Month : BasePhrase
public class Month : IPhrase
{
string TableName;
object Object;
Expand Down
2 changes: 1 addition & 1 deletion dg.Sql/Sql/Phrases/DateTime/Second.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace dg.Sql.Phrases
{
public class Second : BasePhrase
public class Second : IPhrase
{
string TableName;
object Object;
Expand Down
2 changes: 1 addition & 1 deletion dg.Sql/Sql/Phrases/DateTime/UTC_TIMESTAMP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace dg.Sql.Phrases
{
public class UTC_TIMESTAMP : BasePhrase
public class UTC_TIMESTAMP : IPhrase
{
public UTC_TIMESTAMP()
{
Expand Down
2 changes: 1 addition & 1 deletion dg.Sql/Sql/Phrases/DateTime/Year.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace dg.Sql.Phrases
{
public class Year : BasePhrase
public class Year : IPhrase
{
string TableName;
object Object;
Expand Down
2 changes: 1 addition & 1 deletion dg.Sql/Sql/Phrases/General/IfNull.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace dg.Sql.Phrases
{
public class IfNull : BasePhrase
public class IfNull : IPhrase
{
string FirstTableName;
object FirstObject;
Expand Down
2 changes: 1 addition & 1 deletion dg.Sql/Sql/Phrases/General/RandPerRow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace dg.Sql.Phrases
{
public class RandWeight : BasePhrase
public class RandWeight : IPhrase
{
string TableName;
string Object;
Expand Down
2 changes: 1 addition & 1 deletion dg.Sql/Sql/Phrases/General/Union.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace dg.Sql.Phrases
{
public class Union : BasePhrase
public class Union : IPhrase
{
Query[] Queries;

Expand Down
2 changes: 1 addition & 1 deletion dg.Sql/Sql/Phrases/General/UnionAll.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace dg.Sql.Phrases
{
public class UnionAll : BasePhrase
public class UnionAll : IPhrase
{
Query[] Queries;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace dg.Sql
{
public interface BasePhrase
public interface IPhrase
{
string BuildPhrase(dg.Sql.Connector.ConnectorBase Connection);
}
Expand Down
2 changes: 1 addition & 1 deletion dg.Sql/Sql/Phrases/Math/Round.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace dg.Sql.Phrases
{
public class Round : BasePhrase
public class Round : IPhrase
{
string TableName;
object Object;
Expand Down
2 changes: 1 addition & 1 deletion dg.Sql/Sql/Phrases/Quantitative/Add.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace dg.Sql.Phrases
{
public class Add : BasePhrase
public class Add : IPhrase
{
string TableName1;
object Object1;
Expand Down
2 changes: 1 addition & 1 deletion dg.Sql/Sql/Phrases/Quantitative/Aggregate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace dg.Sql.Phrases
{
public class PassThroughAggregate : BasePhrase
public class PassThroughAggregate : IPhrase
{
string TableName;
object Object;
Expand Down
2 changes: 1 addition & 1 deletion dg.Sql/Sql/Phrases/Quantitative/Avg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace dg.Sql.Phrases
{
public class Avg : BasePhrase
public class Avg : IPhrase
{
string TableName;
object Object;
Expand Down
2 changes: 1 addition & 1 deletion dg.Sql/Sql/Phrases/Quantitative/Count.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace dg.Sql.Phrases
{
public class Count : BasePhrase
public class Count : IPhrase
{
string TableName;
object Object;
Expand Down
2 changes: 1 addition & 1 deletion dg.Sql/Sql/Phrases/Quantitative/Max.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace dg.Sql.Phrases
{
public class Max : BasePhrase
public class Max : IPhrase
{
string TableName;
object Object;
Expand Down
2 changes: 1 addition & 1 deletion dg.Sql/Sql/Phrases/Quantitative/Min.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace dg.Sql.Phrases
{
public class Min : BasePhrase
public class Min : IPhrase
{
string TableName;
object Object;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace dg.Sql.Phrases
{
public class StandardDeviationOfPopulation : BasePhrase
public class StandardDeviationOfPopulation : IPhrase
{
string TableName;
object Object;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace dg.Sql.Phrases
{
public class StandardDeviationOfSample : BasePhrase
public class StandardDeviationOfSample : IPhrase
{
string TableName;
object Object;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace dg.Sql.Phrases
{
public class StandardVarianceOfPopulation : BasePhrase
public class StandardVarianceOfPopulation : IPhrase
{
string TableName;
object Object;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace dg.Sql.Phrases
{
public class StandardVarianceOfSample : BasePhrase
public class StandardVarianceOfSample : IPhrase
{
string TableName;
object Object;
Expand Down
2 changes: 1 addition & 1 deletion dg.Sql/Sql/Phrases/Quantitative/Sum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace dg.Sql.Phrases
{
public class Sum : BasePhrase
public class Sum : IPhrase
{
string TableName;
object Object;
Expand Down
2 changes: 1 addition & 1 deletion dg.Sql/Sql/Phrases/Spatial/GeographyContains.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace dg.Sql.Phrases
{
public class GeographyContains : BasePhrase
public class GeographyContains : IPhrase
{
string ContainingTableName;
object ContainingObject;
Expand Down
2 changes: 1 addition & 1 deletion dg.Sql/Sql/Phrases/Spatial/GeographyDistance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace dg.Sql.Phrases
/// TY = To longitude
/// D = 2R * ASIN(SQRT(POWER(SIN((FX-TX) * PI/360), 2) + COS(FX * PI/180) * COS(TX * PI/180) * POWER(SIN((FY - TY) * PI/360), 2)))
/// </summary>
public class GeographyDistance : BasePhrase
public class GeographyDistance : IPhrase
{
string ContainingTableName;
string ContainingLatitudeColumnName;
Expand Down
2 changes: 1 addition & 1 deletion dg.Sql/Sql/Phrases/Strings/Lower.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace dg.Sql.Phrases
{
public class Lower : BasePhrase
public class Lower : IPhrase
{
string TableName;
object Object;
Expand Down
2 changes: 1 addition & 1 deletion dg.Sql/Sql/Phrases/Strings/Replace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace dg.Sql.Phrases
{
public class Replace : BasePhrase
public class Replace : IPhrase
{
string Source;
string SourceTableName;
Expand Down
2 changes: 1 addition & 1 deletion dg.Sql/Sql/Phrases/Strings/Upper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace dg.Sql.Phrases
{
public class Upper : BasePhrase
public class Upper : IPhrase
{
string TableName;
object Object;
Expand Down
24 changes: 12 additions & 12 deletions dg.Sql/Sql/Query/Builders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ private void BuildOrderBy(StringBuilder sb, ConnectorBase connection, bool inver
}
if (orderBy.IsLiteral)
{
if (orderBy.ColumnName is dg.Sql.BasePhrase)
if (orderBy.ColumnName is dg.Sql.IPhrase)
{
sb.Append(((dg.Sql.BasePhrase)orderBy.ColumnName).BuildPhrase(connection));
sb.Append(((dg.Sql.IPhrase)orderBy.ColumnName).BuildPhrase(connection));
}
else sb.Append(orderBy.ColumnName);
}
Expand Down Expand Up @@ -169,9 +169,9 @@ private void BuildGroupBy(StringBuilder sb, ConnectorBase connection, bool inver

if (groupBy.IsLiteral)
{
if (groupBy.ColumnName is dg.Sql.BasePhrase)
if (groupBy.ColumnName is dg.Sql.IPhrase)
{
sb.Append(((dg.Sql.BasePhrase)groupBy.ColumnName).BuildPhrase(connection));
sb.Append(((dg.Sql.IPhrase)groupBy.ColumnName).BuildPhrase(connection));
}
else sb.Append(groupBy.ColumnName);
}
Expand Down Expand Up @@ -966,9 +966,9 @@ public string BuildCommand(ConnectorBase connection)
else
{
sb.Append(@"(");
if (_FromExpression is dg.Sql.BasePhrase)
if (_FromExpression is dg.Sql.IPhrase)
{
sb.Append(((dg.Sql.BasePhrase)_FromExpression).BuildPhrase(connection));
sb.Append(((dg.Sql.IPhrase)_FromExpression).BuildPhrase(connection));
}
else sb.Append(_FromExpression);
sb.Append(@") ");
Expand Down Expand Up @@ -1714,9 +1714,9 @@ private void BuildSelectForMsSqlPaging(StringBuilder sb, ConnectorBase connectio
else
{
sb.Append(@"(");
if (_FromExpression is dg.Sql.BasePhrase)
if (_FromExpression is dg.Sql.IPhrase)
{
sb.Append(((dg.Sql.BasePhrase)_FromExpression).BuildPhrase(connection));
sb.Append(((dg.Sql.IPhrase)_FromExpression).BuildPhrase(connection));
}
else sb.Append(_FromExpression);
sb.Append(@") ");
Expand Down Expand Up @@ -1858,9 +1858,9 @@ private void BuildSelectForMsAccessOffset(StringBuilder sb, ConnectorBase connec
else
{
sb.Append(@"(");
if (_FromExpression is dg.Sql.BasePhrase)
if (_FromExpression is dg.Sql.IPhrase)
{
sb.Append(((dg.Sql.BasePhrase)_FromExpression).BuildPhrase(connection));
sb.Append(((dg.Sql.IPhrase)_FromExpression).BuildPhrase(connection));
}
else sb.Append(_FromExpression);
sb.Append(@") ");
Expand Down Expand Up @@ -1989,9 +1989,9 @@ private void BuildSelectForMsAccessLimitOffset(StringBuilder sb, ConnectorBase c
else
{
sb.Append(@"(");
if (_FromExpression is dg.Sql.BasePhrase)
if (_FromExpression is dg.Sql.IPhrase)
{
sb.Append(((dg.Sql.BasePhrase)_FromExpression).BuildPhrase(connection));
sb.Append(((dg.Sql.IPhrase)_FromExpression).BuildPhrase(connection));
}
else sb.Append(_FromExpression);
sb.Append(@") ");
Expand Down
4 changes: 2 additions & 2 deletions dg.Sql/Sql/Query/Query.cs
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,9 @@ public static void PrepareColumnValue(TableSchema.Column ColumnDefinition, objec
}
catch { }
}
else if (Value is dg.Sql.BasePhrase)
else if (Value is dg.Sql.IPhrase)
{
OutputBuilder.Append(((dg.Sql.BasePhrase)Value).BuildPhrase(Connection));
OutputBuilder.Append(((dg.Sql.IPhrase)Value).BuildPhrase(Connection));
return;
}
}
Expand Down
2 changes: 1 addition & 1 deletion dg.Sql/Sql/Query/Wheres.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public Query AddWhere(WhereCondition condition, string literalExpression)
{
return Where(new Where(condition, literalExpression, ValueObjectType.Literal, WhereComparision.None, null, ValueObjectType.Literal), false);
}
public Query AddWhere(WhereCondition condition, BasePhrase phrase)
public Query AddWhere(WhereCondition condition, IPhrase phrase)
{
return Where(new Where(condition, phrase, ValueObjectType.Value, WhereComparision.None, null, ValueObjectType.Literal), false);
}
Expand Down
2 changes: 1 addition & 1 deletion dg.Sql/dg.Sql.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
<Reference Include="System.XML" />
</ItemGroup>
<ItemGroup>
<Compile Include="Sql\Phrases\Base.cs" />
<Compile Include="Sql\Phrases\IPhrase.cs" />
<Compile Include="Bindable\BindableCollection.cs" />
<Compile Include="Bindable\BindableList.cs" />
<Compile Include="Bindable\IBindableCollection.cs" />
Expand Down

0 comments on commit 8ffa9f6

Please sign in to comment.