[Mono-dev] Patch for System.Data.Mono.Data.ColumnExpression
T Senganal
tsenganal at novell.com
Wed Jan 11 12:02:56 EST 2006
Hi
>@@ -44,6 +44,8 @@
> internal class ColumnReference : BaseExpression {
> ReferencedTable refTable;
> string relationName, columnName;
>+ DataColumn _cachedColumn;
>+ DataRelation _cachedRelation;
can cache the column ordinal instead of the column. we only need a way
to index the row.
>+ public override void Initialize(DataTable table) {
>+ switch (refTable) {
>+ case ReferencedTable.Parent:
>+ _cachedRelation =
GetRelation(table);
>+ table =
_cachedRelation.ParentTable;
>+ break;
>+ case ReferencedTable.Child:
>+ _cachedRelation =
GetRelation(table);
>+ table =
_cachedRelation.ChildTable;
>+ break;
>+ }
>+
>+ _cachedColumn = table.Columns[columnName];
>+ if (_cachedColumn == null)
>+ throw new EvaluateException
(String.Format ("Cannot find column [{0}].", columnName));
>+ }
hmm..instead of explicitly calling initialize, should invoke it from
within the class on first use of the expression.
that way, we don't have to remember to explicitly call init everytime
the expression is modfied/reset..
seems to be a cleaner way. also, values are cached only if required.
Regards
Senga
More information about the Mono-devel-list
mailing list