mirror of
https://github.com/dashr9230/SA-MP.git
synced 2025-09-20 04:36:01 +08:00
Revert RakNet source files back to the original v2.518 state
* Add RakNet source files to the VS project
This commit is contained in:
45
raknet/LightweightDatabaseCommon.cpp
Normal file
45
raknet/LightweightDatabaseCommon.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
#include "TableSerializer.h"
|
||||
#include "LightweightDatabaseCommon.h"
|
||||
#include "BitStream.h"
|
||||
#include "StringCompressor.h"
|
||||
|
||||
void DatabaseFilter::Serialize(RakNet::BitStream *out)
|
||||
{
|
||||
stringCompressor->EncodeString(columnName, _TABLE_MAX_COLUMN_NAME_LENGTH, out);
|
||||
out->Write((unsigned char)columnType);
|
||||
out->Write((unsigned char)operation);
|
||||
if (operation!=DataStructures::Table::QF_IS_EMPTY && operation!=DataStructures::Table::QF_NOT_EMPTY)
|
||||
{
|
||||
assert(cellValue.isEmpty==false);
|
||||
TableSerializer::SerializeCell(out, &cellValue, columnType);
|
||||
}
|
||||
}
|
||||
bool DatabaseFilter::Deserialize(RakNet::BitStream *in)
|
||||
{
|
||||
unsigned char temp;
|
||||
stringCompressor->DecodeString(columnName, _TABLE_MAX_COLUMN_NAME_LENGTH, in);
|
||||
in->Read(temp);
|
||||
columnType=(DataStructures::Table::ColumnType)temp;
|
||||
if (in->Read(temp)==false)
|
||||
return false;
|
||||
operation=(DataStructures::Table::FilterQueryType)temp;
|
||||
if (operation!=DataStructures::Table::QF_IS_EMPTY && operation!=DataStructures::Table::QF_NOT_EMPTY)
|
||||
{
|
||||
return TableSerializer::DeserializeCell(in, &cellValue, columnType);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
void DatabaseCellUpdate::Serialize(RakNet::BitStream *out)
|
||||
{
|
||||
stringCompressor->EncodeString(columnName, _TABLE_MAX_COLUMN_NAME_LENGTH, out);
|
||||
out->Write((unsigned char)columnType);
|
||||
TableSerializer::SerializeCell(out, &cellValue, columnType);
|
||||
}
|
||||
bool DatabaseCellUpdate::Deserialize(RakNet::BitStream *in)
|
||||
{
|
||||
unsigned char temp;
|
||||
stringCompressor->DecodeString(columnName, _TABLE_MAX_COLUMN_NAME_LENGTH, in);
|
||||
in->Read(temp);
|
||||
columnType=(DataStructures::Table::ColumnType)temp;
|
||||
return TableSerializer::DeserializeCell(in, &cellValue, columnType);
|
||||
}
|
Reference in New Issue
Block a user