1
0
mirror of https://github.com/stefanocasazza/ULib.git synced 2025-09-28 19:05:55 +08:00
This commit is contained in:
stefanocasazza 2018-07-13 15:37:22 +02:00
parent adfc221a4c
commit b9b1e25f19
5 changed files with 32 additions and 3 deletions

View File

@ -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)

View File

@ -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)

View File

@ -1 +1 @@
01CC
01D3

View File

@ -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)

View File

@ -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)
};