Please give an example of how to write to the file data from the Blob-field of the Oracle database in C ++ using this library here (OCILIB) https://vrogier.imtqy.com/ocilib/ . I managed to connect to the database and get a sample of normal data, but the problem with recording data.

    1 answer 1

    This is done like this:

    Environment::Initialize(); Connection con(L"db", L"user", L"passw"); std::wcout << L"SERVER VERSION:\n"; std::wcout << con.GetServerVersion() << std::endl; Statement st(con); st.Execute(L"select vf.filebody from sm.ver_files vf where vf.filename=\'padeg.dll\'"); Resultset rs = st.GetResultset(); while (rs.Next()) { ocilib::Blob blob = rs.Get<Blob>(1); big_uint size = blob.GetLength(); outf.open("padeg.dll", std::ios::out | std::ios::binary); if (outf.is_open()) { //outf.write((const char*)&rw[0], rw.size()); outf.write((const char*)&blob.Read(size)[0], size); std::wcout << L"Данные записаны!" << std::endl; } outf.close(); } con.Close();