/// <summary> /// Asynchronously generates a single repeater item for a query row /// </summary> /// <param name="definition">The repeater definition</param> /// <param name="sectionType">The section type</param> /// <param name="filter">The report filter</param> /// <param name="row">The query row</param> /// <returns>The repeater item generated</returns> private async Task <RepeaterItem> GenerateItemAsync ( RepeaterDefinition definition, ReportSectionType sectionType, ReportFilter filter, QueryRow row ) { var value = definition.Binding.Resolve(row); var action = default(ReportAction); if (definition.Action != null) { action = definition.Action.Resolve(row); } var nestedComponents = await GenerateNestedComponentsAsync ( definition, sectionType, filter, row ); return(new RepeaterItem ( value, action, nestedComponents )); }
/// <summary> /// Executes SQL query. /// </summary> /// <param name="options"></param> public void executeSql(string options) { lock (_locker) { var args = JsonHelper.Deserialize <List <string> >(options); var callbackId = args[3]; try { var connectionId = int.Parse(args[0]); var query = args[1]; var queryParams = string.IsNullOrEmpty(args[2]) ? new object[0] : JsonHelper.Deserialize <object[]>(args[2]); var resultSet = new SqlResultSet(); foreach (var row in _dbConnections[connectionId].Query2(query, queryParams)) { var resultRow = new QueryRow(); resultRow.AddRange(row.column.Select(column => new QueryColumn(column.Key, column.Value))); resultSet.Rows.Add(resultRow); } resultSet.InsertId = SQLite3.LastInsertRowid(_dbConnections[connectionId].Handle); resultSet.RowsAffected = SQLite3.Changes(_dbConnections[connectionId].Handle); DispatchCommandResult(new PluginResult(PluginResult.Status.OK, resultSet), callbackId); } catch (Exception ex) { DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, new SQliteError(ex)), callbackId); } } }
/// <summary> /// Adds the column to DB object. /// </summary> /// <param name="columns">The columns.</param> /// <param name="t">The t.</param> /// <param name="row">The row.</param> protected void AddColumnToDBObject(QueryRow row, DBObject t) { Column toAdd = new Column(); ObjectBuilder.SetFieldData(_dstore, row, toAdd); t.Columns.Add(toAdd); }
/// <summary> /// Compiles the parameter values for the parameter bindings /// </summary> /// <param name="filter">The report filter</param> /// <param name="row">The query row</param> /// <returns>A dictionary of parameter values</returns> protected Dictionary <string, object> CompileParameterValues ( ReportFilter filter, QueryRow row ) { Validate.IsNotNull(filter); Validate.IsNotNull(row); var parameterOverrides = new Dictionary <string, object>(); foreach (var parameterBinding in this.ParameterBindings) { var value = parameterBinding.Binding.Resolve ( row ); parameterOverrides.Add ( parameterBinding.ParameterName, value ); } return(parameterOverrides); }
/// <summary> /// Resolves the math expression for a query row /// </summary> /// <param name="row">The query row</param> /// <returns>The resolved value</returns> private object ResolveMathExpression ( QueryRow row ) { var expression = ResolveTemplateContent ( row ); var evaluator = ReportrEngine.MathEvaluator; if (evaluator == null) { throw new InvalidOperationException ( "The math expression evaluator has not been configured." ); } return(evaluator.Evaluate ( expression )); }
public IEnumerable <QueryRow> RegularQuery(QueryOptions options) { var optionsCopy = options.Copy(); // Needed because Count() and ElementAt() will share this var filter = optionsCopy.Filter; var limit = Int32.MaxValue; var skip = 0; if (filter != null) { // If a filter is present, these need to be applied to the filter // and not the query limit = optionsCopy.Limit; skip = optionsCopy.Skip; optionsCopy.Limit = Int32.MaxValue; optionsCopy.Skip = 0; } var enumerator = QueryEnumeratorWithOptions(optionsCopy); foreach (var next in enumerator) { var key = CouchbaseBridge.DeserializeKey <object>(next.Key); var value = (next.Value as IEnumerable <byte>).ToArray(); var docRevision = default(RevisionInternal); if (value.Length == 1 && value[0] == 42) { docRevision = _dbStorage.GetDocument(next.DocID, null, true); } else { docRevision = _dbStorage.GetDocument(next.DocID, null, optionsCopy.IncludeDocs); } var row = new QueryRow(next.DocID, next.DocSequence, key, value, docRevision, this); if (filter != null) { if (!filter(row)) { continue; } if (skip > 0) { skip--; continue; } if (limit-- == 0) { yield break; } } Log.To.Query.V(Tag, "Query {0} found row with key={1}, value={2}, id={3}", Name, new SecureLogJsonString(key, LogMessageSensitivity.PotentiallyInsecure), new SecureLogString(value, LogMessageSensitivity.PotentiallyInsecure), new SecureLogString(next.DocID, LogMessageSensitivity.PotentiallyInsecure)); yield return(row); } }
public SqlRecord(string type, QueryRow queryRow) : base(type) { foreach (var column in queryRow.GetColumnNames()) { SetField(column, queryRow.GetField(column)); } }
private static QueryRow ReadResultSetRow(Dictionary <string, object> reader) { var row = new QueryRow(); foreach (var kv in reader) { row.Add(new QueryColumn(kv.Key, kv.Value)); } return(row); }
private void Map(IDictionary <string, object> doc, EmitDelegate emit) { var mapFunction = (Func <QueryRow, bool>)_where.Compile(); var selectFunction = _select.Compile(); var fakeRow = new QueryRow(doc.CblID(), doc.GetCast <long>("_local_seq"), null, null, new RevisionInternal(doc), null); if (mapFunction(fakeRow)) { emit(selectFunction.DynamicInvoke(fakeRow), null); } }
private static QueryRow ReadResultSetRow(DbDataReader reader) { var row = new QueryRow(); for (int i = 0; i < reader.FieldCount; i++) { row.Add(new QueryColumn(reader.GetName(i), reader.GetValue(i))); } return(row); }
/// <summary> /// Resolves the data binding value using a query row /// </summary> /// <typeparam name="T">The value type to resolve</typeparam> /// <param name="row">The query row</param> /// <returns>The resolved value as the type specified</returns> public T Resolve <T> ( QueryRow row ) { var rawValue = Resolve(row); return(new ObjectConverter <T>().Convert ( rawValue )); }
private void GenerateRowsFromReader() { _rows.Clear(); while (_reader.Read()) { var row = new QueryRow(); for (int i = 0; i < _reader.FieldCount; i++) { row.AddField(_reader.GetName(i), _reader[i]); } _rows.Add(row); } }
/// <exception cref="Couchbase.Lite.CouchbaseLiteException"></exception> public virtual void TestViewReducePerformance() { long startMillis = Runtime.CurrentTimeMillis(); Query query = database.GetView("vacant").CreateQuery(); query.SetMapOnly(false); QueryEnumerator rowEnum = query.Run(); QueryRow row = rowEnum.GetRow(0); Log.V("PerformanceStats", Tag + ":testViewReducePerformance," + Sharpen.Extensions.ValueOf (Runtime.CurrentTimeMillis() - startMillis).ToString() + "," + GetNumberOfDocuments ()); }
List <QueryRow> GetSelectedRows() { List <QueryRow> list = new List <QueryRow>(); for (int i = 0, n = queryRows.Count; i < n; i++) { QueryRow qr = queryRows[i]; if (dataGrid1.SelectedItems.Contains(qr)) { list.Add(qr); } } return(list); }
/// <summary> /// Returns a Datatype name string for sql, i.e. varchar(20) /// </summary> /// <param name="column"></param> /// <param name="row"></param> /// <returns></returns> protected virtual string GetDataTypeString(QueryRow column) { string toReturn = ""; string len = column.GetDataForRowField("ColumnLength").ToString(); if (!string.IsNullOrEmpty(len)) { toReturn = string.Format("{0}({1})", column.GetDataForRowField("DataType"), column.GetDataForRowField("ColumnLength")); } else { toReturn = column.GetDataForRowField("DataType").ToString(); } return(toReturn); }
/// <summary> /// Resolves the data binding value using a query row /// </summary> /// <param name="row">The query row</param> /// <returns>The resolved value</returns> public object Resolve ( QueryRow row ) { Validate.IsNotNull(row); switch (this.BindingType) { case DataBindingType.TemplateContent: return(ResolveTemplateContent(row)); case DataBindingType.MathExpression: return(ResolveMathExpression(row)); default: return(ResolveQueryPath(row)); } }
static public QueryRow GetQueryRow(DataRow row) { QueryRow q = new QueryRow(); if (!(row["Field"] is DBNull)) { q.Field = (Field)row["Field"]; } if (!(row["Operation"] is DBNull)) { q.Operation = (Operation)row["Operation"]; } q.Value = row["Value"] as string; if (!(row["Conjunction"] is DBNull)) { q.Conjunction = (Conjunction)row["Conjunction"]; } return(q); }
private QueryRow CreateReducedRow(object key, bool group, int groupLevel, ReduceDelegate reduce, Func <QueryRow, bool> filter, IList <object> keysToReduce, IList <object> valsToReduce) { try { var row = new QueryRow(null, 0, group ? GroupKey(key, groupLevel) : null, CallReduce(reduce, keysToReduce, valsToReduce), null, this); if (filter != null && filter(row)) { row = null; } return(row); } catch (CouchbaseLiteException) { Log.To.Query.E(Tag, "Failed to run reduce query for {0}, rethrowing...", Name); throw; } catch (Exception e) { throw Misc.CreateExceptionAndLog(Log.To.Query, e, Tag, "Exception while running reduce query for {0}", Name); } }
public static QueryRow[] ReadQuery(XmlReader r) { ArrayList list = new ArrayList(); if (r.IsEmptyElement) { return(null); } while (r.Read() && !r.EOF && r.NodeType != XmlNodeType.EndElement) { if (r.NodeType == XmlNodeType.Element) { if (r.Name == "QueryRow") { list.Add(QueryRow.ReadQuery(r)); } } } return((QueryRow[])list.ToArray(typeof(QueryRow))); }
public override void WillUseCell(CBLUITableSource source, UITableViewCell cell, QueryRow row) { if (backgroundColor == null) { var image = UIImage.FromBundle ("item_background"); backgroundColor = UIColor.FromPatternImage (image); } cell.BackgroundColor = backgroundColor; cell.SelectionStyle = UITableViewCellSelectionStyle.Gray; cell.TextLabel.Font = UIFont.FromName ("Helvetica", 18f); cell.TextLabel.BackgroundColor = UIColor.Clear; var props = row.Value as NSDictionary; var isChecked = ((NSNumber)props.ValueForKey ((NSString)RootViewController.CheckboxPropertyName)).BoolValue; cell.TextLabel.TextColor = isChecked ? UIColor.Gray : UIColor.Black; cell.ImageView.Image = UIImage.FromBundle (isChecked ? "list_area___checkbox___checked" : "list_area___checkbox___unchecked"); }
/// <exception cref="Couchbase.Lite.CouchbaseLiteException"></exception> public virtual void TestViewQueryPerformance() { long startMillis = Runtime.CurrentTimeMillis(); Query query = database.GetView("vacant").CreateQuery(); query.SetDescending(false); query.SetMapOnly(true); QueryEnumerator rowEnum = query.Run(); object key; object value; while (rowEnum.HasNext()) { QueryRow row = rowEnum.Next(); key = (string)row.GetKey(); value = (bool)row.GetValue(); } Log.V("PerformanceStats", Tag + ":testViewQueryPerformance," + Sharpen.Extensions.ValueOf (Runtime.CurrentTimeMillis() - startMillis).ToString() + "," + GetNumberOfDocuments ()); }
/// <summary> /// Resolves the report action using the query row specified /// </summary> /// <param name="row">The query row</param> /// <returns>The action output</returns> public ReportAction Resolve ( QueryRow row ) { Validate.IsNotNull(row); if (this.TemplateBindings.Any()) { var bindingValues = new List <object>(); foreach (var binding in this.TemplateBindings) { bindingValues.Add ( binding.Resolve(row) ); } var formattedAction = String.Format ( this.ActionTemplate, bindingValues.ToArray() ); return(new ReportAction ( this.ActionType, formattedAction )); } else { return(new ReportAction ( this.ActionType, this.ActionTemplate )); } }
/// <summary> /// Resolves the template content for a query row /// </summary> /// <param name="row">The query row</param> /// <returns>The resolved content</returns> private string ResolveTemplateContent ( QueryRow row ) { var template = this.Expression; var renderer = ReportrEngine.TemplateRenderer; if (renderer == null) { throw new InvalidOperationException ( "The template renderer has not been configured." ); } return(renderer.Render ( template, row )); }
/// <summary> /// Loads the object info. /// </summary> /// <param name="tables">The tables.</param> /// <param name="columns">The columns.</param> /// <param name="table">The table.</param> /// <returns></returns> protected virtual DBObject LoadObjectInfo(QueryRow table, QueryData columns) { DBObject t = new DBObject(); ObjectBuilder.SetFieldData(_dstore, table, t); t.Columns = new List <Column>(); foreach (QueryRow row in columns) //all of the columns for all of the tables were returned, so we need to only get the one I'm working on... { if (row.FieldHasMapping("TableName")) //make sure the table name is present { if (row.GetDataForRowField("TableName").ToString().Equals(t.Name, StringComparison.InvariantCultureIgnoreCase) && row.GetDataForRowField("Schema").ToString().Equals(t.Schema, StringComparison.InvariantCultureIgnoreCase)) //make sure its the right table { if (row.FieldHasMapping("ColumnName")) { AddColumnToDBObject(row, t); } } } } return(t); }
private QueryRow CreateReducedRow(object key, bool group, int groupLevel, ReduceDelegate reduce, Func <QueryRow, bool> filter, IList <object> keysToReduce, IList <object> valsToReduce) { try { var row = new QueryRow(null, 0, group ? GroupKey(key, groupLevel) : null, CallReduce(reduce, keysToReduce, valsToReduce), null, this); if (filter != null && filter(row)) { row = null; } return(row); } catch (CouchbaseLiteException) { Log.W(TAG, "Failed to run reduce query for {0}", Name); throw; } catch (Exception e) { throw new CouchbaseLiteException(String.Format("Error running reduce query for {0}", Name), e) { Code = StatusCode.Exception }; } }
String GetLabel(QueryRow row) { var value = row.Value; if (LabelProperty != null) { if (value is IDictionary <string, object> ) { ((IDictionary <string, object>)value).TryGetValue(LabelProperty, out value); } else { value = null; } if (value == null) { value = row.Document.GetProperty(LabelProperty); } } return(value == null ? String.Empty : value.ToString()); }
/// <summary> /// Generates a nested report filter for a query row /// </summary> /// <param name="parentFilter">The parent report filter</param> /// <param name="row">The query row</param> /// <returns>The report filter generated</returns> public ReportFilter GenerateNestedFilter ( ReportFilter parentFilter, QueryRow row ) { Validate.IsNotNull(parentFilter); Validate.IsNotNull(row); var parameterOverrides = CompileParameterValues ( parentFilter, row ); var nestedFilter = parentFilter.Clone(); nestedFilter.SetParameterValues ( parameterOverrides ); return(nestedFilter); }
public IEnumerable <QueryRow> RegularQuery(QueryOptions options) { var db = _dbStorage; var filter = options.Filter; int limit = int.MaxValue; int skip = 0; if (filter != null) { // Custom post-filter means skip/limit apply to the filtered rows, not to the // underlying query, so handle them specially: limit = options.Limit; skip = options.Skip; options.Limit = QueryOptions.DEFAULT_LIMIT; options.Skip = 0; } var rows = new List <QueryRow>(); RunQuery(options, (keyData, valueData, docId, cursor) => { long sequence = cursor.GetLong(3); RevisionInternal docRevision = null; if (options.IncludeDocs) { IDictionary <string, object> value = null; if (valueData != null && !RowValueIsEntireDoc(valueData.Value)) { value = valueData.Value.AsDictionary <string, object>(); } string linkedId = value == null ? null : value.GetCast <string>("_id"); if (linkedId != null) { // Linked document: http://wiki.apache.org/couchdb/Introduction_to_CouchDB_views#Linked_documents string linkedRev = value == null ? null : value.GetCast <string>("_rev"); //usually null docRevision = db.GetDocument(linkedId, linkedRev, true); sequence = docRevision == null ? 0 : docRevision.GetSequence(); } else { docRevision = db.GetRevision(docId, cursor.GetString(4), false, sequence, cursor.GetBlob(5)); } } Log.V(TAG, "Query {0}: Found row with key={1}, value={2}, id={3}", Name, keyData.Value, valueData.Value, docId); QueryRow row = null; if (false) { //TODO: bbox } else { row = new QueryRow(docId, sequence, keyData.Value, valueData.Value, docRevision, this); } if (filter != null) { if (!filter(row)) { return(new Status(StatusCode.Ok)); } if (skip > 0) { --skip; return(new Status(StatusCode.Ok)); } } rows.Add(row); if (limit-- == 0) { return(new Status(StatusCode.Reserved)); } return(new Status(StatusCode.Ok)); }); // If given keys, sort the output into that order, and add entries for missing keys: if (options.Keys != null) { // Group rows by key: var rowsByKey = new Dictionary <string, List <QueryRow> >(); foreach (var row in rows) { var key = ToJSONString(row.Key); var dictRows = rowsByKey.Get(key); if (dictRows == null) { dictRows = rowsByKey[key] = new List <QueryRow>(); } dictRows.Add(row); } // Now concatenate them in the order the keys are given in options: var sortedRows = new List <QueryRow>(); foreach (var key in options.Keys.Select(x => ToJSONString(x))) { var dictRows = rowsByKey.Get(key); if (dictRows != null) { sortedRows.AddRange(dictRows); } } rows = sortedRows; } return(rows); }
public abstract bool DeleteRow (CouchbaseTableSource source, QueryRow row);
public abstract void WillUseCell (CouchbaseTableSource source, UITableViewCell cell, QueryRow row);
public abstract void UpdateFromQuery (CouchbaseTableSource source, LiveQuery query, QueryRow [] previousRows);
public IEnumerable<QueryRow> GetAllDocs(QueryOptions options) { var remainingIDs = default(List<string>); var enumerator = GetDocEnumerator(options, out remainingIDs); var current = 0; foreach(var next in enumerator) { if (current++ >= options.Limit) { yield break; } var sequenceNumber = 0L; var docID = next.CurrentDocID; remainingIDs.Remove(docID); var value = default(IDictionary<string, object>); if (next.Exists) { sequenceNumber = (long)next.SelectedRev.sequence; var conflicts = default(IList<string>); if (options.AllDocsMode >= AllDocsMode.ShowConflicts && next.IsConflicted) { SelectCurrentRevision(next); using (var innerEnumerator = new CBForestHistoryEnumerator(next, true, false)) { conflicts = innerEnumerator.Select(x => (string)x.SelectedRev.revID).ToList(); } if (conflicts.Count == 1) { conflicts = null; } } bool valid = conflicts != null || options.AllDocsMode != AllDocsMode.OnlyConflicts; if (!valid) { continue; } value = new NonNullDictionary<string, object> { { "rev", next.CurrentRevID }, { "deleted", next.IsDeleted ? (object)true : null }, { "_conflicts", conflicts } }; } var row = new QueryRow(value == null ? null : docID, sequenceNumber, docID, value, value == null ? null : new RevisionInternal(next, options.IncludeDocs), null); if (options.Filter == null || options.Filter(row)) { yield return row; } } foreach (var docId in remainingIDs) { var value = GetAllDocsEntry(docId); var row = new QueryRow(value != null ? docId as string : null, 0, docId, value, null, null); if (options.Filter == null || options.Filter(row)) { yield return row; } } }
/// <summary> /// Asynchronously generates a nested components for a query row /// </summary> /// <param name="repeaterDefinition">The repeater definition</param> /// <param name="sectionType">The section type</param> /// <param name="parentFilter">The parent report filter</param> /// <param name="row">The query row</param> /// <returns>The nested components generated</returns> private async Task <IReportComponent[]> GenerateNestedComponentsAsync ( RepeaterDefinition repeaterDefinition, ReportSectionType sectionType, ReportFilter parentFilter, QueryRow row ) { var generationTasks = new List <Task <IReportComponent> >(); var componentList = new List <IReportComponent>(); foreach (var nestedComponent in repeaterDefinition.NestedComponents) { var componentDefinition = nestedComponent.Definition; var componentName = componentDefinition.Name; var isExcluded = parentFilter.IsExcluded ( componentName ); if (false == isExcluded) { var componentType = componentDefinition.ComponentType; var componentGenerator = componentType.GetGenerator(); var nestedFilter = nestedComponent.GenerateNestedFilter ( parentFilter, row ); var task = componentGenerator.GenerateAsync ( componentDefinition, sectionType, nestedFilter ); generationTasks.Add(task); } } await Task.WhenAll ( generationTasks.ToArray() ) .ConfigureAwait ( false ); foreach (var task in generationTasks) { componentList.Add ( await task.ConfigureAwait(false) ); } return(componentList.ToArray()); }
public IEnumerable<QueryRow> GetAllDocs(QueryOptions options) { var remainingIDs = default(List<string>); var enumerator = GetDocEnumerator(options, out remainingIDs); var current = 0; foreach(var next in enumerator) { if(current++ >= options.Limit) { yield break; } var sequenceNumber = 0L; var docID = next.CurrentDocID; remainingIDs.Remove(docID); var value = default(IDictionary<string, object>); if(next.Exists) { sequenceNumber = (long)next.SelectedRev.sequence; var conflicts = default(IList<string>); if(options.AllDocsMode >= AllDocsMode.ShowConflicts && next.IsConflicted) { SelectCurrentRevision(next); LoadRevisionBody(next); using(var innerEnumerator = GetHistoryFromSequence(next.Sequence)) { conflicts = innerEnumerator.Select(x => (string)x.SelectedRev.revID).ToList(); } if(conflicts.Count == 1) { conflicts = null; } } bool valid = conflicts != null || options.AllDocsMode != AllDocsMode.OnlyConflicts; if(!valid) { continue; } value = new NonNullDictionary<string, object> { { "rev", next.CurrentRevID }, { "deleted", next.IsDeleted ? (object)true : null }, { "_conflicts", conflicts } }; Log.To.Query.V(TAG, "AllDocs: Found row with key=\"{0}\", value={1}", new SecureLogString(docID, LogMessageSensitivity.PotentiallyInsecure), new SecureLogJsonString(value, LogMessageSensitivity.PotentiallyInsecure)); } else { Log.To.Query.V(TAG, "AllDocs: No such row with key=\"{0}\"", new SecureLogString(docID, LogMessageSensitivity.PotentiallyInsecure)); } var row = new QueryRow(value == null ? null : docID, sequenceNumber, docID, value, value == null ? null : new ForestRevisionInternal(next, options.IncludeDocs), null); if(options.Filter == null || options.Filter(row)) { yield return row; } else { Log.To.Query.V(TAG, " ... on 2nd thought, filter predicate skipped that row"); } } foreach(var docId in remainingIDs) { var value = GetAllDocsEntry(docId); var row = new QueryRow(value != null ? docId as string : null, 0, docId, value, null, null); if(options.Filter == null || options.Filter(row)) { yield return row; } } }
public IEnumerable <QueryRow> ReducedQuery(QueryOptions options) { var db = _dbStorage; var groupLevel = options.GroupLevel; bool group = options.Group || groupLevel > 0; var reduce = Delegate.Reduce; if (options.ReduceSpecified) { if (options.Reduce && reduce == null) { Log.W(TAG, "Cannot use reduce option in view {0} which has no reduce block defined", Name); return(null); } } List <object> keysToReduce = null, valuesToReduce = null; if (reduce != null) { keysToReduce = new List <object>(100); valuesToReduce = new List <object>(100); } Lazy <byte[]> lastKeyData = null; List <QueryRow> rows = new List <QueryRow>(); RunQuery(options, (keyData, valueData, docID, c) => { var lastKeyValue = lastKeyData != null ? lastKeyData.Value : null; if (group && !GroupTogether(keyData.Value, lastKeyValue, groupLevel)) { if (lastKeyData != null && lastKeyData.Value != null) { // This pair starts a new group, so reduce & record the last one: var key = GroupKey(lastKeyData.Value, groupLevel); var reduced = CallReduce(reduce, keysToReduce, valuesToReduce); var row = new QueryRow(null, 0, key, reduced, null, this); if (options.Filter == null || options.Filter(row)) { rows.Add(row); } keysToReduce.Clear(); valuesToReduce.Clear(); } lastKeyData = keyData; } Log.V(TAG, " Query {0}: Will reduce row with key={1}, value={2}", Name, keyData.Value, valueData.Value); object valueOrData = FromJSON(valueData.Value); if (valuesToReduce != null && RowValueIsEntireDoc(valueData.Value)) { // map fn emitted 'doc' as value, which was stored as a "*" placeholder; expand now: try { var rev = db.GetDocument(docID, c.GetLong(1)); valueOrData = rev.GetProperties(); } catch (CouchbaseLiteException) { Log.W(TAG, "Couldn't load doc for row value"); throw; } } keysToReduce.Add(keyData.Value); valuesToReduce.Add(valueOrData); return(new Status(StatusCode.Ok)); }); if ((keysToReduce != null && keysToReduce.Count > 0) || lastKeyData != null) { // Finish the last group (or the entire list, if no grouping): var key = group ? GroupKey(lastKeyData.Value, groupLevel) : null; var reduced = CallReduce(reduce, keysToReduce, valuesToReduce); Log.V(TAG, " Query {0}: Will reduce row with key={1}, value={2}", Name, Manager.GetObjectMapper().WriteValueAsString(key), Manager.GetObjectMapper().WriteValueAsString(reduced)); var row = new QueryRow(null, 0, key, reduced, null, this); if (options.Filter == null || options.Filter(row)) { rows.Add(row); } } return(rows); }
public IQueryRowStore StorageForQueryRow(QueryRow row) { return(this); }
private string GetLabel (QueryRow row) { var value = row.Value; if (LabelProperty != null) { if (value is IDictionary<string,object>) ((IDictionary<string,object>)value).TryGetValue(LabelProperty, out value); else value = null; if (value == null) value = row.Document.GetProperty(LabelProperty); } return value == null ? String.Empty : value.ToString(); }