18 using System.Collections.Generic;
24 namespace Deveel.Data.Sql.Tables {
31 foreach (var row
in rows) {
56 return new Row(table);
60 return Delete(table, t, -1);
64 List<int> rowSet =
new List<int>(other.
RowCount);
65 var e = other.GetEnumerator();
66 while (e.MoveNext()) {
67 rowSet.Add(e.Current.RowId.RowNumber);
73 int firstColumn = other.IndexOfColumn(table.GetResolvedColumnName(0));
75 if (firstColumn == -1)
79 var rowsToDelete = other.ResolveRows(firstColumn, rowSet, table).ToList();
87 limit = Int32.MaxValue;
91 int len =
System.Math.Min(rowsToDelete.Count, limit);
94 for (
int i = 0; i < len; ++i) {
95 int toRemove = rowsToDelete[i];
96 if (toRemove < lastRemoved)
99 if (toRemove != lastRemoved) {
101 lastRemoved = toRemove;
114 var list = table.SelectRowsEqual(columnOffset, value).ToArray();
115 if (list.Length == 0)
122 IEnumerable<SqlAssignExpression> assignList,
int limit) {
125 var rowSet =
new List<int>();
126 var e = table.GetEnumerator();
127 while (e.MoveNext()) {
128 rowSet.Add(e.Current.RowId.RowNumber);
134 int firstColumn = table.FindColumn(mutableTable.GetResolvedColumnName(0));
135 if (firstColumn == -1)
136 throw new InvalidOperationException(
"Search table does not contain any " +
137 "reference to table being updated from");
140 rowSet = table.ResolveRows(firstColumn, rowSet, mutableTable).ToList();
146 limit = Int32.MaxValue;
149 int len =
System.Math.Min(rowSet.Count, limit);
152 for (
int i = 0; i < len; ++i) {
153 int toUpdate = rowSet[i];
157 var row = mutableTable.GetRow(toUpdate);
161 foreach (var assignment
in assignList) {
162 row.EvaluateAssignment(assignment, context);
static bool RemoveRow(this IMutableTable table, int rowIndex)
Defines the contract to access the data contained into a table of a database.
static int Delete(this IMutableTable table, ITable other, int limit)
static void DeleteRows(this IMutableTable table, IEnumerable< int > rows)
static int Update(this IMutableTable mutableTable, IQuery context, ITable table, IEnumerable< SqlAssignExpression > assignList, int limit)
int Id
Gets a unique identifier of the table in a database system.
Exception thrown where various problems occur within the database.
A single row in a table of a database.
static bool Delete(this IMutableTable table, int columnOffset, DataObject value)
void UpdateRow(Row row)
Updates the values of a row into the table.
Represents a dynamic object that encapsulates a defined SqlType and a compatible constant ISqlObject ...
TableInfo TableInfo
Gets the metadata information of the table, used to resolve the column sources.
int RowCount
Gets the total number of rows in the table.
Defines the value of a ROWID object, that is a unique reference within a database system to a single ...
static int Delete(this IMutableTable table, ITable t)
bool RemoveRow(RowId rowId)
Deletes row identified by the given coordinates from the table.
void AssertConstraints()
Performs all constraint integrity checks and actions to any modifications based on any changes that h...
static Row NewRow(this IMutableTable table)
Creates a new row that is compatible with the table context, ready to be populated and added...
An interface that defines contracts to alter the contents of a table.