JoinSpec refactored

main
Inga 🏳‍🌈 15 years ago
parent ff60639109
commit b84630abc5
  1. 5
      Common/UploadManager.cs
  2. 3
      Common/dataobjects/Account.cs
  3. 3
      Common/dataobjects/AccountIndicator.cs
  4. 3
      Common/dataobjects/AccountSettings.cs
  5. 3
      Common/dataobjects/Board.cs
  6. 6
      Common/dataobjects/Category.cs
  7. 3
      Common/dataobjects/User.cs
  8. 23
      Core/DB/JoinSpec.cs

@ -105,9 +105,8 @@ namespace FLocal.Common {
Config.instance.mainConnection.LoadIdsByConditions( Config.instance.mainConnection.LoadIdsByConditions(
Upload.TableSpec.instance, Upload.TableSpec.instance,
condition, condition,
Diapasone.unlimited, Diapasone.unlimited
new JoinSpec[0] ).Single()
)[0]
) )
); );
} }

@ -81,8 +81,7 @@ namespace FLocal.Common.dataobjects {
ComparisonType.EQUAL, ComparisonType.EQUAL,
name name
), ),
Diapasone.unlimited, Diapasone.unlimited
new JoinSpec[0]
); );
if(ids.Count > 1) { if(ids.Count > 1) {
throw new CriticalException("not unique"); throw new CriticalException("not unique");

@ -72,8 +72,7 @@ namespace FLocal.Common.dataobjects {
ComparisonType.EQUAL, ComparisonType.EQUAL,
account.id.ToString() account.id.ToString()
), ),
Diapasone.unlimited, Diapasone.unlimited
new JoinSpec[0]
); );
if(ids.Count > 1) { if(ids.Count > 1) {
throw new CriticalException("not unique"); throw new CriticalException("not unique");

@ -118,8 +118,7 @@ namespace FLocal.Common.dataobjects {
ComparisonType.EQUAL, ComparisonType.EQUAL,
account.id.ToString() account.id.ToString()
), ),
Diapasone.unlimited, Diapasone.unlimited
new JoinSpec[0]
); );
if(ids.Count > 1) { if(ids.Count > 1) {
throw new CriticalException("not unique"); throw new CriticalException("not unique");

@ -156,8 +156,7 @@ namespace FLocal.Common.dataobjects {
FLocal.Core.DB.conditions.ComparisonType.EQUAL, FLocal.Core.DB.conditions.ComparisonType.EQUAL,
this.id.ToString() this.id.ToString()
), ),
Diapasone.unlimited, Diapasone.unlimited
new JoinSpec[0]
) select int.Parse(stringId); ) select int.Parse(stringId);
Board.LoadByIds(ids); Board.LoadByIds(ids);
return ids; return ids;

@ -54,8 +54,7 @@ namespace FLocal.Common.dataobjects {
IEnumerable<int> ids = from stringId in Config.instance.mainConnection.LoadIdsByConditions( IEnumerable<int> ids = from stringId in Config.instance.mainConnection.LoadIdsByConditions(
TableSpec.instance, TableSpec.instance,
new FLocal.Core.DB.conditions.EmptyCondition(), new FLocal.Core.DB.conditions.EmptyCondition(),
Diapasone.unlimited, Diapasone.unlimited
new JoinSpec[0]
) select int.Parse(stringId); ) select int.Parse(stringId);
Category.LoadByIds(ids); Category.LoadByIds(ids);
return ids; return ids;
@ -84,8 +83,7 @@ namespace FLocal.Common.dataobjects {
FLocal.Core.DB.conditions.ComparisonType.EQUAL, FLocal.Core.DB.conditions.ComparisonType.EQUAL,
this.id.ToString() this.id.ToString()
), ),
Diapasone.unlimited, Diapasone.unlimited
new JoinSpec[0]
) select int.Parse(stringId); ) select int.Parse(stringId);
Board.LoadByIds(ids); Board.LoadByIds(ids);
return ids; return ids;

@ -133,8 +133,7 @@ namespace FLocal.Common.dataobjects {
ComparisonType.EQUAL, ComparisonType.EQUAL,
name name
), ),
Diapasone.unlimited, Diapasone.unlimited
new JoinSpec[0]
); );
if(ids.Count > 1) { if(ids.Count > 1) {
throw new CriticalException("not unique"); throw new CriticalException("not unique");

@ -6,13 +6,32 @@ using System.Text;
namespace FLocal.Core.DB { namespace FLocal.Core.DB {
public class JoinSpec { public class JoinSpec {
private class TableSpec : ITableSpec {
private readonly string _name;
public TableSpec(string name) {
this._name = name;
}
public string name {
get {
return this._name;
}
}
public string idName {
get {
throw new NotImplementedException();
}
}
}
public readonly ColumnSpec mainColumn; public readonly ColumnSpec mainColumn;
public readonly ITableSpec additionalTable; public readonly ITableSpec additionalTable;
public readonly ITableSpec additionalTableJoin;
public JoinSpec(ColumnSpec mainColumn, ITableSpec additionalTable) { public JoinSpec(ColumnSpec mainColumn, ITableSpec additionalTable, string alias) {
this.mainColumn = mainColumn; this.mainColumn = mainColumn;
this.additionalTable = additionalTable; this.additionalTableJoin = additionalTable;
this.additionalTable = new TableSpec(alias);
} }
} }

Loading…
Cancel
Save