mirror of
https://github.com/copyrighttxt/watrbx-game-engine.git
synced 2026-09-05 21:27:48 +00:00
GEEKING
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
#include "SQLite3PluginCommon.h"
|
||||
|
||||
|
||||
SQLite3Table::SQLite3Table()
|
||||
{
|
||||
|
||||
}
|
||||
SQLite3Table::~SQLite3Table()
|
||||
{
|
||||
for (unsigned int i=0; i < rows.Size(); i++)
|
||||
RakNet::OP_DELETE(rows[i],_FILE_AND_LINE_);
|
||||
}
|
||||
|
||||
void SQLite3Table::Serialize(RakNet::BitStream *bitStream)
|
||||
{
|
||||
bitStream->Write(columnNames.Size());
|
||||
unsigned int idx1, idx2;
|
||||
for (idx1=0; idx1 < columnNames.Size(); idx1++)
|
||||
bitStream->Write(columnNames[idx1]);
|
||||
bitStream->Write(rows.Size());
|
||||
for (idx1=0; idx1 < rows.Size(); idx1++)
|
||||
{
|
||||
for (idx2=0; idx2 < rows[idx1]->entries.Size(); idx2++)
|
||||
{
|
||||
bitStream->Write(rows[idx1]->entries[idx2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
void SQLite3Table::Deserialize(RakNet::BitStream *bitStream)
|
||||
{
|
||||
for (unsigned int i=0; i < rows.Size(); i++)
|
||||
RakNet::OP_DELETE(rows[i],_FILE_AND_LINE_);
|
||||
rows.Clear(true,_FILE_AND_LINE_);
|
||||
columnNames.Clear(true , _FILE_AND_LINE_ );
|
||||
|
||||
unsigned int numColumns, numRows;
|
||||
bitStream->Read(numColumns);
|
||||
unsigned int idx1,idx2;
|
||||
RakNet::RakString inputStr;
|
||||
for (idx1=0; idx1 < numColumns; idx1++)
|
||||
{
|
||||
bitStream->Read(inputStr);
|
||||
columnNames.Push(inputStr, _FILE_AND_LINE_ );
|
||||
}
|
||||
bitStream->Read(numRows);
|
||||
for (idx1=0; idx1 < numRows; idx1++)
|
||||
{
|
||||
SQLite3Row *row = RakNet::OP_NEW<SQLite3Row>(_FILE_AND_LINE_);
|
||||
rows.Push(row,_FILE_AND_LINE_);
|
||||
for (idx2=0; idx2 < numColumns; idx2++)
|
||||
{
|
||||
bitStream->Read(inputStr);
|
||||
row->entries.Push(inputStr, _FILE_AND_LINE_ );
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user