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

Function tbl_insert

lib_acl_cpp/samples/db/mysql_pool/main.cpp:105–132  ·  view source on GitHub ↗

���ӱ�����

Source from the content-addressed store, hash-verified

103
104// ���ӱ�����
105static bool tbl_insert(acl::db_handle& db, int n)
106{
107 acl::query query;
108 query.create_sql("insert into group_tbl(group_name, uvip_tbl,"
109 " update_date) values(:group, :test, :date)")
110 .set_format("group", "group:%d", n)
111 .set_parameter("test", "test")
112 .set_date("date", time(NULL), "%Y-%m-%d");
113
114 if (db.exec_update(query) == false)
115 return (false);
116
117 const acl::db_rows* result = db.get_result();
118 if (result)
119 {
120 const std::vector<acl::db_row*>& rows = result->get_rows();
121 for (size_t i = 0; i < rows.size(); i++)
122 {
123 const acl::db_row* row = rows[i];
124 for (size_t j = 0; j < row->length(); j++)
125 printf("%s, ", (*row)[j]);
126 printf("\r\n");
127 }
128 }
129
130 db.free_result();
131 return (true);
132}
133
134// ��ѯ������
135static int tbl_select(acl::db_handle& db, int n)

Callers 1

runMethod · 0.70

Calls 7

set_parameterMethod · 0.80
exec_updateMethod · 0.80
get_rowsMethod · 0.80
free_resultMethod · 0.80
get_resultMethod · 0.45
sizeMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…