예제 #1
0
        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);
        }
예제 #2
0
        // 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());
        }
예제 #3
0
        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)));
        }
예제 #4
0
 public List <string[]> Get(string tableName, Database.Comparison op, Database.TableField field)
 {
     return(this.Get(tableName, op, field, null));
 }
예제 #5
0
 protected List <T> Get(Database.Comparison op, Database.TableField field)
 {
     return(this.Get(op, field, null));
 }