Class Table
A client-database table with its schema resolved at RUNTIME from WoWDBDefs data: open any table of any targeted client era, read its rows, edit cells by (row, column, element), and write it back in the era's own format. Cells are addressed by column index (see column_index/column_info); scalar columns also expose zero-copy array views.
public class Table : TableBase, IDisposable
- Inheritance
-
Table
- Implements
- Inherited Members
Constructors
Table()
public Table()
Table(Table)
Copy-construct: a deep copy of other (the C++ copy constructor).
public Table(Table other)
Parameters
otherTable
Properties
ColumnCount
The number of schema columns.
public ulong ColumnCount { get; }
Property Value
Name
The table name (WoWDBDefs identifier).
public string Name { get; }
Property Value
RowCount
The number of rows.
public ulong RowCount { get; }
Property Value
Version
The client version the table serializes for.
public ClientVersion Version { get; }
Property Value
Methods
AppendRow()
Append a fresh zero/empty row.
public ulong AppendRow()
Returns
- ulong
the new row's index
ClearRows()
Drop every row (the schema and preserved decode state stay).
public void ClearRows()
ColumnIndex(string)
The index of the column with the given name: the canonical snake_case spelling ('map_name'), or the verbatim WoWDBDefs spelling ('MapName_lang') as an alias; case-sensitive either way.
public ulong ColumnIndex(string name)
Parameters
namestringthe column name, case-sensitive
Returns
- ulong
the column index; raises when no column matches
ColumnInfo(ulong)
The schema entry of one column: name, value class, shape and key roles.
public Column ColumnInfo(ulong column)
Parameters
columnulongthe column index
Returns
- Column
the column description; raises when out of range
Dispose()
Release the native object now. Optional: the finalizer releases it on
collection anyway - dispose (or using) when you want native memory back
promptly.
public override void Dispose()
EraseRow(ulong)
Remove one row.
public void EraseRow(ulong row)
Parameters
rowulongthe row index
FindById(uint)
The first row whose \(id\) column equals the given key.
public ulong FindById(uint id)
Parameters
iduintthe primary key value
Returns
- ulong
the row index; raises when no row matches
GetFloat(ulong, ulong, ulong)
Read a float cell.
public float GetFloat(ulong row, ulong column, ulong element)
Parameters
Returns
- float
the value; raises on a non-Float column or an out-of-range index
GetInt(ulong, ulong, ulong)
Read an integer cell, sign-extended from the column's exact width. LocString flags read via locstring_flags.
public long GetInt(ulong row, ulong column, ulong element)
Parameters
Returns
- long
the value; raises on a non-Int column or an out-of-range index
GetString(ulong, ulong, ulong)
Read a string cell (String columns: the array element; LocString columns: the locale slot).
public string GetString(ulong row, ulong column, ulong element)
Parameters
rowulongthe row index
columnulonga String/LocString column's index
elementulongthe array element / locale slot
Returns
- string
the text; raises on a non-string column or an out-of-range index
LocstringFlags(ulong, ulong)
Read a LocString column's flags word.
public uint LocstringFlags(ulong row, ulong column)
Parameters
Returns
- uint
the flags; raises on a non-LocString column
Open(string, ClientVersion)
Open an empty table by name, with its schema resolved for the given client version from the built-in WoWDBDefs data.
public static Table Open(string table, ClientVersion version)
Parameters
tablestringthe table name, e.g. "Map"
versionClientVersionthe client to resolve for
Returns
- Table
the empty, schema-bound table; raises for an unknown table or an uncovered client era
SetFloat(ulong, ulong, float, ulong)
Write a float cell.
public void SetFloat(ulong row, ulong column, float value, ulong element)
Parameters
rowulongthe row index
columnulonga Float column's index
valuefloatelementulongthe array element
SetInt(ulong, ulong, long, ulong)
Write an integer cell (truncates to the column's exact width, exactly as the typed member assignment did).
public void SetInt(ulong row, ulong column, long value, ulong element)
Parameters
rowulongthe row index
columnulongan Int column's index
valuelongelementulongthe array element
SetLocstringFlags(ulong, ulong, uint)
Write a LocString column's flags word.
public void SetLocstringFlags(ulong row, ulong column, uint flags)
Parameters
SetString(ulong, ulong, string, ulong)
Write a string cell (String columns: the array element; LocString columns: the locale slot).
public void SetString(ulong row, ulong column, string value, ulong element)