From b9b1e25f19fc2b40912afdefccc4c5735a71816b Mon Sep 17 00:00:00 2001 From: stefanocasazza Date: Fri, 13 Jul 2018 15:37:22 +0200 Subject: [PATCH] fix --- src/ulib/net/server/plugin/usp/query.usp | 2 +- src/ulib/net/server/plugin/usp/world.h | 13 +++++++++++++ tests/examples/TSA/tsaserial | 2 +- .../FrameworkBenchmarks/ULib/src/query.usp | 2 +- .../FrameworkBenchmarks/ULib/src/world.h | 16 ++++++++++++++++ 5 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/ulib/net/server/plugin/usp/query.usp b/src/ulib/net/server/plugin/usp/query.usp index 9951d5ae..852f3769 100644 --- a/src/ulib/net/server/plugin/usp/query.usp +++ b/src/ulib/net/server/plugin/usp/query.usp @@ -25,7 +25,7 @@ if (World::pdrv) for (; i < num_queries; ++i) { - res = World::pdrv->execPrepared(World::pstmt); + res = World::execPrepared(i); U_INTERNAL_ASSERT_EQUALS(PQnfields(res), 1) U_INTERNAL_ASSERT_EQUALS(PQntuples(res), 1) diff --git a/src/ulib/net/server/plugin/usp/world.h b/src/ulib/net/server/plugin/usp/world.h index 9531d600..851c7615 100644 --- a/src/ulib/net/server/plugin/usp/world.h +++ b/src/ulib/net/server/plugin/usp/world.h @@ -153,6 +153,19 @@ public: U_RETURN_POINTER(res, PGresult); } + static PGresult* execPrepared(uint32_t i) + { + U_TRACE(5, "World::execPrepared(%u)", i) + + U_INTERNAL_ASSERT_MAJOR(rnumber[i], 0) + + *(unsigned int*)num2str = htonl(rnumber[i]); + + PGresult* res = (PGresult*) U_SYSCALL(PQexecPrepared, "%p,%S,%u,%p,%p,%p,%u", conn, pstmt->stmtName, 1, pstmt->paramValues, pstmt->paramLengths, pstmt->paramFormats, 1); + + U_RETURN_POINTER(res, PGresult); + } + static void sendQueryPrepared(uint32_t i) { U_TRACE(5, "World::sendQueryPrepared(%u)", i) diff --git a/tests/examples/TSA/tsaserial b/tests/examples/TSA/tsaserial index 664803b7..04519668 100644 --- a/tests/examples/TSA/tsaserial +++ b/tests/examples/TSA/tsaserial @@ -1 +1 @@ -01CC +01D3 diff --git a/tests/examples/benchmark/FrameworkBenchmarks/ULib/src/query.usp b/tests/examples/benchmark/FrameworkBenchmarks/ULib/src/query.usp index 9951d5ae..852f3769 100644 --- a/tests/examples/benchmark/FrameworkBenchmarks/ULib/src/query.usp +++ b/tests/examples/benchmark/FrameworkBenchmarks/ULib/src/query.usp @@ -25,7 +25,7 @@ if (World::pdrv) for (; i < num_queries; ++i) { - res = World::pdrv->execPrepared(World::pstmt); + res = World::execPrepared(i); U_INTERNAL_ASSERT_EQUALS(PQnfields(res), 1) U_INTERNAL_ASSERT_EQUALS(PQntuples(res), 1) diff --git a/tests/examples/benchmark/FrameworkBenchmarks/ULib/src/world.h b/tests/examples/benchmark/FrameworkBenchmarks/ULib/src/world.h index a7951c11..9439e0e6 100644 --- a/tests/examples/benchmark/FrameworkBenchmarks/ULib/src/world.h +++ b/tests/examples/benchmark/FrameworkBenchmarks/ULib/src/world.h @@ -146,6 +146,19 @@ public: U_RETURN_POINTER(res, PGresult); } + static PGresult* execPrepared(uint32_t i) + { + U_TRACE(5, "World::execPrepared(%u)", i) + + U_INTERNAL_ASSERT_MAJOR(rnumber[i], 0) + + *(unsigned int*)num2str = htonl(rnumber[i]); + + PGresult* res = (PGresult*) U_SYSCALL(PQexecPrepared, "%p,%S,%u,%p,%p,%p,%u", conn, pstmt->stmtName, 1, pstmt->paramValues, pstmt->paramLengths, pstmt->paramFormats, 1); + + U_RETURN_POINTER(res, PGresult); + } + static void sendQueryPrepared(uint32_t i) { U_TRACE(5, "World::sendQueryPrepared(%u)", i) @@ -338,6 +351,9 @@ public: } } + const char* dump(bool breset) const; +#endif + private: U_DISALLOW_ASSIGN(World) };