@@ -101,6 +101,16 @@ void exec(transaction_base& txn, char const* sql, ...)
101
101
txn.exec (buf);
102
102
}
103
103
104
+ void insert (pipeline& pipe, char const * sql, ...)
105
+ {
106
+ va_list args;
107
+ va_start (args, sql);
108
+ char buf[1024 ];
109
+ vsprintf (buf, sql, args);
110
+ va_end (args);
111
+ pipe.insert (buf);
112
+ }
113
+
104
114
xid_t execQuery ( transaction_base& txn, char const * sql, ...)
105
115
{
106
116
va_list args;
@@ -194,15 +204,19 @@ void* writer(void* arg)
194
204
continue ;
195
205
}
196
206
197
- #if 1
198
- exec (srcTx, " prepare transaction '%u'" , xid);
199
- exec (dstTx, " prepare transaction '%u'" , xid);
200
- exec (srcTx, " commit prepared '%u'" , xid);
201
- exec (dstTx, " commit prepared '%u'" , xid);
202
- #else
203
207
pipeline srcPipe (srcTx);
204
208
pipeline dstPipe (dstTx);
205
209
210
+ #if 1
211
+ insert (srcPipe, " prepare transaction '%u'" , xid);
212
+ insert (dstPipe, " prepare transaction '%u'" , xid);
213
+ srcPipe.complete ();
214
+ dstPipe.complete ();
215
+ insert (srcPipe, " commit prepared '%u'" , xid);
216
+ insert (dstPipe, " commit prepared '%u'" , xid);
217
+ srcPipe.complete ();
218
+ dstPipe.complete ();
219
+ #else
206
220
srcPipe.insert("commit transaction");
207
221
dstPipe.insert("commit transaction");
208
222
0 commit comments