Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Subject: [PATCH] Fix
- ---
- Index: taxi/uservices/userver/postgresql/CMakeLists.txt
- IDEA additional info:
- Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
- <+>UTF-8
- ===================================================================
- diff --git a/taxi/uservices/userver/postgresql/CMakeLists.txt b/taxi/uservices/userver/postgresql/CMakeLists.txt
- --- a/taxi/uservices/userver/postgresql/CMakeLists.txt (revision 7c1f5b52dd11d9b210f926f53a69b38f49ee7c28)
- +++ b/taxi/uservices/userver/postgresql/CMakeLists.txt (date 1729615441863)
- @@ -18,6 +18,20 @@
- target_link_libraries(userver-libpq INTERFACE PostgreSQL::PostgreSQL)
- endif()
- +add_executable(userver-impl-libpq-version-generator
- + "${CMAKE_CURRENT_SOURCE_DIR}/libpq-version-generator/main.cpp"
- +)
- +target_link_libraries(userver-impl-libpq-version-generator PRIVATE userver-libpq)
- +
- +set(LIBPQ_VERSION_DIR "${CMAKE_CURRENT_BINARY_DIR}/libpq_version")
- +add_custom_command(
- + OUTPUT "${LIBPQ_VERSION_DIR}/userver_libpq_version.hpp"
- + COMMAND "${CMAKE_COMMAND}" -E make_directory "${LIBPQ_VERSION_DIR}"
- + COMMAND $<TARGET_FILE:userver-impl-libpq-version-generator>
- + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
- + COMMENT "Running gRPC C++ protocol buffer compiler for ${root_path}"
- +)
- +
- file(GLOB_RECURSE SOURCES
- ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp)
- @@ -45,12 +59,16 @@
- add_library(${PROJECT_NAME} STATIC ${SOURCES})
- +target_sources(${PROJECT_NAME} PRIVATE "${LIBPQ_VERSION_DIR}/userver_libpq_version.hpp")
- +
- set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)
- -target_include_directories(${PROJECT_NAME} PUBLIC
- - $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
- - PRIVATE
- - ${CMAKE_CURRENT_SOURCE_DIR}/src
- +target_include_directories(${PROJECT_NAME}
- + PUBLIC
- + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
- + PRIVATE
- + "${CMAKE_CURRENT_SOURCE_DIR}/src"
- + "${LIBPQ_VERSION_DIR}"
- )
- target_link_libraries(${PROJECT_NAME}
- Index: taxi/uservices/userver/postgresql/libpq-version-generator/main.cpp
- IDEA additional info:
- Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
- <+>UTF-8
- ===================================================================
- diff --git a/taxi/uservices/userver/postgresql/libpq-version-generator/main.cpp b/taxi/uservices/userver/postgresql/libpq-version-generator/main.cpp
- new file mode 100644
- --- /dev/null (date 1729614771483)
- +++ b/taxi/uservices/userver/postgresql/libpq-version-generator/main.cpp (date 1729614771483)
- @@ -0,0 +1,10 @@
- +#include <fstream>
- +
- +#include <libpq-fe.h>
- +
- +int main() {
- + const int version = PQlibVersion();
- + std::ofstream out("libpq_version/userver_libpq_version.hpp", std::ios::out | std::ios::trunc);
- + out << "#pragma once\n" << "\n" << "#define USERVER_LIBPQ_VERSION " << version << "\n";
- + return 0;
- +}
- Index: taxi/uservices/userver/postgresql/src/storages/postgres/detail/pg_connection_wrapper.cpp
- IDEA additional info:
- Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
- <+>UTF-8
- ===================================================================
- diff --git a/taxi/uservices/userver/postgresql/src/storages/postgres/detail/pg_connection_wrapper.cpp b/taxi/uservices/userver/postgresql/src/storages/postgres/detail/pg_connection_wrapper.cpp
- --- a/taxi/uservices/userver/postgresql/src/storages/postgres/detail/pg_connection_wrapper.cpp (revision 7c1f5b52dd11d9b210f926f53a69b38f49ee7c28)
- +++ b/taxi/uservices/userver/postgresql/src/storages/postgres/detail/pg_connection_wrapper.cpp (date 1729615521379)
- @@ -14,6 +14,11 @@
- }
- #endif
- +// Generated header with
- +// #define USERVER_LIBPQ_VERSION AABBCC
- +// (two decimal digits per major, minor, patch versions)
- +#include <userver_libpq_version.hpp>
- +
- #include <userver/concurrent/background_task_storage.hpp>
- #include <userver/crypto/openssl.hpp>
- #include <userver/engine/task/cancel.hpp>
- @@ -84,15 +89,15 @@
- return "PQstatus: Consuming remaining response messages on connection";
- case CONNECTION_GSS_STARTUP:
- return "PQstatus: Negotiating GSSAPI";
- -#if PG_VERSION_NUM >= 130000
- +#if USERVER_LIBPQ_VERSION >= 130000
- case CONNECTION_CHECK_TARGET:
- return "PQstatus: Checking target server properties";
- #endif
- -#if PG_VERSION_NUM >= 140000
- +#if USERVER_LIBPQ_VERSION >= 140000
- case CONNECTION_CHECK_STANDBY:
- return "PQstatus: Checking if server is in standby mode";
- #endif
- -#if PG_VERSION_NUM >= 170000
- +#if USERVER_LIBPQ_VERSION >= 170000
- case CONNECTION_ALLOCATED:
- return "PQstatus: Waiting for connection attempt to be started";
- #endif
- @@ -704,7 +709,7 @@
- msg.ThrowException();
- break;
- }
- -#if PG_VERSION_NUM >= 140000
- +#if USERVER_LIBPQ_VERSION >= 140000
- case PGRES_PIPELINE_ABORTED:
- PGCW_LOG_LIMITED_WARNING() << "Command failure in a pipeline";
- CloseWithError(ConnectionError{"Command failure in a pipeline"});
- @@ -713,7 +718,7 @@
- PGCW_LOG_TRACE() << "Successful completion of all commands in a pipeline";
- break;
- #endif
- -#if PG_VERSION_NUM >= 170000
- +#if USERVER_LIBPQ_VERSION >= 170000
- case PGRES_TUPLES_CHUNK:
- PGCW_LOG_LIMITED_WARNING() << "Got a chunk of tuples from the larger resultset";
- CloseWithError(ConnectionError{"Got a chunk of tuples from the larger resultset"});
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement