Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitab03605

Browse files
knizhnikkelvich
authored andcommitted
Fix bug in execQuery
1 parent9dff14c commitab03605

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

‎contrib/multimaster/tests/dtmbench.cpp‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,16 @@ void exec(transaction_base& txn, char const* sql, ...)
101101
txn.exec(buf);
102102
}
103103

104-
xid_texecQuery( transaction_base& txn,charconst* sql, ...)
104+
template<classT>
105+
TexecQuery( transaction_base& txn,charconst* sql, ...)
105106
{
106107
va_list args;
107108
va_start(args, sql);
108109
char buf[1024];
109110
vsprintf(buf, sql, args);
110111
va_end(args);
111112
result r = txn.exec(buf);
112-
return r[0][0].as(xid_t());
113+
return r[0][0].as(T());
113114
}
114115

115116
void*reader(void* arg)
@@ -154,8 +155,8 @@ void* writer(void* arg)
154155
exec(txn,"update t set v = v + 1 where u=%d", dstAcc);
155156
t.updates +=2;
156157
}else {
157-
int64_t sum =execQuery(txn,"select v from t where u=%d", srcAcc)
158-
+execQuery(txn,"select v from t where u=%d", dstAcc);
158+
int64_t sum = execQuery<int64_t>(txn,"select v from t where u=%d", srcAcc)
159+
+ execQuery<int64_t>(txn,"select v from t where u=%d", dstAcc);
159160
if (sum > cfg.nIterations*cfg.nWriters || sum < -cfg.nIterations*cfg.nWriters) {
160161
printf("Wrong sum=%ld\n", sum);
161162
}
@@ -164,6 +165,7 @@ void* writer(void* arg)
164165
txn.commit();
165166
t.transactions +=1;
166167
}catch (pqxx_exceptionconst& x) {
168+
printf("EXCEPTION: %s\n", x.base().what());
167169
txn.abort();
168170
t.aborts +=1;
169171
i -=1;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp