public GetTable ( string name ) : |
||
name | string | The name of the table. |
return |
public virtual Table GetTable(string name)
{
ulong numTables = scaliendb_client.SDBP_GetNumTables(client.cptr, databaseID);
for (uint i = 0; i < numTables; i++)
{
ulong tableID = scaliendb_client.SDBP_GetTableIDAt(client.cptr, databaseID, i);
string tableName = scaliendb_client.SDBP_GetTableNameAt(client.cptr, databaseID, i);
if (name == tableName)
return new Table(client, this, tableID, name);
}
throw new SDBPException(Status.SDBP_BADSCHEMA, "Table not found");
}
private void OpenDB() { try { db = clients[client_index].GetDatabase(dbname); } catch (SDBPException) { db = clients[client_index].CreateDatabase(dbname); } db = Utils.GetOrCreateEmptyDatabase(clients[client_index], dbname); try { indices = db.GetTable("indices"); } catch (SDBPException) { indices = db.CreateTable("indices"); } userIDs = indices.GetSequence("userIDs"); try { table = db.GetTable(tablename); } catch (SDBPException) { table = db.CreateTable(tablename); } try { tableByNick = db.GetTable(tablename + "ByNick"); } catch (SDBPException) { tableByNick = db.CreateTable(tablename + "ByNick"); } try { tableByBirth = db.GetTable(tablename + "ByBirth"); } catch (SDBPException) { tableByBirth = db.CreateTable(tablename + "ByBirth"); } try { tableByLastLogin = db.GetTable(tablename + "ByLastLogin"); } catch (SDBPException) { tableByLastLogin = db.CreateTable(tablename + "ByLastLogin"); } }