1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
| #include <string>
| #include <iostream>
|
| #include "DBuntil.h"
|
| using namespace std;
|
|
| int main(int argc, char *argv[])
| {
| int i=2;
| my_db mydb={"root","Basic@2017","localhost","demo",3306};
|
| DBuntil dbu = DBuntil(mydb);
| person p={0,"test"};
| if(dbu.db_register(i,&p)){
| cout<<"add succeed"<<endl;
| }else
| cout<<"add false"<<endl;
| p={};
|
| p = dbu.db_rearch(i);
| if(p.p_id != NULL)
| {
| cout<<p.p_id<<endl;
| cout<<p.name<<endl;
| }else
| cout<<"person is null"<<endl;
|
| return 0;
| }
|
|