1

I am working with SOCI in cpp

statement sql =
  (db.prepare << "insert into table(bunch of columns) "
      "values(:s,:e,:qs,:qe, :ts,:te, :qi, :ti,:tutr, :q_oc,:q_g, "
      ":q_ref, :t_loc, :t_org, :t_ref)",
    use(s, use(e), use(q), use(qutop),
    use(tart), use(top), use(qame), use(tame),
    use(utr), use(qoc), use(qrg), use(qref),
    use(toc), use(trg), use(tef));

Here all the variable in use() are vectors for bulk entry.

Upon using the

sql.execute(true);

the statement was executed but the memory allocated is never freed.

I have a large file about 1TB and upon executing this I always end up with memory overflow. Is there any way to clear the memory allocation done by sql.execute().

For now I have done work around by using

db << "insert into table(bunch of columns) "
      "values(:s,:e,:qs,:qe, :ts,:te, :qi, :ti,:tutr, :q_oc,:q_g, "
      ":q_ref, :t_loc, :t_org, :t_ref)",
    use(s, use(e), use(q), use(qutop),
    use(tart), use(top), use(qame), use(tame),
    use(utr), use(qoc), use(qrg), use(qref),
    use(toc), use(trg), use(tef);

But as I am I have to use the above statement multiple time I would rather use statement.execute()

0 Answers0