Table of Contents

Class Table

Namespace
WoWLib.Database
Assembly
WoWLib.dll

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

other Table

Properties

ColumnCount

The number of schema columns.

public ulong ColumnCount { get; }

Property Value

ulong

Name

The table name (WoWDBDefs identifier).

public string Name { get; }

Property Value

string

RowCount

The number of rows.

public ulong RowCount { get; }

Property Value

ulong

Version

The client version the table serializes for.

public ClientVersion Version { get; }

Property Value

ClientVersion

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

name string

the 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

column ulong

the 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

row ulong

the row index

FindById(uint)

The first row whose \(id\) column equals the given key.

public ulong FindById(uint id)

Parameters

id uint

the 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

row ulong

the row index

column ulong

a Float column's index

element ulong

the array element

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

row ulong

the row index

column ulong

an Int column's index

element ulong

the array element

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

row ulong

the row index

column ulong

a String/LocString column's index

element ulong

the 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

row ulong

the row index

column ulong

a LocString column's index

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

table string

the table name, e.g. "Map"

version ClientVersion

the 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

row ulong

the row index

column ulong

a Float column's index

value float
element ulong

the 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

row ulong

the row index

column ulong

an Int column's index

value long
element ulong

the array element

SetLocstringFlags(ulong, ulong, uint)

Write a LocString column's flags word.

public void SetLocstringFlags(ulong row, ulong column, uint flags)

Parameters

row ulong

the row index

column ulong

a LocString column's index

flags uint

the flags word

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)

Parameters

row ulong

the row index

column ulong

a String/LocString column's index

value string
element ulong

the array element / locale slot