/// <summary> /// Creates the command to get the number of rows in the given section. /// </summary> /// <returns> /// The command to get the number of rows in the given section. /// </returns> /// <param name='section'> /// The section to get the number of rows for. /// </param> protected virtual SQLiteCommand CreateRowCountCommand(int section) { string query = "select count (*) from \"" + TableName + "\""; object[] args; if (SectionExpression != null) { SQLiteWhereExpression where = new SQLiteWhereExpression(); SQLiteAndExpression and = new SQLiteAndExpression(); and.Add(new SQLiteEqualToExpression(SectionExpression, SectionTitles[section])); if (SearchExpression != null && SearchExpression.Expression != null) { and.AddRange(SearchExpression.Expression); } where.Expression = and; query += " " + where.ToString(out args); } else if (SearchExpression != null) { query += " " + SearchExpression.ToString(out args); } else { args = new object [0]; } return(Connection.CreateCommand(query, args)); }