00001 #ifndef __SIMPLE_DATABASE_COMMON_H 00002 #define __SIMPLE_DATABASE_COMMON_H 00003 00004 #include "DS_Table.h" 00005 00006 namespace RakNet 00007 { 00008 class BitStream; 00009 }; 00010 00011 #define _SIMPLE_DATABASE_PASSWORD_LENGTH 32 00012 #define _SIMPLE_DATABASE_TABLE_NAME_LENGTH 32 00013 00014 #define SYSTEM_ID_COLUMN_NAME "__SystemAddress" 00015 #define SYSTEM_GUID_COLUMN_NAME "__SystemGuid" 00016 #define LAST_PING_RESPONSE_COLUMN_NAME "__lastPingResponseTime" 00017 #define NEXT_PING_SEND_COLUMN_NAME "__nextPingSendTime" 00018 00019 struct DatabaseFilter 00020 { 00021 void Serialize(RakNet::BitStream *out); 00022 bool Deserialize(RakNet::BitStream *in); 00023 00024 DataStructures::Table::Cell cellValue; 00025 DataStructures::Table::FilterQueryType operation; 00026 DataStructures::Table::ColumnType columnType; 00027 char columnName[_TABLE_MAX_COLUMN_NAME_LENGTH]; 00028 }; 00029 00031 struct DatabaseCellUpdate 00032 { 00033 void Serialize(RakNet::BitStream *out); 00034 bool Deserialize(RakNet::BitStream *in); 00035 00036 DataStructures::Table::Cell cellValue; 00037 DataStructures::Table::ColumnType columnType; 00038 char columnName[_TABLE_MAX_COLUMN_NAME_LENGTH]; 00039 }; 00040 00041 enum RowUpdateMode 00042 { 00043 // Only update an existing row. rowId is required. 00044 RUM_UPDATE_EXISTING_ROW, 00045 00046 // Update an existing row if present - otherwise add a new row. rowId is required. 00047 RUM_UPDATE_OR_ADD_ROW, 00048 00049 // Add a new row. If rowId is passed then the row will only be added if this id doesn't already exist. 00050 // If rowId is not passed and the table requires a rowId the creation fails. 00051 RUM_ADD_NEW_ROW, 00052 }; 00053 00054 #endif