Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 03d876f

Browse files
committed
数据库的基础封装完结
1 parent e97987b commit 03d876f

File tree

10 files changed

+45
-18
lines changed

10 files changed

+45
-18
lines changed

PlayServer/DataBaseHelper.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#include <list>
55
#include <memory>
66
#include <vector>
7+
8+
79
class _Table_;
810
using PTable = std::shared_ptr<_Table_>;
911
using KeyValue = std::map<Buffer, Buffer>;

PlayServer/DatabaseHelper.cpp

Lines changed: 0 additions & 1 deletion
This file was deleted.

PlayServer/HttpParser.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include"http_parser.h"
33
#include"Socket.h"
44
#include<map>
5+
#include"Public.h"
56
class CHttpParser
67
{
78
public:

PlayServer/PlayServer.vcxproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@
7575
<ImportGroup Label="PropertySheets" />
7676
<PropertyGroup Label="UserMacros" />
7777
<ItemGroup>
78-
<ClCompile Include="DatabaseHelper.cpp" />
7978
<ClCompile Include="HttpParser.cpp" />
8079
<ClCompile Include="http_parser.c" />
8180
<ClCompile Include="Loggere.cpp" />

PlayServer/PlayServer.vcxproj.filters

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<ItemGroup>
4-
<ClCompile Include="DatabaseHelper.cpp" />
54
<ClCompile Include="HttpParser.cpp" />
65
<ClCompile Include="http_parser.c" />
76
<ClCompile Include="Loggere.cpp" />

PlayServer/Public.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#pragma once
2-
#include"Socket.h"
32
#include<string.h>
3+
#include<string>
44

55
class Buffer : public std::string
66
{

PlayServer/Socket.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include<arpa/inet.h>
77
#include<string>
88
#include<fcntl.h>
9+
#include"Public.h"
910

1011

1112
enum SOCKATTR {

PlayServer/Sqlite3Client.cpp

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,7 @@ _sqlite3_field_::_sqlite3_field_()
283283
nType = TYPE_NULL;
284284
Value.Double = 0.0;
285285
}
286-
_sqlite3_field_::_sqlite3_field_(int ntype,
287-
const Buffer& name, unsigned attr, const Buffer&
286+
_sqlite3_field_::_sqlite3_field_(int ntype, const Buffer& name, unsigned attr, const Buffer&
288287
type, const Buffer& size, const Buffer&
289288
default_, const Buffer& check)
290289
{
@@ -452,13 +451,39 @@ _sqlite3_field_::operator const Buffer() const
452451
{
453452
return '"' + Name + '"';
454453
}
455-
Buffer _sqlite3_field_::Str2Hex(const Buffer&
456-
data) const
454+
Buffer _sqlite3_field_::Str2Hex(const Buffer& data) const
457455
{
458456
const char* hex = "0123456789ABCDEF";
459457
std::stringstream ss;
460458
for (auto ch : data)
461-
ss << hex[(unsigned char)ch >> 4] <<
462-
hex[(unsigned char)ch & 0xF];
459+
ss << hex[(unsigned char)ch >> 4] << hex[(unsigned char)ch & 0xF];
463460
return ss.str();
464461
}
462+
463+
464+
//class user_test:public _sqlite3_table_
465+
//{
466+
//public:
467+
// virtual PTable Copy() const
468+
// {
469+
// return PTable(new user_test(*this));
470+
// }
471+
// user_test() : _sqlite3_table_()
472+
// {
473+
// Name = "user_test";
474+
// {
475+
// PField field(new )
476+
// }
477+
// }
478+
//
479+
//private:
480+
//
481+
//};
482+
//
483+
//user_test:public _sqlite3_table_::user_test:public _sqlite3_table_()
484+
//{
485+
//}
486+
//
487+
//user_test:public _sqlite3_table_::~user_test:public _sqlite3_table_()
488+
//{
489+
//}

PlayServer/Sqlite3Client.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22
#include "Public.h"
3-
#include "DatabaseHelper.h"
43
#include "sqlite3/sqlite3.h"
4+
#include"DataBaseHelper.h"
55
class CSqlite3Client
66
:public CDatabaseClient
77
{

PlayServer/main.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,14 @@ int server_test()
174174
ret = server.Run();
175175
ERR_RETURN(ret, -3);
176176

177+
return 0;
178+
}
179+
180+
int http_test()
181+
{
182+
183+
184+
177185
return 0;
178186
}
179187
int main()
@@ -194,10 +202,3 @@ int main()
194202
http_test();
195203
}
196204

197-
int http_test()
198-
{
199-
200-
201-
202-
return 0;
203-
}

0 commit comments

Comments
 (0)