This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
View | Details | Raw Unified | Return to bug 3004
Collapse All | Expand All

(-)a/mcs/class/System.Data/Mono.Data.SqlExpressions/ColumnReference.cs (-7 / +18 lines)
 Lines 47-60   namespace Mono.Data.SqlExpressions { Link Here 
47
		string relationName, columnName;
47
		string relationName, columnName;
48
		DataColumn _cachedColumn;
48
		DataColumn _cachedColumn;
49
		DataRelation _cachedRelation;
49
		DataRelation _cachedRelation;
50
		bool cacheColumnResult = true;
50
51
51
		public ColumnReference (string columnName) : this (ReferencedTable.Self, null, columnName) {}
52
		public ColumnReference (string columnName, bool cacheColumnResult)
53
			: this (ReferencedTable.Self, null, columnName, cacheColumnResult) {}
52
54
53
		public ColumnReference (ReferencedTable refTable, string relationName, string columnName)
55
		public ColumnReference (ReferencedTable refTable, string relationName, string columnName, bool cacheColumnResult)
54
		{
56
		{
55
			this.refTable = refTable;
57
			this.refTable = refTable;
56
			this.relationName = relationName;
58
			this.relationName = relationName;
57
			this.columnName = columnName;
59
			this.columnName = columnName;
60
			this.cacheColumnResult = cacheColumnResult;
58
		}
61
		}
59
62
60
		public override bool Equals(object obj)
63
		public override bool Equals(object obj)
 Lines 131-142   namespace Mono.Data.SqlExpressions { Link Here 
131
						table = GetRelation (row).ChildTable;
134
						table = GetRelation (row).ChildTable;
132
						break;
135
						break;
133
				}
136
				}
134
				_cachedColumn = table.Columns [columnName];
137
				
135
				if (_cachedColumn == null)
138
				DataColumn temporaryColumn = table.Columns [columnName];
139
				if (temporaryColumn == null)
136
					throw new EvaluateException (String.Format ("Cannot find column [{0}].", columnName));
140
					throw new EvaluateException (String.Format ("Cannot find column [{0}].", columnName));
137
141
				
138
				_cachedColumn.PropertyChanged += new PropertyChangedEventHandler (OnColumnPropertyChanged);
142
				if (cacheColumnResult == true) {
139
				_cachedColumn.Table.Columns.CollectionChanged += new CollectionChangeEventHandler (OnColumnRemoved);
143
					_cachedColumn = temporaryColumn;
144
					_cachedColumn.PropertyChanged += new PropertyChangedEventHandler (OnColumnPropertyChanged);
145
					_cachedColumn.Table.Columns.CollectionChanged += new CollectionChangeEventHandler (OnColumnRemoved);
146
				}
147
				// If we don't want to cache column
148
				else {
149
					return temporaryColumn;
150
				}	
140
			}
151
			}
141
			return _cachedColumn;
152
			return _cachedColumn;
142
		}
153
		}
(-)a/mcs/class/System.Data/Mono.Data.SqlExpressions/Parser.jay (-7 / +13 lines)
 Lines 23-36   namespace Mono.Data.SqlExpressions { Link Here 
23
		}
23
		}
24
24
25
		bool cacheAggregationResults = false;
25
		bool cacheAggregationResults = false;
26
		bool cacheColumnResult = true;
26
		DataRow[] aggregationRows = null;
27
		DataRow[] aggregationRows = null;
27
		static int yacc_verbose_flag;
28
		static int yacc_verbose_flag;
28
		
29
		
29
		//called by DataTable.Select
30
		//called by DataTable.Select
30
		//called by DataColumn.set_Expression //FIXME: enable cache in this case?
31
		//called by DataColumn.set_Expression //FIXME: enable cache in this case?
31
		public Parser () {
32
		public Parser () : this (true) {
33
		}
34
		
35
		public Parser(bool cacheColumnResult)
36
		{
32
			ErrorOutput = System.IO.TextWriter.Null;
37
			ErrorOutput = System.IO.TextWriter.Null;
33
			cacheAggregationResults = true;
38
			cacheAggregationResults = true;
39
			this.cacheColumnResult = cacheColumnResult;
34
		}
40
		}
35
		
41
		
36
		//called by DataTable.Compute
42
		//called by DataTable.Compute
 Lines 39-45   namespace Mono.Data.SqlExpressions { Link Here 
39
			ErrorOutput = System.IO.TextWriter.Null;
45
			ErrorOutput = System.IO.TextWriter.Null;
40
			this.aggregationRows = aggregationRows;
46
			this.aggregationRows = aggregationRows;
41
		}
47
		}
42
		
48
43
		public IExpression Compile (string sqlExpr)
49
		public IExpression Compile (string sqlExpr)
44
		{
50
		{
45
			try {
51
			try {
 Lines 212-240   MultiColumnValue Link Here 
212
LocalColumnValue
218
LocalColumnValue
213
	: ColumnName
219
	: ColumnName
214
	{
220
	{
215
		$$ = new ColumnReference ((string)$1);
221
		$$ = new ColumnReference ((string)$1, cacheColumnResult);
216
	}
222
	}
217
	;
223
	;
218
224
219
ParentColumnValue
225
ParentColumnValue
220
	: PARENT DOT ColumnName
226
	: PARENT DOT ColumnName
221
	{
227
	{
222
		$$ = new ColumnReference (ReferencedTable.Parent, null, (string)$3);
228
		$$ = new ColumnReference (ReferencedTable.Parent, null, (string)$3, cacheColumnResult);
223
	}
229
	}
224
	| PARENT PAROPEN RelationName PARCLOSE DOT ColumnName
230
	| PARENT PAROPEN RelationName PARCLOSE DOT ColumnName
225
	{
231
	{
226
		$$ = new ColumnReference (ReferencedTable.Parent, (string)$3, (string)$6);
232
		$$ = new ColumnReference (ReferencedTable.Parent, (string)$3, (string)$6, cacheColumnResult);
227
	}
233
	}
228
	;
234
	;
229
235
230
ChildColumnValue
236
ChildColumnValue
231
	: CHILD DOT ColumnName
237
	: CHILD DOT ColumnName
232
	{
238
	{
233
		$$ = new ColumnReference (ReferencedTable.Child, null, (string)$3);
239
		$$ = new ColumnReference (ReferencedTable.Child, null, (string)$3, cacheColumnResult);
234
	}
240
	}
235
	| CHILD PAROPEN RelationName PARCLOSE DOT ColumnName
241
	| CHILD PAROPEN RelationName PARCLOSE DOT ColumnName
236
	{
242
	{
237
		$$ = new ColumnReference (ReferencedTable.Child, (string)$3, (string)$6);
243
		$$ = new ColumnReference (ReferencedTable.Child, (string)$3, (string)$6, cacheColumnResult);
238
	}
244
	}
239
	;
245
	;
240
	
246
	
(-)a/mcs/class/System.Data/System.Data/DataTable.cs (-1 / +1 lines)
 Lines 1385-1391   namespace System.Data { Link Here 
1385
1385
1386
			IExpression filter = null;
1386
			IExpression filter = null;
1387
			if (filterExpression != String.Empty) {
1387
			if (filterExpression != String.Empty) {
1388
				Parser parser = new Parser ();
1388
				Parser parser = new Parser (false);
1389
				filter = parser.Compile (filterExpression);
1389
				filter = parser.Compile (filterExpression);
1390
			}
1390
			}
1391
1391

Return to bug 3004