# LightweightDatabaseClient Class Reference
[LightweightDatabase]

The client interface to the simple database included with RakNet, useful for a server browser or a lobby server. More...

`#include <LightweightDatabaseClient.h>`

Inheritance diagram for LightweightDatabaseClient:

List of all members.

## Public Member Functions
| LightweightDatabaseClient ()
| Constructor.
virtual | ~LightweightDatabaseClient ()
| Destructor.
void | QueryTable (const char *tableName, const char *queryPassword, const char **columnNamesSubset, unsigned char numColumnSubset, DatabaseFilter *filter, unsigned char numFilters, unsigned *rowIds, unsigned char numRowIDs, SystemAddress systemAddress, bool broadcast)
void | UpdateRow (const char *tableName, const char *updatePassword, RowUpdateMode updateMode, bool hasRowId, unsigned rowId, DatabaseCellUpdate *cellUpdates, unsigned char numCellUpdates, SystemAddress systemAddress, bool broadcast)
void | RemoveRow (const char *tableName, const char *removePassword, unsigned rowId, SystemAddress systemAddress, bool broadcast)
void | OnAttach (RakPeerInterface *peer)
virtual PluginReceiveResult | OnReceive (RakPeerInterface *peer, Packet *packet)

## Detailed Description

The client interface to the simple database included with RakNet, useful for a server browser or a lobby server.

## Member Function Documentation

void LightweightDatabaseClient::OnAttach | ( | RakPeerInterface * | peer | ) | `[virtual]`

Called when the interface is attached

Parameters:

  `[in]` | peer | the instance of RakPeer that is calling Receive

Reimplemented from PluginInterface.

PluginReceiveResult LightweightDatabaseClient::OnReceive | ( | RakPeerInterface * | peer,
|  | Packet * | packet |
| ) |  |  | `[virtual]`

OnReceive is called for every packet.

Parameters:

  `[in]` | peer | the instance of RakPeer that is calling Receive
  `[in]` | packet | the packet that is being returned to the user

Returns:
  True to allow the game and other plugins to get this message, false to absorb it

Reimplemented from PluginInterface.

void LightweightDatabaseClient::QueryTable | ( | const char * | tableName,
|  | const char * | queryPassword,
|  | const char ** | columnNamesSubset,
|  | unsigned char | numColumnSubset,
|  | DatabaseFilter * | filter,
|  | unsigned char | numFilters,
|  | unsigned * | rowIds,
|  | unsigned char | numRowIDs,
|  | SystemAddress | systemAddress,
|  | bool | broadcast |
| ) |  |  |

Sends a query to a remote table. The remote system should return ID_DATABASE_QUERY_REPLY, ID_DATABASE_UNKNOWN_TABLE, or ID_DATABASE_INCORRECT_PASSWORD

Note:
  If the remote table uses a password and you send the wrong one you will be silently disconnected and banned for one second.

Parameters:

  `[in]` | tableName | String name of the remote table. Case sensitive.
  `[in]` | queryPassword | Password to query the remote table, if any.
  `[in]` | columnSubset | An array of string names of the columns to query. The resulting table will return the columns in this same order. Pass 0 for all columns.
  `[in]` | numColumnSubset | The number of elements in the columnSubset array
  `[in]` | filter | Filters to apply to the query. For each row the filters are applied. All filters must be passed for the row to be returned. Pass 0 for no filters.
  `[in]` | numFilters | The number of elements in the filter array
  `[in]` | rowIds | Which particular rows to return. Pass 0 for all rows.
  `[in]` | numRowIDs | The number of elements in the rowIds array
  `[in]` | systemAddress | Which system to send to.
  `[in]` | broadcast | Broadcast or not. Same as the parameter in RakPeer::Send

void LightweightDatabaseClient::RemoveRow | ( | const char * | tableName,
|  | const char * | removePassword,
|  | unsigned | rowId,
|  | SystemAddress | systemAddress,
|  | bool | broadcast |
| ) |  |  |

Removes a remote row, assuming the server allows row removal. No response is returned by the server.

Parameters:

  `[in]` | tableName | String name of the remote table. Case sensitive.
  `[in]` | removePassword | Password to remove rows from the remote table, if any.
  `[in]` | rowId | The rowID of the existing row.
  `[in]` | systemAddress | Which system to send to.
  `[in]` | broadcast | Broadcast or not. Same as the parameter in RakPeer::Send

void LightweightDatabaseClient::UpdateRow | ( | const char * | tableName,
|  | const char * | updatePassword,
|  | RowUpdateMode | updateMode,
|  | bool | hasRowId,
|  | unsigned | rowId,
|  | DatabaseCellUpdate * | cellUpdates,
|  | unsigned char | numCellUpdates,
|  | SystemAddress | systemAddress,
|  | bool | broadcast |
| ) |  |  |

Sets one or more values in a new or existing row, assuming the server allows row creation and updates. No response is returned by the server.

Parameters:

  `[in]` | tableName | String name of the remote table. Case sensitive.
  `[in]` | updatePassword | Password to update the remote table, if any.
  `[in]` | updateMode | See RowUpdateMode in LightweightDatabaseCommon.h . This determines if to update an existing or new row.
  `[in]` | hasRowId | True if a valid value was passed for rowId, false otherwise. If false, will lookup the row by system address. Required if adding a new row and the remote system does not automatically create rowIDs.
  `[in]` | rowId | The rowID of the new or existing row.
  `[in]` | cellUpdates | An array of DatabaseCellUpdate structures containing the values to write to the remote row.
  `[in]` | numCellUpdates | The number of elements in the cellUpdates array
  `[in]` | systemAddress | Which system to send to.
  `[in]` | broadcast | Broadcast or not. Same as the parameter in RakPeer::Send

The documentation for this class was generated from the following files:

- C:/RakNet/Source/LightweightDatabaseClient.h
- C:/RakNet/Source/LightweightDatabaseClient.cpp