Files
jtlPosSync/jtlsrv-cpp/src/queries/commit.hpp
2026-07-15 01:25:38 +02:00

36 lines
1.1 KiB
C++

#pragma once
#include <string>
#include "xml.hpp"
#include "../db/pool.hpp"
namespace delivery {
inline void commit_picklists(OdbcPool::Connection* c, int kBenutzer, int kSessionId, int kAuftrag) {
std::string bestellungen = xml::element("Bestellung", xml::tag("kBestellung", int64_t(kAuftrag)));
const char* sql =
"DECLARE @xBestellungen XML = CONVERT(XML, ?);"
"DECLARE @xResult XML;"
"EXEC Auslieferung.spPicklistenUebernehmen"
" @Bestellungen = @xBestellungen,"
" @kBenutzer = ?,"
" @nTeillieferung = 0,"
" @kSessionId = ?,"
" @xResult = @xResult OUTPUT";
std::vector<Param> ps = {
{ParamType::NVarChar, bestellungen, 0},
{ParamType::Int, "", kBenutzer},
{ParamType::Int, "", kSessionId}
};
ResultSet rs;
if (!get_pool().execute(c, sql, ps, rs)) {
const std::string& detail = get_pool().last_error();
throw std::runtime_error(detail.empty()
? "commit_picklists failed"
: "commit_picklists failed: " + detail);
}
}
} // namespace delivery