Use unique cursor names in postgres (#113)

This commit is contained in:
Dr. Patrick Urbanke (劉自成)
2025-12-31 00:56:19 +01:00
committed by GitHub
parent 9d0f0a29ab
commit a558c7bb23
2 changed files with 8 additions and 2 deletions

View File

@@ -1,3 +1,6 @@
#ifndef SQLGEN_INTERNAL_RANDOM_HPP
#define SQLGEN_INTERNAL_RANDOM_HPP
#include <random>
#include <string>
@@ -11,3 +14,6 @@ inline std::string random() {
}
} // namespace sqlgen::internal
#endif // SQLGEN_INTERNAL_RANDOM_HPP

View File

@@ -10,6 +10,7 @@
#include "../Ref.hpp"
#include "../Result.hpp"
#include "../internal/random.hpp"
#include "../sqlgen_api.hpp"
#include "PostgresV2Connection.hpp"
#include "PostgresV2Result.hpp"
@@ -52,8 +53,7 @@ class SQLGEN_API Iterator {
private:
static std::string make_cursor_name() {
// TODO: Create unique cursor names.
return "sqlgen_cursor";
return "sqlgen_cursor_" + internal::random();
}
/// Shuts the iterator down.