public List <string[]> Get(string tableName, Database.Comparison op, Database.TableField?field, Database.TableColumn[] columns) { string command = this.BuildGetCommandString(tableName, op, field, columns); this.Db.Open(); SqliteDataReader results = new SqliteCommand(command, this.Db).ExecuteReader(); List <string[]> rowsData = this.ConvertToListOfRowFieldStrings(results); this.Db.Close(); return(rowsData); }
// Helpers private string BuildGetCommandString(string tableName, Database.Comparison op, Database.TableField?field, Database.TableColumn[] columns) { StringBuilder command = new StringBuilder(); if ((columns == null) || (columns.Length == 0)) { command.Append($"SELECT *"); } else { command.Append($"SELECT {columns[0].Text}"); for (int i = 1; i < columns.Length; i++) { command.Append($", {columns[i].Text}"); } } command.Append($" FROM {tableName}"); if (op != null) { command.Append($" WHERE {field?.Column.Text} {op} {field?.FormattedValue()}"); } return(command.ToString()); }
protected List <T> Get(Database.Comparison op, Database.TableField?field, Database.TableColumn[] columns) { List <string[]> rowDataSet = this.db.Get(this.TableName, op, field, columns); return(rowDataSet.ConvertAll(new Converter <string[], T>(this.ConvertFromRow))); }
public List <string[]> Get(string tableName, Database.Comparison op, Database.TableField field) { return(this.Get(tableName, op, field, null)); }
protected List <T> Get(Database.Comparison op, Database.TableField field) { return(this.Get(op, field, null)); }