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(
Upload.TableSpec.instance,
condition,
Diapasone.unlimited,
new JoinSpec[0]
)[0]
Diapasone.unlimited
).Single()
)
);
}

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

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

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

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

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

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

@ -6,13 +6,32 @@ using System.Text;
namespace FLocal.Core.DB {
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 ITableSpec additionalTable;
public readonly ITableSpec additionalTableJoin;
public JoinSpec(ColumnSpec mainColumn, ITableSpec additionalTable) {
public JoinSpec(ColumnSpec mainColumn, ITableSpec additionalTable, string alias) {
this.mainColumn = mainColumn;
this.additionalTable = additionalTable;
this.additionalTableJoin = additionalTable;
this.additionalTable = new TableSpec(alias);
}
}

Loading…
Cancel
Save