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

Function tbl_insert

lib_acl_cpp/samples/mysql/mysql.cpp:40–67  ·  view source on GitHub ↗

���ӱ�����

Source from the content-addressed store, hash-verified

38
39// ���ӱ�����
40static bool tbl_insert(acl::db_handle& db, int n)
41{
42 const char* sql_fmt = "insert into group_tbl(group_name, uvip_tbl)"
43 " values('%s-%d', 'test')";
44
45 acl::string sql;
46 sql.format(sql_fmt,
47 acl::strconv(__pre, strlen(__pre), "gbk", "utf8").c_str(), n);
48
49 if (db.sql_update(sql.c_str()) == false) {
50 return false;
51 }
52
53 const acl::db_rows* result = db.get_result();
54 if (result) {
55 const std::vector<acl::db_row*>& rows = result->get_rows();
56 for (size_t i = 0; i < rows.size(); i++) {
57 const acl::db_row* row = rows[i];
58 for (size_t j = 0; j < row->length(); j++) {
59 printf("%s, ", (*row)[j]);
60 }
61 printf("\r\n");
62 }
63 }
64
65 db.free_result();
66 return true;
67}
68
69// ��ѯ������
70static int tbl_select(acl::db_handle& db, int n)

Callers 1

mainFunction · 0.70

Calls 9

strconvFunction · 0.85
get_rowsMethod · 0.80
free_resultMethod · 0.80
formatMethod · 0.45
c_strMethod · 0.45
sql_updateMethod · 0.45
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…