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

Method dbadd

lib_acl_cpp/samples/benchmark/sqlite/main.cpp:55–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53 }
54
55 int dbadd(acl::db_handle& db, int max) {
56 acl::string sql;
57 assert(db.begin_transaction());
58 for (int i = 0; i < max; i++) {
59 sql.format("insert into tbl_test('key', 'value')"
60 " values('key-%d', 'value-%d')", i, i);
61 if (db.sql_update(sql) == false) {
62 printf("sql_update: |%s| error\r\n", sql.c_str());
63 return -1;
64 }
65
66 if (i > 0 && i % 1000 == 0) {
67 assert(db.commit());
68 assert(db.begin_transaction());
69 }
70 }
71 assert(db.commit());
72 return max;
73 }
74
75 int dbget(acl::db_handle& db, int max) {
76 acl::string sql, key, value;

Callers

nothing calls this directly

Calls 5

begin_transactionMethod · 0.45
formatMethod · 0.45
sql_updateMethod · 0.45
c_strMethod · 0.45
commitMethod · 0.45

Tested by

no test coverage detected