MCPcopy Create free account
hub / github.com/acl-dev/acl / db_create

Method db_create

lib_acl_cpp/samples/check_trigger/db_store.cpp:32–68  ·  view source on GitHub ↗

�������ݿ��

Source from the content-addressed store, hash-verified

30
31// �������ݿ��
32bool db_store::db_create()
33{
34 // ��ȡ���ݿ�����
35 acl::db_handle* db = var_dbpool->peek();
36 if (db == NULL)
37 {
38 logger_error("peek db failed!");
39 return false;
40 }
41
42 // ���ȴ����ݿ�
43 if (db->open(var_cfg_dbcharset) == false)
44 {
45 logger_error("open db error, charset: %s",
46 var_cfg_dbcharset);
47 var_dbpool->put(db);
48 return false;
49 }
50
51
52 if (db->tbl_exists("http_tbl"))
53 {
54 var_dbpool->put(db);
55 return true;
56 }
57
58 // �������ݿ��
59 if (db->sql_update(CREATE_TBL) == false)
60 {
61 logger_error("create db table failed, table: %s", CREATE_TBL);
62 var_dbpool->put(db);
63 return false;
64 }
65
66 var_dbpool->put(db);
67 return true;
68}
69
70bool db_store::db_update(const http_thread& http)
71{

Callers 1

proc_on_initMethod · 0.45

Calls 5

peekMethod · 0.45
openMethod · 0.45
putMethod · 0.45
tbl_existsMethod · 0.45
sql_updateMethod · 0.45

Tested by

no test coverage detected