You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1.0 KiB
32 lines
1.0 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace FLocal.Core.DB {
|
|
interface IDBConnection {
|
|
|
|
Dictionary<string, string> LoadById(ITableSpec table, int id);
|
|
Dictionary<string, string>[] LoadByIds(ITableSpec table, int[] ids);
|
|
|
|
int[] LoadIdsByConditions(ITableSpec table, conditions.AbstractCondition conditions, Diapasone diapasone, JoinSpec[] joins, SortSpec[] sorts);
|
|
|
|
ILock lockTable(ITableSpec table);
|
|
|
|
ILock lockRow(ITableSpec table, int id);
|
|
|
|
void update(ITableSpec table, int id, Dictionary<string, string> data);
|
|
|
|
void delete(ITableSpec table, int id); //do we really need this?
|
|
|
|
}
|
|
|
|
static class IDBConnectionExtensions {
|
|
|
|
public static int[] LoadIdsByConditions(this IDBConnection connection, ITableSpec table, conditions.AbstractCondition conditions, Diapasone diapasone, params JoinSpec[] joins) {
|
|
return connection.LoadIdsByConditions(table, conditions, diapasone, joins, new SortSpec[] { new SortSpec(table.getIdSpec(), true) });
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|