public VDB_Table(string name, int preloadRows, string[] columns) { columnNames = columns; rows = new List<VDB_TableRow>(); VDB_TableRow[] rowstmp = new VDB_TableRow[preloadRows]; for (int i = 0; i < rowstmp.Length; i++) { rowstmp[i] = new VDB_TableRow(); rowstmp[i].values = new VDB_Value[GetColumnCount()]; } rows.AddRange(rowstmp); this.name = name; }
//Insert a new row containing the given values public void InsertRow(params VDB_Value[] values) { if (values.Length != columnCount) { throw new VDB_OutOfBoundsException(); } //Insert the given values as a new row VDB_TableRow row = new VDB_TableRow(); row.values = values; rows.Add(row); }
//Gets the value of the named column in the given row public VDB_Value GetValue(VDB_TableRow row, string columnName) { int columnNum = GetColumnNumberFromName(columnName); return row.values[columnNum]; }